poll until ready before sending data, not after
This change improves two aspects: - display will not receive instructions nor data until it is ready, even at startup when no previous commands have been sent - no time is wasted after writing instructions or data to the display
This commit is contained in:
parent
e696d2f52f
commit
9606a0b1ae
|
@ -97,6 +97,8 @@ uint8_t read_status(void)
|
|||
|
||||
void write_instruction_byte(uint8_t code)
|
||||
{
|
||||
POLL_UNTIL_READY;
|
||||
|
||||
// make sure GPIOE is in correct mode
|
||||
GPIOE->MODER = 0x55504000;
|
||||
|
||||
|
@ -110,12 +112,12 @@ void write_instruction_byte(uint8_t code)
|
|||
GPIOE->ODR = (code & 0x0F) << 12;
|
||||
GPIOE->BSRR = DISPLAY_ENA;
|
||||
GPIOE->BSRR = (DISPLAY_ENA << 16);
|
||||
|
||||
POLL_UNTIL_READY;
|
||||
}
|
||||
|
||||
void write_data_byte(uint8_t code)
|
||||
{
|
||||
POLL_UNTIL_READY;
|
||||
|
||||
// make sure GPIOE is in correct mode
|
||||
GPIOE->MODER = 0x55504000;
|
||||
|
||||
|
@ -129,8 +131,6 @@ void write_data_byte(uint8_t code)
|
|||
GPIOE->ODR = ((code & 0x0F) << 12) | (DISPLAY_RS);
|
||||
GPIOE->BSRR = DISPLAY_ENA;
|
||||
GPIOE->BSRR = DISPLAY_ENA << 16;
|
||||
|
||||
POLL_UNTIL_READY;
|
||||
}
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
|
Loading…
Reference in New Issue