/** * @file OLED_SSD1306_ATY.h * * @param Project DEVICE_GENERAL_ATY_LIB * * @author ATY * * @copyright * - Copyright 2017 - 2026 MZ-ATY * - This code follows: * - MZ-ATY Various Contents Joint Statement - * * https://mengze.top/MZ-ATY_VCJS * - CC 4.0 BY-NC-SA - * * https://creativecommons.org/licenses/by-nc-sa/4.0/ * - Your use will be deemed to have accepted the terms of this statement. * * @brief Dev-style interface for SSD1306 OLED display (I2C) * * @version * - 2_00_251112 > ATY * -# Refactor to Dev-style interface with platform-agnostic callbacks ******************************************************************************** */ #ifndef __OLED_SSD1306_ATY_H #define __OLED_SSD1306_ATY_H /* Dev 风格头文件不耦合具体硬件头,仅保留字体声明 */ #include "OLED_FONT_ATY.h" /* 可选 DEBUG 宏占位: // #define __DEBUG_OLED_SSD1306_ATY */ /******************************************************************************/ #define BRIGHTNESS 0xCF #define X_WIDTH 128 #define Y_WIDTH 32 #define MENU_IN 0 #define MENU_OUT 1 /* Dev 风格设备结构体与接口 */ typedef struct { uint8_t addr; /* I2C 地址,例如 0x78 */ uint8_t channel; /* 可选 I2C 通道(如需) */ int (*i2c_write)(uint8_t addr, const uint8_t* data, uint16_t len, uint8_t channel); void (*delay_ms)(uint32_t ms); void (*lock)(uint8_t lock); uint8_t debugEnable; void (*LOG)(const char* fmt, ...); } OLED_SSD1306_ATY_Dev; /* Dev 风格函数原型 */ void OLED_SSD1306_InitDev(OLED_SSD1306_ATY_Dev* dev, uint8_t addr, uint8_t channel); int OLED_SSD1306_WriteCmdDev(OLED_SSD1306_ATY_Dev* dev, uint8_t cmd); int OLED_SSD1306_WriteDataDev(OLED_SSD1306_ATY_Dev* dev, const uint8_t* data, uint16_t len); void OLED_SSD1306_SetPosDev(OLED_SSD1306_ATY_Dev* dev, uint8_t x, uint8_t y); void OLED_SSD1306_FillScreenDev(OLED_SSD1306_ATY_Dev* dev, uint8_t fillData); void OLED_SSD1306_DrawChar8x16Dev(OLED_SSD1306_ATY_Dev* dev, uint8_t x, uint8_t y, const uint8_t symbol[]); void OLED_SSD1306_DrawChar16x16Dev(OLED_SSD1306_ATY_Dev* dev, uint8_t x, uint8_t y, const uint8_t symbol[]); void OLED_SSD1306_DrawString8x16Dev(OLED_SSD1306_ATY_Dev* dev, uint8_t x, uint8_t y, const char* str, const uint8_t* font); #endif /* __OLED_SSD1306_ATY_H */