24 #error Pixels_PPI8.h must be included before Pixels_<CONTROLLER>.h
30 #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
31 #define DATAPORT PORTA
34 #define DATAPORT PORTD
58 sbi(registerRST, bitmaskRST);
60 cbi(registerRST, bitmaskRST);
62 sbi(registerRST, bitmaskRST);
68 void writeCmd(uint8_t b) {
69 cbi(registerRS, bitmaskRS);
70 DATAPORT = 0x00; pulse_low(registerWR, bitmaskWR); DATAPORT = b; pulse_low(registerWR, bitmaskWR);
73 void writeData(uint8_t data) {
74 sbi(registerRS, bitmaskRS);
75 DATAPORT = data; pulse_low(registerWR, bitmaskWR);
78 void writeData(uint8_t hi, uint8_t lo) {
79 sbi(registerRS, bitmaskRS);
80 DATAPORT = hi; pulse_low(registerWR, bitmaskWR); DATAPORT = lo; pulse_low(registerWR, bitmaskWR);
83 void writeDataTwice(uint8_t b) {
84 DATAPORT = b; pulse_low(registerWR, bitmaskWR); pulse_low(registerWR, bitmaskWR);
87 void writeCmdData(uint8_t cmd, uint16_t data) {
89 writeData(highByte(data), lowByte(data));
101 inline void setSpiPins(uint8_t scl, uint8_t sda, uint8_t cs, uint8_t rst, uint8_t wr) {
109 inline void setPpiPins(uint8_t rs, uint8_t wr, uint8_t cs, uint8_t rst, uint8_t rd) {
117 inline void registerSelect() {
118 sbi(registerRS, bitmaskRS);
122 void PPI8::initInterface() {
126 registerRS = portOutputRegister(digitalPinToPort(pinRS));
127 registerWR = portOutputRegister(digitalPinToPort(pinWR));
128 registerCS = portOutputRegister(digitalPinToPort(pinCS));
129 registerRST = portOutputRegister(digitalPinToPort(pinRST));
131 registerRD = portOutputRegister(digitalPinToPort(pinRD));
134 bitmaskRS = digitalPinToBitMask(pinRS);
135 bitmaskWR = digitalPinToBitMask(pinWR);
136 bitmaskCS = digitalPinToBitMask(pinCS);
137 bitmaskRST = digitalPinToBitMask(pinRST);
139 bitmaskRD = digitalPinToBitMask(pinRD);
142 pinMode(pinRS,OUTPUT);
143 pinMode(pinWR,OUTPUT);
144 pinMode(pinCS,OUTPUT);
145 pinMode(pinRST,OUTPUT);
void setPpiPins(uint8_t rs, uint8_t wr, uint8_t cs, uint8_t rst, uint8_t rd)
void setSpiPins(uint8_t scl, uint8_t sda, uint8_t cs, uint8_t rst, uint8_t wr)