IC解密GD32E230 SPI方式驱动SSD1306源码
IC解密单片机源程序如下:
- #ifndef __SSD1306_SPI_H
- #define __SSD1306_SPI_H
- #include "gd32e230.h"
- /*******************************宏定义****************************************/
- #define XLevelL 0x00
- #define XLevelH 0x10
- #define XLevel ((XLevelH&0x0F)*16+XLevelL)
- #define Max_Column 128
- #define Max_Row 64
- #define Brightness 0xCF
- #define X_WIDTH 128
- #define Y_WIDTH 64
- //-----------------OLED端口定义----------------
- #define OLED_CS_Clr() GPIO_BC(GPIOB) = GPIO_PIN_0
- #define OLED_CS_Set() GPIO_BOP(GPIOB) = GPIO_PIN_0 //接OLED模块CS B0
- #define OLED_DC_Clr() GPIO_BC(GPIOB) = GPIO_PIN_1
- #define OLED_DC_Set() GPIO_BOP(GPIOB) = GPIO_PIN_1 //接OLED模块D/C B1
- #define OLED_SDA_Clr() GPIO_BC(GPIOB) = GPIO_PIN_8
- #define OLED_SDA_Set() GPIO_BOP(GPIOB) = GPIO_PIN_8 //接OLED模块MOSI B8
- #define OLED_SCL_Clr() GPIO_BC(GPIOA) = GPIO_PIN_7
- #define OLED_SCL_Set() GPIO_BOP(GPIOA) = GPIO_PIN_7 //接OLED模块的CLK B9
- //#define OLED_CMD 0 //写命令
- //#define OLED_DATA 1 //写数据
- //OLED控制用函数
- void OLED_WrDat(unsigned char dat);//写数据
- void OLED_WrCmd(unsigned char cmd);//写命令
- void OLED_SetPos(unsigned char x, unsigned char y);//设置起始点坐标
- void OLED_Fill(unsigned char bmp_dat);//全屏填充
- void OLED_CLS(void);//清屏
- void OLED_Init(void);//初始化
- void OLED_6x8Str(unsigned char x, unsigned char y, unsigned char ch[]);
- //void OLED_8x16Str(unsigned char x, unsigned char y, unsigned char ch[]);
- void OLED_8x16Str(unsigned char x, unsigned char y, unsigned char FB,unsigned char ch[]);
- void OLED_16x16CN(unsigned char x, unsigned char y, unsigned char N);
- void OLED_BMP(unsigned char x0, unsigned char y0, unsigned char x1, unsigned char y1, unsigned char BMP[]);
- #endif
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- #include "SSD1306_SPI.h"
- #include "systick.h"
- #include "codetab.h"
- void delay(uint32_t nCount)
- {
- unsigned int a;
- while(nCount)
- {
- a=1800;
- while(a--);
- nCount--;
- }
- return;
- }

芯片解密