@@ -66,18 +66,30 @@ uint8_t u8x8_rt_gpio_and_delay(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void
6666 break ;
6767
6868 case U8X8_MSG_GPIO_AND_DELAY_INIT :
69- //Function which implements a delay, arg_int contains the amount of ms
70- //set mode
69+ // Function which implements a delay, arg_int contains the amount of ms
70+ // set spi pin mode
7171 rt_pin_mode (u8x8 -> pins [U8X8_PIN_SPI_CLOCK ],PIN_MODE_OUTPUT );//d0 a5 15 d1 a7 17 res b0 18 dc b1 19 cs a4 14
7272 rt_pin_mode (u8x8 -> pins [U8X8_PIN_SPI_DATA ],PIN_MODE_OUTPUT );
7373 rt_pin_mode (u8x8 -> pins [U8X8_PIN_RESET ],PIN_MODE_OUTPUT );
7474 rt_pin_mode (u8x8 -> pins [U8X8_PIN_DC ],PIN_MODE_OUTPUT );
7575 rt_pin_mode (u8x8 -> pins [U8X8_PIN_CS ],PIN_MODE_OUTPUT );
76-
76+ // set i2c pin mode
7777 rt_pin_mode (u8x8 -> pins [U8X8_PIN_I2C_DATA ],PIN_MODE_OUTPUT );
7878 rt_pin_mode (u8x8 -> pins [U8X8_PIN_I2C_CLOCK ],PIN_MODE_OUTPUT );
79-
80- //set value
79+ // set 8080 pin mode
80+ rt_pin_mode (u8x8 -> pins [U8X8_PIN_D0 ],PIN_MODE_OUTPUT );
81+ rt_pin_mode (u8x8 -> pins [U8X8_PIN_D1 ],PIN_MODE_OUTPUT );
82+ rt_pin_mode (u8x8 -> pins [U8X8_PIN_D2 ],PIN_MODE_OUTPUT );
83+ rt_pin_mode (u8x8 -> pins [U8X8_PIN_D3 ],PIN_MODE_OUTPUT );
84+ rt_pin_mode (u8x8 -> pins [U8X8_PIN_D4 ],PIN_MODE_OUTPUT );
85+ rt_pin_mode (u8x8 -> pins [U8X8_PIN_D5 ],PIN_MODE_OUTPUT );
86+ rt_pin_mode (u8x8 -> pins [U8X8_PIN_D6 ],PIN_MODE_OUTPUT );
87+ rt_pin_mode (u8x8 -> pins [U8X8_PIN_D7 ],PIN_MODE_OUTPUT );
88+ rt_pin_mode (u8x8 -> pins [U8X8_PIN_E ],PIN_MODE_OUTPUT );
89+ rt_pin_mode (u8x8 -> pins [U8X8_PIN_DC ],PIN_MODE_OUTPUT );
90+ rt_pin_mode (u8x8 -> pins [U8X8_PIN_RESET ],PIN_MODE_OUTPUT );
91+
92+ // set value
8193 rt_pin_write (u8x8 -> pins [U8X8_PIN_SPI_CLOCK ],1 );
8294 rt_pin_write (u8x8 -> pins [U8X8_PIN_SPI_DATA ],1 );
8395 rt_pin_write (u8x8 -> pins [U8X8_PIN_RESET ],1 );
@@ -91,7 +103,48 @@ uint8_t u8x8_rt_gpio_and_delay(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void
91103 __asm__ volatile ("nop" );
92104 }
93105 break ; // arg_int=1: delay by 5us, arg_int = 4: delay by 1.25us
94-
106+
107+ //case U8X8_MSG_GPIO_D0: // D0 or SPI clock pin: Output level in arg_int
108+ //case U8X8_MSG_GPIO_SPI_CLOCK:
109+
110+ //case U8X8_MSG_GPIO_D1: // D1 or SPI data pin: Output level in arg_int
111+ //case U8X8_MSG_GPIO_SPI_DATA:
112+
113+ case U8X8_MSG_GPIO_D2 : // D2 pin: Output level in arg_int
114+ if (arg_int ) rt_pin_write (u8x8 -> pins [U8X8_PIN_D2 ],1 );
115+ else rt_pin_write (u8x8 -> pins [U8X8_PIN_D2 ],0 );
116+ break ;
117+
118+ case U8X8_MSG_GPIO_D3 : // D3 pin: Output level in arg_int
119+ if (arg_int ) rt_pin_write (u8x8 -> pins [U8X8_PIN_D3 ],1 );
120+ else rt_pin_write (u8x8 -> pins [U8X8_PIN_D3 ],0 );
121+ break ;
122+
123+ case U8X8_MSG_GPIO_D4 : // D4 pin: Output level in arg_int
124+ if (arg_int ) rt_pin_write (u8x8 -> pins [U8X8_PIN_D4 ],1 );
125+ else rt_pin_write (u8x8 -> pins [U8X8_PIN_D4 ],0 );
126+ break ;
127+
128+ case U8X8_MSG_GPIO_D5 : // D5 pin: Output level in arg_int
129+ if (arg_int ) rt_pin_write (u8x8 -> pins [U8X8_PIN_D5 ],1 );
130+ else rt_pin_write (u8x8 -> pins [U8X8_PIN_D5 ],0 );
131+ break ;
132+
133+ case U8X8_MSG_GPIO_D6 : // D6 pin: Output level in arg_int
134+ if (arg_int ) rt_pin_write (u8x8 -> pins [U8X8_PIN_D6 ],1 );
135+ else rt_pin_write (u8x8 -> pins [U8X8_PIN_D6 ],0 );
136+ break ;
137+
138+ case U8X8_MSG_GPIO_D7 : // D7 pin: Output level in arg_int
139+ if (arg_int ) rt_pin_write (u8x8 -> pins [U8X8_PIN_D7 ],1 );
140+ else rt_pin_write (u8x8 -> pins [U8X8_PIN_D7 ],0 );
141+ break ;
142+
143+ case U8X8_MSG_GPIO_E : // E/WR pin: Output level in arg_int
144+ if (arg_int ) rt_pin_write (u8x8 -> pins [U8X8_PIN_E ],1 );
145+ else rt_pin_write (u8x8 -> pins [U8X8_PIN_E ],0 );
146+ break ;
147+
95148 case U8X8_MSG_GPIO_I2C_CLOCK : // arg_int=0: Output low at I2C clock pin
96149 if (arg_int ) rt_pin_write (u8x8 -> pins [U8X8_PIN_I2C_CLOCK ],1 );
97150 else rt_pin_write (u8x8 -> pins [U8X8_PIN_I2C_CLOCK ],0 );
@@ -107,7 +160,7 @@ uint8_t u8x8_rt_gpio_and_delay(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void
107160 if (arg_int ) rt_pin_write (u8x8 -> pins [U8X8_PIN_SPI_CLOCK ],1 );
108161 else rt_pin_write (u8x8 -> pins [U8X8_PIN_SPI_CLOCK ],0 );
109162 break ;
110-
163+
111164 case U8X8_MSG_GPIO_SPI_DATA :
112165 //Function to define the logic level of the data line to the display
113166 if (arg_int ) rt_pin_write (u8x8 -> pins [U8X8_PIN_SPI_DATA ],1 );
0 commit comments