文件名称:oled_spi.zip
文件大小:6.18MB
文件格式:ZIP
更新时间:2022-06-21 10:21:26
SPI
用stm32来控制spi接口的oled,oled为6pin接口 #define __OLED_SPI_H #include "stm32f10x.h" #define OLED_SPI_GPIO GPIOF #define OLED_SPI_RCCEN RCC_APB2Periph_GPIOF #define OLED_SPI_SCL GPIO_Pin_14 //D0 #define OLED_SPI_SDA GPIO_Pin_13 //D1 #define OLED_SPI_RST GPIO_Pin_11 //RST #define OLED_SPI_DC GPIO_Pin_12 //DC #define OLED_CMD 0 //??? #define OLED_DATA 1 //??? #define OLED_SPI_D0_OL GPIO_ResetBits(OLED_SPI_GPIO, OLED_SPI_SCL) //D0 IO?????? #define OLED_SPI_D0_OH GPIO_SetBits(OLED_SPI_GPIO, OLED_SPI_SCL) //D0 IO?????? #define OLED_SPI_D1_OL GPIO_ResetBits(OLED_SPI_GPIO, OLED_SPI_SDA) //D1 IO?????? #define OLED_SPI_D1_OH GPIO_SetBits(OLED_SPI_GPIO, OLED_SPI_SDA) //D1 IO?????? #define OLED_SPI_RST_OL GPIO_ResetBits(OLED_SPI_GPIO, OLED_SPI_RST) //RST IO?????? #define OLED_SPI_RST_OH GPIO_SetBits(OLED_SPI_GPIO, OLED_SPI_RST) //RST IO?????? #define OLED_SPI_DC_OL GPIO_ResetBits(OLED_SPI_GPIO, OLED_SPI_DC) //DC IO?????? #define OLED_SPI_DC_OH GPIO_SetBits(OLED_SPI_GPIO, OLED_SPI_DC) //DC IO?????? #define OLED_SPI_RST_Clr() GPIO_ResetBits(OLED_SPI_GPIO, OLED_SPI_RST) //RST IO?????? #define OLED_SPI_RST_Set() GPIO_SetBits(OLED_SPI_GPIO, OLED_SPI_RST) //RST IO?????? #define OLED_SPI_RS_Clr() GPIO_ResetBits(OLED_SPI_GPIO, OLED_SPI_DC) //DC IO?????? #define OLED_SPI_RS_Set() GPIO_SetBits(OLED_SPI_GPIO, OLED_SPI_DC) //DC IO?????? #define OLED_SPI_SCLK_Clr() GPIO_ResetBits(OLED_SPI_GPIO, OLED_SPI_SCL) //D0 IO?????? #define OLED_SPI_SCLK_Set() GPIO_SetBits(OLED_SPI_GPIO, OLED_SPI_SCL) //D0 IO?????? #define OLED_SPI_SDIN_Clr() GPIO_ResetBits(OLED_SPI_GPIO, OLED_SPI_SDA) //D1 IO?????? #define OLED_SPI_SDIN_Set() GPIO_SetBits(OLED_SPI_GPIO, OLED_SPI_SDA) //D1 IO?????? void OLED_SPI_WR_Byte(uint8_t dat,uint8_t cmd); void OLED_SPI_Init(void); void OLED_SPI_WrDat(unsigned char data); void OLED_SPI_WrCmd(unsigned char cmd); void OLED_SPI_Set_Pos(unsigned char x, unsigned char y); void OLED_SPI_Fill(unsigned char bmp_data); void OLED_SPI_CLS(void); void OLED2_P6x8Str(u8 x,u8 y,u8 ch[]);//小字符串; void OLED2_P16x32Str(u8 x,u8 y,unsigned char ch[]); void sssb1(void); void sssb2(void); void sspb1(void); void ssxl(void); void hallokitty_bmp(void); void sjb_bmp(u8 rock); void LCD_PutPixel(u8 x,u8 y); void LCD_Put_Column(u8 x,u8 y,u8 data); void OLED_write_2_num(unsigned char X,unsigned char Y,signed int s); void OLED_write_char(unsigned char c); #endif