|
|
|
@ -8,22 +8,22 @@ |
|
|
|
|
#include "ufb/framebuffer.h" |
|
|
|
|
#include "gpio.h" |
|
|
|
|
#include "spi.h" |
|
|
|
|
#include "FreeRTOS.h" |
|
|
|
|
|
|
|
|
|
#define SSD1309_HEIGHT 64 |
|
|
|
|
|
|
|
|
|
static inline void cs_select() |
|
|
|
|
{ |
|
|
|
|
// FIXME are the nops needed?
|
|
|
|
|
asm volatile("nop \n nop \n nop"); |
|
|
|
|
//asm volatile("nop \n nop \n nop");
|
|
|
|
|
LL_GPIO_ResetOutputPin(OLED_CS_GPIO_Port, OLED_CS_Pin); // Active low
|
|
|
|
|
asm volatile("nop \n nop \n nop"); |
|
|
|
|
//asm volatile("nop \n nop \n nop");
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static inline void cs_deselect() |
|
|
|
|
{ |
|
|
|
|
asm volatile("nop \n nop \n nop"); |
|
|
|
|
//asm volatile("nop \n nop \n nop");
|
|
|
|
|
LL_GPIO_SetOutputPin(OLED_CS_GPIO_Port, OLED_CS_Pin); |
|
|
|
|
asm volatile("nop \n nop \n nop"); |
|
|
|
|
//asm volatile("nop \n nop \n nop");
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static inline void dc_command() |
|
|
|
@ -42,10 +42,11 @@ void oled_command16(uint8_t cmd, uint8_t arg) |
|
|
|
|
cs_select(); |
|
|
|
|
|
|
|
|
|
LL_SPI_TransmitData8(SPI_OLED, cmd); |
|
|
|
|
while (!LL_SPI_IsActiveFlag_TXE(SPI_OLED)) {} |
|
|
|
|
|
|
|
|
|
while (!LL_SPI_IsActiveFlag_TXE(SPI_OLED)) {} |
|
|
|
|
LL_SPI_TransmitData8(SPI_OLED, arg); |
|
|
|
|
while (LL_SPI_IsActiveFlag_BSY(SPI_OLED)) {} |
|
|
|
|
|
|
|
|
|
while (!LL_SPI_IsActiveFlag_TXE(SPI_OLED) || LL_SPI_IsActiveFlag_BSY(SPI_OLED)) {} |
|
|
|
|
|
|
|
|
|
cs_deselect(); |
|
|
|
|
} |
|
|
|
@ -56,7 +57,7 @@ void oled_command(uint8_t cmd) |
|
|
|
|
cs_select(); |
|
|
|
|
|
|
|
|
|
LL_SPI_TransmitData8(SPI_OLED, cmd); |
|
|
|
|
while (LL_SPI_IsActiveFlag_BSY(SPI_OLED)) {} |
|
|
|
|
while (!LL_SPI_IsActiveFlag_TXE(SPI_OLED) || LL_SPI_IsActiveFlag_BSY(SPI_OLED)) {} |
|
|
|
|
|
|
|
|
|
cs_deselect(); |
|
|
|
|
} |
|
|
|
|