#define ZLG7289_pinCLK (GPIO_PIN_0) //PE0时钟信号,上升沿有效
#define ZLG7289_pinDIO (GPIO_PIN_1) //PE1数据信号,双向
#define ZLG7289_pinCS (GPIO_PIN_2) //PE2片选信号,低电平有效
#define ZLG7289_pinINT (GPIO_PIN_7) //PD7键盘中断请求信号,低电平(负边沿)有效
#define WHITE 0
#define BLACK 1
#define LEDS8 (0xFF<<0) // P1[25:18]控制LED8~LED1,低电平点亮
//OLED屏测试用变量
#define AD0_PIN_NUM 0 //8位数据总线
#define RD_PIN_NUM 2 //PE08 读数据/指令控制位,低电平有效
#define WR_PIN_NUM 3 //PE09 写数据/指令控制位,高电平变低电平时写入
#define DC_PIN_NUM 1 //PE10数据/指令控制位,低电平—指令操作,高电平—数据操作
#define RES_PIN_NUM 7 //PE11 复位信号,低电平复位
#define CS_PIN_NUM 6 //PE12 使能位,低电平有效
#define PIN_RD ( 1 << 2)
#define PIN_RW ( 1 << 3)
#define PIN_DC ( 1 << 1)
#define PIN_RST ( 1 << 7)
#define PIN_CS ( 1 << 6)
#define PINS_CTRL (0x1F << 8)
#define PINS_DATA (0xFF << 0)
#define PINS_ALL (PINS_CTRL | PINS_DATA)
/* pin CS setting to 0 or 1 */
#define LCD_CS(x) GPIOC->ODR = (GPIOC->ODR & ~PIN_CS) | (x ? PIN_CS : 0 );
/* pin RST setting to 0 or 1 */
#define LCD_RST(x) GPIOC->ODR = (GPIOC->ODR & ~PIN_RST) | (x ? PIN_RST : 0);
/* pin RS setting to 0 or 1 */
#define LCD_DC(x) GPIOC->ODR = (GPIOC->ODR & ~PIN_DC) | (x ? PIN_DC : 0 );
/* pin RW setting to 0 or 1 */
#define LCD_RW(x) GPIOC->ODR = (GPIOC->ODR & ~PIN_RW) | (x ? PIN_RW : 0 );
/* pin RD setting to 0 or 1 */
#define LCD_RD(x) GPIOC->ODR = (GPIOC->ODR & ~PIN_RD) | (x ? PIN_RD : 0 );
/* Reading DATA pins */
#define LCD_DATA_IN (((GPIOB->IDR & PINS_DATA) >> 0) & 0xFF)
/* Writing value to DATA pins */
#define LCD_DATA_OUT(x) GPIOB->ODR = (GPIOB->ODR & ~PINS_DATA) | (x << 0);
#define DELAY_2N 0
char dispbuff[32];
unsigned char page; //显示页面数,0-63行,分为 0-7 个页面
unsigned char com; //显示命令
unsigned char dat; //显示数据
unsigned char jj; //字库查询辅助变量
unsigned char w_or_b;
extern void ExBusInit(void);
extern uint8 ReadData(void);
extern void WriteCommand(uint8 Data);
extern void WriteData(uint8 Data);
extern void clr_oled(void);
extern void init_oled(void);
extern void set_position(uint8 page1,uint8 p1,uint8 col1);
extern void display_prog(uint8 line,uint8 column,uint8 nn); //显示程序
extern void dprintf_CHAR12 (uint8 line,uint8 column,char str[20]);
extern void dprintf_WORD16 (uint8 line,uint8 column,char str[20]);
extern void dprintf_NUM48(uint8 line,uint8 column,char str[20]);
extern void disp_float(uint8 row,uint8 col,float x);
extern void disp_float_1(uint8 row,uint8 col,float x);
extern void disp_int(uint8 row,uint8 col,uint16 x);
//==========================================================================================
//**
//**纵向取模,字节倒序
//**
//==========================================================================================
typedef struct typCHAR_12 // 汉字字模显示数据结构
{
uint8 Index[2];
uint8 Msk[16];
}typCHAR_12;
/******************************************************************************************/
//
/******************************************************************************************/
typCHAR_12 const CHAR_12[]={ //16*8 字符
"1",0x00,0x00,0x20,0x20,0xF8,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x1F,0x10,0x10,0x00,
"2",0x00,0x30,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x18,0x14,0x12,0x11,0x10,0x18,0x00,
"3",0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x0C,0x10,0x10,0x10,0x11,0x0E,0x00,
"4",0x00,0x80,0x40,0x20,0xF8,0x00,0x00,0x00,0x00,0x03,0x02,0x12,0x1F,0x12,0x12,0x00,
"5",0x00,0xF8,0x88,0x48,0x48,0x48,0x88,0x00,0x00,0x0C,0x10,0x10,0x10,0x10,0x0F,0x00,
"6",0x00,0xE0,0x10,0x88,0x88,0x98,0x00,0x00,0x00,0x0F,0x11,0x10,0x10,0x10,0x0F,0x00,
"7",0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,
"8",0x00,0x70,0x88,0x88,0x88,0x88,0x70,0x00,0x00,0x0E,0x11,0x10,0x10,0x11,0x0E,0x00,
"9",0x00,0xF0,0x08,0x08,0x08,0x90,0xE0,0x00,0x00,0x00,0x19,0x11,0x11,0x08,0x07,0x00,
"0",0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x07,0x08,0x10,0x10,0x08,0x07,0x00,
".",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,
"a",0x00,0x20,0x90,0x50,0x50,0xE0,0x00,0x00,0x00,0x03,0x04,0x04,0x04,0x07,0x04,0x00,
"b",0x02,0xFE,0x20,0x10,0x10,0x10,0xE0,0x00,0x00,0x07,0x04,0x04,0x04,0x04,0x03,0x00,
"c",0x00,0xC0,0x20,0x10,0x10,0x10,0x20,0x00,0x00,0x01,0x02,0x04,0x04,0x04,0x02,0x00,
"d",0x00,0xE0,0x10,0x10,0x10,0x12,0xFE,0x00,0x00,0x03,0x04,0x04,0x04,0x02,0x07,0x04,
"e",0x00,0xE0,0x50,0x50,0x50,0x50,0x60,0x00,0x00,0x03,0x04,0x04,0x04,0x04,0x02,0x00,
"f",0x00,0x10,0x10,0xFC,0x12,0x12,0x06,0x00,0x00,0x04,0x04,0x07,0x04,0x04,0x00,0x00,
"g",0x00,0xB0,0x48,0x48,0x48,0x38,0x08,0x00,0x00,0x06,0x09,0x09,0x09,0x09,0x06,0x00,
"h",0x02,0xFE,0x20,0x10,0x10,0x10,0xE0,0x00,0x04,0x07,0x04,0x00,0x00,0x04,0x07,0x04,
"i",0x00,0x10,0x16,0xF6,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x07,0x04,0x04,0x00,0x00,
"k",0x02,0xFE,0x80,0x40,0xB0,0x10,0x10,0x00,0x04,0x07,0x04,0x00,0x05,0x06,0x04,0x00,
"l",0x00,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x07,0x04,0x04,0x00,0x00,
"m",0x10,0xF0,0x10,0xF0,0x10,0xE0,0x00,0x00,0x04,0x07,0x00,0x07,0x00,0x07,0x04,0x00,
"n",0x10,0xF0,0x20,0x10,0x10,0x10,0xE0,0x00,0x04,0x07,0x04,0x00,0x00,0x04,0x07,0x04,
"o",0x00,0xC0,0x20,0x10,0x10,0x20,0xC0,0x00,0x00,0x01,0x02,0x04,0x04,0x02,0x01,0x00,
"p",0x08,0xF8,0x10,0x08,0x08,0x08,0xF0,0x00,0x08,0x0F,0x0A,0x02,0x02,0x02,0x01,0x00,
"q",0x00,0xF0,0x08,0x08,0x08,0x08,0xF8,0x00,0x00,0x01,0x02,0x02,0x02,0x09,0x0F,0x08,
"r",0x10,0x10,0xF0,0x20,0x10,0x10,0x30,0x00,0x04,0x04,0x07,0x04,0x04,0x00,0x00,0x00,
"s",0x00,0x60,0x90,0x90,0x90,0x30,0x00,0x00,0x00,0x06,0x04,0x04,0x04,0x03,0x00,0x00,
"t",0x00,0x10,0x10,0xFC,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x00,0x00,
"u",0x10,0xF0,0x00,0x00,0x00,0x10,0xF0,0x00,0x00,0x03,0x04,0x04,0x04,0x02,0x07,0x04,
"v",0x10,0x30,0xD0,0x00,0x00,0xD0,0x30,0x10,0x00,0x00,0x01,0x06,0x01,0x00,0x00,0x00,
"w",0x10,0xF0,0x00,0xF0,0x00,0xF0,0x10,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x00,0x00,
"x",0x00,0x10,0x30,0xC0,0xD0,0x30,0x10,0x00,0x00,0x04,0x06,0x05,0x01,0x06,0x04,0x00,
"y",0x08,0x18,0xE8,0x00,0x80,0x68,0x18,0x08,0x08,0x08,0x08,0x07,0x01,0x00,0x00,0x00,
"z",0x00,0x30,0x10,0x90,0x50,0x30,0x10,0x00,0x00,0x04,0x06,0x05,0x04,0x04,0x06,0x00,
/*
"_",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,
"/",0x00,0x00,0x00,0xE0,0x18,0x07,0x00,0x00,0x00,0x0C,0x03,0x00,0x00,0x00,0x00,0x00,
":",0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x0C,0x00,0x00,0x00,
" ",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
">",0x00,0x00,0x40,0x40,0x80,0x80,0x00,0x00,0x01,0x01,0x05,0x05,0x03,0x03,0x01,0x01,
"<",0x00,0xFC,0x07,0x07,0x04,0xF8,0x00,0x00,0x10,0x9F,0xF0,0x90,0xF0,0x9F,0x10,0x00,
"C",0x00,0xF0,0x08,0x08,0x08,0x08,0x38,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x10,0x00,
"%",0xE0,0x50,0xE0,0x90,0x68,0x14,0x0A,0x00,0x00,0x31,0x0C,0x03,0x0E,0x11,0x0E,0x00,
"+",0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x0F,0x01,0x01,0x01,
"-",0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
";",0x00,0x00,0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x08,0x04,0x02,0x01,0x00,
"=",0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
"L",0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x20,0x00,
"A",0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20,
"B",0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00,
"O",0xF8,0x04,0x02,0x02,0x02,0x04,0xF8,0x00,0x01,0x02,0x04,0x04,0x04,0x02,0x01,0x00,
"N",0x00,0x02,0xFE,0x0E,0x70,0x82,0xFE,0x02,0x00,0x04,0x07,0x04,0x00,0x03,0x07,0x00,
"D",0x00,0x02,0xFE,0x02,0x02,0x02,0x04,0xF8,0x00,0x04,0x07,0x04,0x04,0x04,0x02,0x01,
*/
}; |
|