/**
* @file OLED_SSD1306_ATY.h
*
* @param Project DEVICE_GENERAL_ATY_LIB
*
* @author ATY
*
* @copyright
* - Copyright 2017 - 2023 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 Base functions of GP22 for all embedded device
*
* @version
* - 1_01_220901 > ATY
* -# Preliminary version, first Release
********************************************************************************
*/
#ifndef __OLED_SSD1306_ATY_H
#define __OLED_SSD1306_ATY_H
#include "INCLUDE_ATY.h"
#include "HW_GPIO_ATY.h"
#include "HW_I2C_ATY.h"
#include "OLED_FONT_ATY.h"
/******************************* For user *************************************/
// #define __DEBUG_OLED_SSD1306_ATY
/******************************************************************************/
#define BRIGHTNESS 0xCF
#define X_WIDTH 128
// #define X_WIDTH 128
#define Y_WIDTH 32
// #define Y_WIDTH 64
#define MENU_IN 0
#define MENU_OUT 1
void OLED_WriteData(uint8_t oledData);
void OLED_WriteCmd(uint8_t oledCmd);
void OLED_SetPos(uint8_t x, uint8_t y);
void OLED_FillScreen(uint8_t fillData);
void OLED_Init(void);
void OLED_DrawChar8x16(uint8_t x, uint8_t y, uint8_t symbol[]);
void OLED_DrawChar16x16(uint8_t x, uint8_t y, uint8_t symbol[]);
// void OLED_DrawString8x16(uint8_t x, uint8_t y, uint8_t* str, uint8_t len, uint8_t* font);
#define OLED_DrawString8x16(x, y, str, font) \
do{ \
uint8_t i = 0, xi = x, yi = y; \
for(i = 0; i < (sizeof(str) - 1); i++) { \
if(xi > 120) { \
xi = 0; \
yi += 2; \
} \
if(yi > 6) \
break; \
OLED_DrawChar8x16(xi, yi, font + (((str)[i] - 32) * 16)); \
xi += 8; \
} \
}while(0)
uint8_t NumToChar(uint8_t num);
void OLED_Dis_Welcom(void);
#endif /* __OLED_SSD1306_ATY_H */