/** ****************************************************************************** * @file Project/lcd/lcd.c * @author FrSky Application Team * @Hardware version V0.2 * @date 11-July-2012 * @brief This file provides LCD Init and botom drivers. * * ****************************************************************************** */ #include "../opentx.h" #define WriteData(x) AspiData(x) #define WriteCommand(x) AspiCmd(x) void Set_Address(u8 x, u8 y) { WriteCommand(x&0x0F); //Set Column Address LSB CA[3:0] WriteCommand((x>>4)|0x10); //Set Column Address MSB CA[7:4] WriteCommand((y&0x0F)|0x60); //Set Row Address LSB RA [3:0] WriteCommand(((y>>4)&0x0F)|0x70); //Set Row Address MSB RA [7:4] } #define PALETTE_IDX(p, x, mask) (((p[x] & mask) ? 0x1 : 0) + ((p[DISPLAY_PLAN_SIZE+x] & mask) ? 0x2 : 0) + ((p[2*DISPLAY_PLAN_SIZE+x] & mask) ? 0x4 : 0) + ((p[3*DISPLAY_PLAN_SIZE+x] & mask) ? 0x8 : 0)) const uint8_t lcdPalette[4] = { 0, 0x03, 0x06, 0x0F }; #define LCD_WRITE_BIT(bit) \ if (bit) \ GPIOD->BSRRL = PIN_LCD_MOSI; \ else \ GPIOD->BSRRH = PIN_LCD_MOSI; \ GPIOD->BSRRH = PIN_LCD_CLK; /* Clock low */ \ __no_operation(); \ GPIOD->BSRRL = PIN_LCD_CLK; /* Clock high */ void lcdRefresh() { for (uint32_t y=0; y>3)*LCD_W]; uint8_t mask = (1 << (y%8)); Set_Address(0, y); AspiCmd(0xAF); LCD_CLK_HIGH(); LCD_A0_HIGH(); LCD_NCS_LOW(); for (uint32_t x=0; x