TA的每日心情 | 衰 2017-11-27 16:33 |
---|
签到天数: 7 天 连续签到: 1 天 [LV.3]偶尔看看II
|
- #include "include.h"
- int main(void)
- {
- systick_config();
-
- UART_Init(USART0,115200);
- LED_Init();
- KEY_Init();
- OLED_Init();
-
- OLED_Print(0,0,"GD32f450 test!");
- OLED_Print(0,2,"KEY1:");
- OLED_Print(0,4,"KEY2:");
- OLED_Print(0,6,"KEY3:");
-
- while(1)
- {
- LED_Troggle();
- delay_1ms(200);
- printf("综合测试实验\r\n");
- printf("%d %d %d\r\n",KEY1_State,KEY2_State,KEY3_State);
- OLED_PrintInt(64,2,KEY1_State);
- OLED_PrintInt(64,4,KEY2_State);
- OLED_PrintInt(64,6,KEY3_State);
- }
- }
复制代码
- #ifndef _OLED_H_
- #define _OLED_H_
- #include "gpio.h"
- #define X_WIDTH 128
- #define Y_WIDTH 64
- #define OLED_CLK RCU_GPIOD
- #define OLED_PORT GPIOD
- #define OLED_RST GPIO_PIN_3
- #define OLED_DC GPIO_PIN_4
- #define OLED_D0_SCL GPIO_PIN_5
- #define OLED_D1_SDA GPIO_PIN_6
- #define OUT_High(pin) GPIO_BOP(OLED_PORT)=pin
- #define OUT_Low(pin) GPIO_BC(OLED_PORT)=pin
- extern uint8 OLED_Rev;
复制代码 由于OLED驱动文件较大,会上传附件,只需要更改OLED.h里的引脚即可 非常方便 代码移植性高
myGD32.rar
(6.85 MB, 下载次数: 34)
|
|