diff --git a/ssd1306.h b/ssd1306.h --- a/ssd1306.h +++ b/ssd1306.h @@ -1,20 +1,29 @@ #ifndef ssd1306_H #define ssd1306_H -#define SSD_RESET GPIOB,GPIO_Pin_2 -#define SSD_A0 GPIOB,GPIO_Pin_10 -#define SSD_CS GPIOB,GPIO_Pin_1 +#define SSD_RESET GPIOB,GPIO_PIN_2 +#define SSD_A0 GPIOB,GPIO_PIN_10 +#define SSD_CS GPIOB,GPIO_PIN_1 -#define SSD_Reset_Low() GPIO_ResetBits(SSD_RESET) -#define SSD_Reset_High() GPIO_SetBits(SSD_RESET) -#define SSD_A0_Low() GPIO_ResetBits(SSD_A0) -#define SSD_A0_High() GPIO_SetBits(SSD_A0) -#define SSD_CS_Low() GPIO_ResetBits(SSD_CS) -#define SSD_CS_High() GPIO_SetBits(SSD_CS) +#define SSD_Reset_Low() HAL_GPIO_WritePin(SSD_RESET, 0) +#define SSD_Reset_High() HAL_GPIO_WritePin(SSD_RESET, 1) +#define SSD_A0_Low() HAL_GPIO_WritePin(SSD_A0, 0) +#define SSD_A0_High() HAL_GPIO_WritePin(SSD_A0, 1) +#define SSD_CS_Low() HAL_GPIO_WritePin(SSD_CS, 0) +#define SSD_CS_High() HAL_GPIO_WritePin(SSD_CS, 1) // Use stdperiph -#define SPI_SendByte(data) SPI_I2S_SendData(SPI1,data) -#define SPI_Wait() while(!(SPI1->SR&SPI_I2S_FLAG_TXE));while(SPI1->SR&SPI_I2S_FLAG_BSY); + +//extern SPI_HandleTypeDef spi1; + +// EMZ FIXME this won't really work +//#define SPI_SendByte(data) HAL_SPI_Transmit(&spi1, data, 1, 100) +#define SPI_SendByte(data) +#define SPI_Wait() + +//#define SPI_SendByte(data) SPI_I2S_SendData(SPI1,data) + +//#define SPI_Wait() while(!(SPI1->SR&SPI_FLAG_TXE));while(SPI1->SR&SPI_FLAG_BSY); void ssd1306_Init(void);