Files
TencentOS-tiny/examples/tos_meets_rust/BSP/Hardware/OLED/oled.h
2021-01-12 23:47:54 +08:00

42 lines
1.3 KiB
C

#ifndef __OLED_H
#define __OLED_H
#include "stm32g0xx_hal.h"
#include "stdlib.h"
#define OLED_MODE 0
#define OLED_SIZE 8
#define XLevelL 0x00
#define XLevelH 0x10
#define Max_Column 128
#define Max_Row 64
#define Brightness 0xFF
#define X_WIDTH 128
#define Y_WIDTH 64
//-----------------OLED IIC端口定义----------------
//HAL_GPIO_WritePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState);
#define OLED_SCLK_Clr() HAL_GPIO_WritePin(GPIOA,GPIO_PIN_9, GPIO_PIN_RESET);//SDA IIC接口的时钟信号
#define OLED_SCLK_Set() HAL_GPIO_WritePin(GPIOA,GPIO_PIN_9, GPIO_PIN_SET);
#define OLED_SDIN_Clr() HAL_GPIO_WritePin(GPIOA,GPIO_PIN_10, GPIO_PIN_RESET);//SCL IIC接口的数据信号
#define OLED_SDIN_Set() HAL_GPIO_WritePin(GPIOA,GPIO_PIN_10, GPIO_PIN_SET);
#define OLED_CMD 0 //写命令
#define OLED_DATA 1 //写数据
//OLED接口控制用函数
void OLED_ShowNum(uint8_t x,uint8_t y,uint32_t num,uint8_t len,uint8_t size);
void OLED_ShowString(uint8_t x,uint8_t y, uint8_t *p,uint8_t Char_Size);
void OLED_ShowChinese(uint8_t x,uint8_t y,uint8_t no);
void OLED_DrawBMP(unsigned char x0, unsigned char y0,unsigned char x1, unsigned char y1,unsigned char BMP[]);
//OLED基础函数
void OLED_Init(void);
void OLED_Clear(void);
void OLED_Display_On(void);
void OLED_Display_Off(void);
void OLED_Set_Pos(unsigned char x, unsigned char y);
#endif