#include "main.h"
extern LCD_HandleTypeDef hlcd;
//T1 minus
//T2 gps
//T3 cloud
//T4 bluetooth
//T5 play
//T6 stop
//T7 charge
const u32 DISP_PLAY[2] = {9, LCD_RAM_REGISTER0};
const u32 DISP_STOP[2] = {9, LCD_RAM_REGISTER2};
const u32 DISP_GPS[2] = {4, LCD_RAM_REGISTER0};
const u32 DISP_CLOUD[2] = {4, LCD_RAM_REGISTER2};
const u32 DISP_BT[2] = {4, LCD_RAM_REGISTER4};
const u32 DISP_CHARGE[2] = {9, LCD_RAM_REGISTER4};
const u32 DISP_BATCASE[2] = {9, LCD_RAM_REGISTER6};
const u32 DISP_NOSIGN[2] = {11, LCD_RAM_REGISTER6};
const u32 DISP_EMAX[2] = {1, LCD_RAM_REGISTER2};
const u32 DISP_EMIN[2] = {1, LCD_RAM_REGISTER6};
const u32 DISP_DGREE[2] = {11, LCD_RAM_REGISTER0};
const u32 DISP_RH[2] = {11, LCD_RAM_REGISTER4};
const u32 DISP_DAY[2] = {11, LCD_RAM_REGISTER2};
const u32 DISP_DOT[2] = {7, LCD_RAM_REGISTER6};
const u32 DISP_MINUS[2] = {1, LCD_RAM_REGISTER4};
const u32 DISP_BAT[4][2] = {
{10, LCD_RAM_REGISTER2}, //BAR1
{10, LCD_RAM_REGISTER4}, //BAR2
{10, LCD_RAM_REGISTER0}, //BAR3
{10, LCD_RAM_REGISTER6}, //BAR4
};
const u32 DISP_SIGN[5][2] = {
{0, LCD_RAM_REGISTER6}, //L1
{0, LCD_RAM_REGISTER4}, //L2
{0, LCD_RAM_REGISTER2}, //L3
{0, LCD_RAM_REGISTER0}, //L4
{1, LCD_RAM_REGISTER0}, //L5
};
const u8 DISP_NUM[3] = {2, 5, 7};
const u8 DISP_NUM_TAB[10][4] =
{
{3, 2, 3, 2}, //0
{0, 2, 2, 0}, //1
{2, 3, 1, 2}, //2
{2, 3, 2, 2}, //3
{1, 3, 2, 0}, //4
{3, 1, 2, 2}, //5
{3, 1, 3, 2}, //6
{2, 2, 2, 0}, //7
{3, 3, 3, 2}, //8
{3, 3, 2, 2}, //9
};
void Set_Lcd_Dot(const u32 *dot)
{
HAL_LCD_Write(&hlcd, dot[1], (u32)~(1<<(dot[0]+16)), (u32)(1<<(dot[0]+16)));
}
void Clr_Lcd_Dot(const u32 *dot)
{
HAL_LCD_Write(&hlcd, dot[1], (u32)~(1<<(dot[0]+16)), 0);
}
void Set_Lcd_Num(const u8 c, u8 num)
{
HAL_LCD_Write(&hlcd, LCD_RAM_REGISTER0, (u32)~(3<<(DISP_NUM[c]+16)), (u32)(DISP_NUM_TAB[num][0]<<(DISP_NUM[c]+16)));
HAL_LCD_Write(&hlcd, LCD_RAM_REGISTER2, (u32)~(3<<(DISP_NUM[c]+16)), (u32)(DISP_NUM_TAB[num][1]<<(DISP_NUM[c]+16)));
HAL_LCD_Write(&hlcd, LCD_RAM_REGISTER4, (u32)~(3<<(DISP_NUM[c]+16)), (u32)(DISP_NUM_TAB[num][2]<<(DISP_NUM[c]+16)));
HAL_LCD_Write(&hlcd, LCD_RAM_REGISTER6, (u32)~(2<<(DISP_NUM[c]+16)), (u32)(DISP_NUM_TAB[num][3]<<(DISP_NUM[c]+16)));
}
void Clr_Lcd_Num(const u8 c)
{
HAL_LCD_Write(&hlcd, LCD_RAM_REGISTER0, (u32)~(3<<(DISP_NUM[c]+16)), 0);
HAL_LCD_Write(&hlcd, LCD_RAM_REGISTER2, (u32)~(3<<(DISP_NUM[c]+16)), 0);
HAL_LCD_Write(&hlcd, LCD_RAM_REGISTER4, (u32)~(3<<(DISP_NUM[c]+16)), 0);
HAL_LCD_Write(&hlcd, LCD_RAM_REGISTER6, (u32)~(2<<(DISP_NUM[c]+16)), 0);
}