8
8
#include " common/pimoroni_common.hpp"
9
9
#include " common/pimoroni_bus.hpp"
10
10
#include " libraries/pico_graphics/pico_graphics.hpp"
11
+ #include " drivers/shiftregister/shiftregister.hpp"
11
12
12
13
namespace pimoroni {
13
14
@@ -23,14 +24,25 @@ namespace pimoroni {
23
24
uint DC = 28 ; // 27;
24
25
uint SCK = SPI_DEFAULT_SCK;
25
26
uint MOSI = SPI_DEFAULT_MOSI;
26
- uint BUSY = PIN_UNUSED;
27
27
uint RESET = 27 ; // 25;
28
28
29
- absolute_time_t timeout;
29
+ uint SR_CLOCK = 8 ;
30
+ uint SR_LATCH = 9 ;
31
+ uint SR_DATA = 10 ;
30
32
31
33
bool blocking = false ;
32
34
35
+ ShiftRegister<uint8_t > sr = ShiftRegister<uint8_t >(SR_CLOCK, SR_LATCH, SR_DATA);
36
+
33
37
public:
38
+ enum Button : uint8_t {
39
+ BUTTON_A = 1 ,
40
+ BUTTON_B = 2 ,
41
+ BUTTON_C = 4 ,
42
+ BUTTON_D = 8 ,
43
+ BUTTON_E = 16
44
+ };
45
+
34
46
enum colour : uint8_t {
35
47
BLACK = 0 ,
36
48
WHITE = 1 ,
@@ -44,12 +56,12 @@ namespace pimoroni {
44
56
45
57
UC8159Inky7 (uint16_t width, uint16_t height) : UC8159Inky7(width, height, ROTATE_0, {PIMORONI_SPI_DEFAULT_INSTANCE, SPI_BG_FRONT_CS, SPI_DEFAULT_SCK, SPI_DEFAULT_MOSI, PIN_UNUSED, 28 , PIN_UNUSED}) {};
46
58
47
- UC8159Inky7 (uint16_t width, uint16_t height, SPIPins pins, uint busy=PIN_UNUSED, uint reset=27 ) : UC8159Inky7(width, height, ROTATE_0, pins, busy , reset) {};
59
+ UC8159Inky7 (uint16_t width, uint16_t height, SPIPins pins, uint reset=27 ) : UC8159Inky7(width, height, ROTATE_0, pins, reset) {};
48
60
49
- UC8159Inky7 (uint16_t width, uint16_t height, Rotation rotation, SPIPins pins, uint busy=PIN_UNUSED, uint reset=27 ) :
61
+ UC8159Inky7 (uint16_t width, uint16_t height, Rotation rotation, SPIPins pins, uint reset=27 ) :
50
62
DisplayDriver (width, height, rotation),
51
63
spi (pins.spi),
52
- CS (pins.cs), DC(pins.dc), SCK(pins.sck), MOSI(pins.mosi), BUSY(busy), RESET(reset) {
64
+ CS (pins.cs), DC(pins.dc), SCK(pins.sck), MOSI(pins.mosi), RESET(reset) {
53
65
init ();
54
66
}
55
67
@@ -58,7 +70,7 @@ namespace pimoroni {
58
70
// Methods
59
71
// --------------------------------------------------
60
72
public:
61
- void busy_wait (uint minimum_wait_ms= 0 );
73
+ void busy_wait ();
62
74
void reset ();
63
75
void power_off ();
64
76
@@ -67,6 +79,8 @@ namespace pimoroni {
67
79
68
80
void set_blocking (bool blocking);
69
81
82
+ bool is_pressed (Button button);
83
+
70
84
private:
71
85
void init ();
72
86
void setup ();
0 commit comments