Skip to content

Commit

Permalink
Fix F12E screen alignment on newer F12E transmitters. Update bootload…
Browse files Browse the repository at this point in the history
…er dump code
  • Loading branch information
PhracturedBlue committed Apr 11, 2016
1 parent 7e9bb3f commit 82746e6
Show file tree
Hide file tree
Showing 9 changed files with 1,148 additions and 529 deletions.
17 changes: 16 additions & 1 deletion src/main.c
Expand Up @@ -106,19 +106,34 @@ int main() {
#endif
}
#else //DUMP_BOOTLOADER
#define SPI_BOOTLOADER 1
int main() {
PWR_Init();
CLOCK_Init();
UART_Initialize();
if(PWR_CheckPowerSwitch()) PWR_Shutdown();
dump_bootloader();
#if SPI_BOOTLOADER
Initialize_ButtonMatrix();
SPIFlash_Init(); //This must come before LCD_Init() for 7e
SPI_FlashBlockWriteEnable(1); //Enable writing to all banks of SPIFlash
LCD_Init();
LCD_Clear(0x0000);
BACKLIGHT_Init();
BACKLIGHT_Brightness(5);
LCD_SetFont(0);
LCD_SetFontColor(0xffff);
dump_bootloader(0);
#else
dump_bootloader(1);
#endif
}
#endif //DUMP_BOOTLOADER

void Init() {
PWR_Init();
CLOCK_Init();
UART_Initialize();
printf("Start\n");
Initialize_ButtonMatrix();
SPIFlash_Init(); //This must come before LCD_Init() for 7e

Expand Down
24 changes: 16 additions & 8 deletions src/target/common/devo/dump_bootloader.c
@@ -1,20 +1,28 @@
#include "common.h"

//UART bootloader dump
void dump_bootloader()
void dump_bootloader(int uart)
{
u32 *ptr = (u32*)0x08000000;
for(int j = 0; j < VECTOR_TABLE_LOCATION / 0x1000; j++) {
printf("\nAddress: 0x%08x\n", (u32)ptr);
for(int i = 0; i < 0x1000 / 4; i++) {
u32 b = *ptr;
printf("%02x", 0xff & (b >> 0));
printf("%02x", 0xff & (b >> 8));
printf("%02x", 0xff & (b >> 16));
printf("%02x", 0xff & (b >> 24));
ptr++;
if (uart) {
for(int i = 0; i < 0x1000 / 4; i++) {
u32 b = *ptr;
printf("%02x", 0xff & (b >> 0));
printf("%02x", 0xff & (b >> 8));
printf("%02x", 0xff & (b >> 16));
printf("%02x", 0xff & (b >> 24));
ptr++;
}
} else {
unsigned pos = j * 0x1000;
SPIFlash_EraseSector(0x1000*SPIFLASH_SECTOR_OFFSET + pos);
SPIFlash_WriteBytes(0x1000*SPIFLASH_SECTOR_OFFSET + pos, 0x1000, (u8*)0x08000000 + pos);
}
}
LCD_PrintStringXY(0, 0, " Done");
USB_Connect();

while(1)
{
Expand Down
2 changes: 1 addition & 1 deletion src/target/devof12e/lcd.c
Expand Up @@ -360,7 +360,7 @@ void LCD_Init()
gpio_set_mode(GPIOD, GPIO_MODE_OUTPUT_50_MHZ,
GPIO_CNF_OUTPUT_PUSHPULL, GPIO8 | GPIO10);
gpio_clear(GPIOD, GPIO8 | GPIO10);
TW8816_Reset();
TW8816_ResetLoop();
TW8816_Init();
//TW8816_Test();
}
Expand Down
1 change: 1 addition & 0 deletions src/target/devof12e/lcd.h
Expand Up @@ -9,6 +9,7 @@ u32 I2C1_WriteBufferDMA(u16 deviceId, u8 *dmaAddr, s16 periphMemAddr, int len);

void TW8816_Init();
void TW8816_Reset();
void TW8816_ResetLoop();
void TW8816_LoadFont(u8 *data, unsigned offset, unsigned count);
void TW8816_SetVideoMode(unsigned enable);
void TW8816_ReinitPixelClock();
Expand Down

0 comments on commit 82746e6

Please sign in to comment.