mirror of
https://github.com/EdgeTX/edgetx.git
synced 2025-07-21 15:25:12 +03:00
Now bootloader OK on Taranis
This commit is contained in:
parent
4e6def3ba3
commit
68c270760c
9 changed files with 123 additions and 151 deletions
|
@ -1097,14 +1097,16 @@ all: begin gccversion sizebefore build sizeafter end
|
||||||
# Change the build target to build a HEX file or a library.
|
# Change the build target to build a HEX file or a library.
|
||||||
ifeq ($(ARCH), AVR)
|
ifeq ($(ARCH), AVR)
|
||||||
build: stamp_header tra lbm allsrc.cpp elf remallsrc hex
|
build: stamp_header tra lbm allsrc.cpp elf remallsrc hex
|
||||||
else
|
else ifeq ($(PCB), TARANIS)
|
||||||
build: stamp_header tra lbm bootloader.lbm allsrc.cpp elf remallsrc bin
|
build: stamp_header tra lbm bootloader.lbm allsrc.cpp elf remallsrc bin
|
||||||
|
else
|
||||||
|
build: stamp_header tra lbm allsrc.cpp elf remallsrc bin
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# build bootloader
|
# build bootloader
|
||||||
.PHONY bootloader.lbm:
|
.PHONY bootloader.lbm:
|
||||||
@echo "Building bootloader..."
|
@echo "Building bootloader..."
|
||||||
$(MAKE) -C bootloader PCB=TARANIS
|
$(MAKE) -C bootloader PCB=$(PCB) PCBREV=$(PCBREV)
|
||||||
$(BIN2LBM) bootloader.lbm bootloader/bootloader_ramBoot.bin
|
$(BIN2LBM) bootloader.lbm bootloader/bootloader_ramBoot.bin
|
||||||
|
|
||||||
tra: translations/en.h translations/cz.h translations/de.h translations/es.h translations/fi.h translations/fr.h translations/it.h translations/pl.h translations/pt.h translations/se.h
|
tra: translations/en.h translations/cz.h translations/de.h translations/es.h translations/fi.h translations/fr.h translations/it.h translations/pl.h translations/pt.h translations/se.h
|
||||||
|
|
|
@ -70,6 +70,9 @@ RUN_FROM_FLASH = 0
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# PCB revision
|
||||||
|
PCBREV =
|
||||||
|
|
||||||
EXTRAINCDIRS =
|
EXTRAINCDIRS =
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -90,6 +93,14 @@ ifeq ($(RUN_FROM_FLASH), 1)
|
||||||
TRGT = arm-none-eabi-
|
TRGT = arm-none-eabi-
|
||||||
CPPDEFS += -DPCBSKY
|
CPPDEFS += -DPCBSKY
|
||||||
UDEFS = -Dat91sam3s8
|
UDEFS = -Dat91sam3s8
|
||||||
|
|
||||||
|
# If REVX board
|
||||||
|
ifeq ($(REVX), 1)
|
||||||
|
CPPDEFS += -DREVX
|
||||||
|
endif
|
||||||
|
|
||||||
|
CPPDEFS += -DREVB
|
||||||
|
|
||||||
else
|
else
|
||||||
ifeq ($(PCB), TARANIS)
|
ifeq ($(PCB), TARANIS)
|
||||||
ARCH = ARM
|
ARCH = ARM
|
||||||
|
@ -105,6 +116,15 @@ else
|
||||||
EXTRAINCDIRS += ../targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/inc
|
EXTRAINCDIRS += ../targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/inc
|
||||||
EXTRAINCDIRS += ../targets/taranis
|
EXTRAINCDIRS += ../targets/taranis
|
||||||
EXTRAINCDIRS += ../fonts/std
|
EXTRAINCDIRS += ../fonts/std
|
||||||
|
|
||||||
|
ifeq ($(PCBREV), REV3)
|
||||||
|
CPPDEFS += -DREV3
|
||||||
|
else ifeq ($(PCBREV), REV4a)
|
||||||
|
CPPDEFS += -DREV4a
|
||||||
|
else
|
||||||
|
CPPDEFS += -DREV4
|
||||||
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -240,16 +260,9 @@ COBJS = $(patsubst %,$(OBJDIR)/%,$(notdir $(CXOBJS) ))
|
||||||
CPPOBJS = $(patsubst %,$(OBJDIR)/%,$(notdir $(CPPXOBJS) ))
|
CPPOBJS = $(patsubst %,$(OBJDIR)/%,$(notdir $(CPPXOBJS) ))
|
||||||
DIRS = $(sort $(dir $(AXOBJS) $(CXOBJS) $(CPPXOBJS) ) )
|
DIRS = $(sort $(dir $(AXOBJS) $(CXOBJS) $(CPPXOBJS) ) )
|
||||||
|
|
||||||
# If REVX board
|
|
||||||
ifeq ($(REVX), 1)
|
|
||||||
CPPDEFS += -DREVX
|
|
||||||
EXT_MOD=REVB-X
|
|
||||||
endif
|
|
||||||
|
|
||||||
CPPDEFS += -DCPUARM
|
CPPDEFS += -DCPUARM
|
||||||
|
|
||||||
CPPDEFS += -DREVB
|
|
||||||
|
|
||||||
# If serial Debug required
|
# If serial Debug required
|
||||||
ifeq ($(DEBUG), 1)
|
ifeq ($(DEBUG), 1)
|
||||||
CPPDEFS += -DDEBUG
|
CPPDEFS += -DDEBUG
|
||||||
|
|
|
@ -111,7 +111,6 @@ volatile uint8_t Tenms ;
|
||||||
uint8_t EE_timer ;
|
uint8_t EE_timer ;
|
||||||
|
|
||||||
TCHAR FlashFilename[60] ;
|
TCHAR FlashFilename[60] ;
|
||||||
FATFS g_FATFS ;
|
|
||||||
FIL FlashFile ;
|
FIL FlashFile ;
|
||||||
DIR Dj ;
|
DIR Dj ;
|
||||||
FILINFO Finfo ;
|
FILINFO Finfo ;
|
||||||
|
@ -774,7 +773,6 @@ extern uint8_t OptrexDisplay ;
|
||||||
#ifdef PCBTARANIS
|
#ifdef PCBTARANIS
|
||||||
// SD card detect pin
|
// SD card detect pin
|
||||||
// configure_pins( SD_PRESENT_GPIO_Pin, PIN_PORTD | PIN_INPUT | PIN_PULLUP ) ;
|
// configure_pins( SD_PRESENT_GPIO_Pin, PIN_PORTD | PIN_INPUT | PIN_PULLUP ) ;
|
||||||
disk_initialize( 0 ) ;
|
|
||||||
sdInit() ;
|
sdInit() ;
|
||||||
unlockFlash() ;
|
unlockFlash() ;
|
||||||
|
|
||||||
|
@ -804,23 +802,12 @@ extern uint8_t OptrexDisplay ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Tenms = 0 ;
|
Tenms = 0;
|
||||||
lcd_clear() ;
|
lcd_clear();
|
||||||
#ifdef PCBSKY
|
lcd_putsLeft(0, CENTER "Boot Loader");
|
||||||
lcd_putsLeft( 0, "Boot Loader" ) ;
|
lcd_invert_line(0);
|
||||||
#endif
|
|
||||||
#ifdef PCBTARANIS
|
|
||||||
lcd_putsLeft( 0, "\006Boot Loader" ) ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( sdMounted() )
|
|
||||||
{
|
{
|
||||||
#ifdef PCBSKY
|
|
||||||
lcd_putsLeft( 0, "\014Ready" ) ;
|
|
||||||
#endif
|
|
||||||
#ifdef PCBTARANIS
|
|
||||||
lcd_putsLeft( 0, "\022Ready" ) ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( usbPlugged() )
|
if ( usbPlugged() )
|
||||||
{
|
{
|
||||||
|
@ -849,11 +836,12 @@ extern uint8_t OptrexDisplay ;
|
||||||
|
|
||||||
if ( state == ST_START )
|
if ( state == ST_START )
|
||||||
{
|
{
|
||||||
fr = f_mount(0, &g_FATFS) ;
|
sdInit();
|
||||||
|
fr = FR_OK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fr = FR_OK ;
|
fr = FR_OK ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( fr == FR_OK)
|
if ( fr == FR_OK)
|
||||||
|
@ -865,7 +853,7 @@ extern uint8_t OptrexDisplay ;
|
||||||
}
|
}
|
||||||
if ( state == ST_DIR_CHECK )
|
if ( state == ST_DIR_CHECK )
|
||||||
{
|
{
|
||||||
fr = f_chdir( (TCHAR *)"\\firmware" ) ;
|
fr = f_chdir("/firmware") ;
|
||||||
if ( fr == FR_OK )
|
if ( fr == FR_OK )
|
||||||
{
|
{
|
||||||
state = ST_OPEN_DIR ;
|
state = ST_OPEN_DIR ;
|
||||||
|
@ -875,15 +863,15 @@ extern uint8_t OptrexDisplay ;
|
||||||
if ( state == ST_DIR_CHECK )
|
if ( state == ST_DIR_CHECK )
|
||||||
{
|
{
|
||||||
#ifdef PCBSKY
|
#ifdef PCBSKY
|
||||||
lcd_putsLeft( 16, "\005No Firmware" ) ;
|
lcd_putsLeft( 2*FH, "\005No Firmware" ) ;
|
||||||
#endif
|
#endif
|
||||||
#ifdef PCBTARANIS
|
#ifdef PCBTARANIS
|
||||||
lcd_putsLeft( 16, "\013No Firmware" ) ;
|
lcd_putsLeft( 2*FH, "\013No Firmware" ) ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if ( state == ST_OPEN_DIR )
|
if ( state == ST_OPEN_DIR )
|
||||||
{
|
{
|
||||||
fr = f_opendir( &Dj, (TCHAR *) "." ) ;
|
fr = f_opendir(&Dj, ".") ;
|
||||||
if ( fr == FR_OK )
|
if ( fr == FR_OK )
|
||||||
{
|
{
|
||||||
state = ST_FILE_LIST ;
|
state = ST_FILE_LIST ;
|
||||||
|
@ -984,7 +972,7 @@ extern uint8_t OptrexDisplay ;
|
||||||
state = ST_REBOOT ;
|
state = ST_REBOOT ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lcd_invert_line(2*FH+FH*vpos);
|
lcd_invert_line(2+vpos);
|
||||||
// lcd_char_inverse( 0, 2*FH+FH*vpos, DISPLAY_CHAR_WIDTH*FW, 0 ) ;
|
// lcd_char_inverse( 0, 2*FH+FH*vpos, DISPLAY_CHAR_WIDTH*FW, 0 ) ;
|
||||||
}
|
}
|
||||||
if ( state == ST_FLASH_CHECK )
|
if ( state == ST_FLASH_CHECK )
|
||||||
|
@ -1061,37 +1049,29 @@ extern uint8_t OptrexDisplay ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PCBTARANIS
|
if ( --TenCount == 0 ) {
|
||||||
if ( --TenCount == 0 )
|
TenCount = 2 ;
|
||||||
{
|
lcdRefresh() ;
|
||||||
TenCount = 2 ;
|
|
||||||
#endif
|
|
||||||
lcdRefresh() ;
|
|
||||||
#ifdef PCBTARANIS
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if ( PowerUpDelay < 20 ) // 200 mS
|
if ( PowerUpDelay < 20 ) // 200 mS
|
||||||
{
|
{
|
||||||
PowerUpDelay += 1 ;
|
PowerUpDelay += 1 ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef PCBSKY
|
|
||||||
sd_poll_10mS() ;
|
|
||||||
#endif
|
|
||||||
#ifdef PCBTARANIS
|
|
||||||
sdPoll10ms() ;
|
sdPoll10ms() ;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((state < ST_FLASH_CHECK) || (state == ST_FLASH_DONE))
|
if ((state < ST_FLASH_CHECK) || (state == ST_FLASH_DONE))
|
||||||
{
|
{
|
||||||
if (pwrCheck() == e_power_off ) {
|
if (pwrCheck() == e_power_off ) {
|
||||||
pwrOff() ;
|
pwrOff() ;
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
// Wait for power to go off
|
// Wait for power to go off
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( state < ST_FILE_LIST )
|
if ( state < ST_FILE_LIST )
|
||||||
|
@ -1105,12 +1085,11 @@ extern uint8_t OptrexDisplay ;
|
||||||
{
|
{
|
||||||
if ( (~readKeys() & 0x7E) == 0 )
|
if ( (~readKeys() & 0x7E) == 0 )
|
||||||
{
|
{
|
||||||
NVIC_SystemReset() ;
|
NVIC_SystemReset() ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// stop_timer0() ;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -432,12 +432,8 @@ void menuGeneralSetup(uint8_t event)
|
||||||
case ITEM_SETUP_CONTRAST:
|
case ITEM_SETUP_CONTRAST:
|
||||||
lcd_putsLeft(y, STR_CONTRAST);
|
lcd_putsLeft(y, STR_CONTRAST);
|
||||||
lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.contrast, attr|LEFT);
|
lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.contrast, attr|LEFT);
|
||||||
if(attr) {
|
if (attr) {
|
||||||
#if defined(PCBTARANIS)
|
CHECK_INCDEC_GENVAR(event, g_eeGeneral.contrast, CONTRAST_MIN, CONTRAST_MAX);
|
||||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.contrast, 0, 45);
|
|
||||||
#else
|
|
||||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.contrast, 10, 45);
|
|
||||||
#endif
|
|
||||||
lcdSetContrast();
|
lcdSetContrast();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -601,24 +597,16 @@ void menuGeneralSetup(uint8_t event)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MAVLINK)
|
#if defined(MAVLINK)
|
||||||
case ITEM_MAVLINK_BAUD:
|
case ITEM_MAVLINK_BAUD:
|
||||||
g_eeGeneral.mavbaud = selectMenuItem(RADIO_SETUP_2ND_COLUMN, //Y
|
g_eeGeneral.mavbaud = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_MAVLINK_BAUD_LABEL, STR_MAVLINK_BAUDS, PSTR("4800""9600""14400""19200""38400""57600""76800""115200"), g_eeGeneral.mavbaud, 0, 7, attr, event);
|
||||||
y, // Y
|
break;
|
||||||
STR_MAVLINK_BAUD_LABEL, // pm_char *label
|
|
||||||
STR_MAVLINK_BAUDS, // pm_char *values
|
|
||||||
// PSTR("4800""9600""14400""19200""38400""57600""76800""115200"),
|
|
||||||
g_eeGeneral.mavbaud, // value
|
|
||||||
0, // min
|
|
||||||
7, // max
|
|
||||||
attr, // attr
|
|
||||||
event); // event
|
|
||||||
break;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case ITEM_SETUP_RX_CHANNEL_ORD:
|
case ITEM_SETUP_RX_CHANNEL_ORD:
|
||||||
lcd_putsLeft(y, STR_RXCHANNELORD); // RAET->AETR
|
lcd_putsLeft(y, STR_RXCHANNELORD); // RAET->AETR
|
||||||
for (uint8_t i=1; i<=4; i++)
|
for (uint8_t i=1; i<=4; i++) {
|
||||||
putsChnLetter(RADIO_SETUP_2ND_COLUMN - FW + i*FW, y, channel_order(i), attr);
|
putsChnLetter(RADIO_SETUP_2ND_COLUMN - FW + i*FW, y, channel_order(i), attr);
|
||||||
|
}
|
||||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.templateSetup, 0, 23);
|
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.templateSetup, 0, 23);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -629,7 +617,9 @@ void menuGeneralSetup(uint8_t event)
|
||||||
|
|
||||||
case ITEM_SETUP_STICK_MODE:
|
case ITEM_SETUP_STICK_MODE:
|
||||||
lcd_putcAtt(2*FW, y, '1'+g_eeGeneral.stickMode, attr);
|
lcd_putcAtt(2*FW, y, '1'+g_eeGeneral.stickMode, attr);
|
||||||
for (uint8_t i=0; i<4; i++) putsMixerSource((6+4*i)*FW, y, MIXSRC_Rud + pgm_read_byte(modn12x3 + 4*g_eeGeneral.stickMode + i), 0);
|
for (uint8_t i=0; i<4; i++) {
|
||||||
|
putsMixerSource((6+4*i)*FW, y, MIXSRC_Rud + pgm_read_byte(modn12x3 + 4*g_eeGeneral.stickMode + i), 0);
|
||||||
|
}
|
||||||
if (attr && s_editMode>0) {
|
if (attr && s_editMode>0) {
|
||||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.stickMode, 0, 3);
|
CHECK_INCDEC_GENVAR(event, g_eeGeneral.stickMode, 0, 3);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,12 +43,16 @@
|
||||||
#define xcoord_t uint16_t
|
#define xcoord_t uint16_t
|
||||||
#define CENTER "\015"
|
#define CENTER "\015"
|
||||||
#define CENTER_OFS (7*FW-FW/2)
|
#define CENTER_OFS (7*FW-FW/2)
|
||||||
|
#define CONTRAST_MIN 0
|
||||||
|
#define CONTRAST_MAX 45
|
||||||
#else
|
#else
|
||||||
#define LCD_W 128
|
#define LCD_W 128
|
||||||
#define LCD_H 64
|
#define LCD_H 64
|
||||||
#define xcoord_t uint8_t
|
#define xcoord_t uint8_t
|
||||||
#define CENTER
|
#define CENTER
|
||||||
#define CENTER_OFS 0
|
#define CENTER_OFS 0
|
||||||
|
#define CONTRAST_MIN 10
|
||||||
|
#define CONTRAST_MAX 45
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
|
|
|
@ -232,7 +232,7 @@ void SystemInit(void)
|
||||||
#ifdef VECT_TAB_SRAM
|
#ifdef VECT_TAB_SRAM
|
||||||
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
|
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
|
||||||
#else
|
#else
|
||||||
#if defined(BOOTLOADER)
|
#if defined(BOOTLOADER) || defined(BOOT)
|
||||||
extern uint32_t g_pfnVectors ;
|
extern uint32_t g_pfnVectors ;
|
||||||
SCB->VTOR = (uint32_t) &g_pfnVectors ; /* Vector Table Relocation in Internal FLASH */
|
SCB->VTOR = (uint32_t) &g_pfnVectors ; /* Vector Table Relocation in Internal FLASH */
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -670,14 +670,23 @@ int8_t SD_ReadSectors(uint8_t *buff, uint32_t sector, uint32_t count)
|
||||||
{
|
{
|
||||||
if (!(CardType & CT_BLOCK)) sector *= 512; /* Convert to byte address if needed */
|
if (!(CardType & CT_BLOCK)) sector *= 512; /* Convert to byte address if needed */
|
||||||
|
|
||||||
if (send_cmd(CMD18, sector) == 0) { /* READ_MULTIPLE_BLOCK */
|
if (count == 1) { /* Single block read */
|
||||||
do {
|
if (send_cmd(CMD17, sector) == 0) { /* READ_SINGLE_BLOCK */
|
||||||
if (!rcvr_datablock(buff, 512)) {
|
if (rcvr_datablock(buff, 512)) {
|
||||||
break;
|
count = 0;
|
||||||
}
|
}
|
||||||
buff += 512;
|
}
|
||||||
} while (--count);
|
}
|
||||||
send_cmd(CMD12, 0); /* STOP_TRANSMISSION */
|
else { /* Multiple block read */
|
||||||
|
if (send_cmd(CMD18, sector) == 0) { /* READ_MULTIPLE_BLOCK */
|
||||||
|
do {
|
||||||
|
if (!rcvr_datablock(buff, 512)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
buff += 512;
|
||||||
|
} while (--count);
|
||||||
|
send_cmd(CMD12, 0); /* STOP_TRANSMISSION */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
release_spi();
|
release_spi();
|
||||||
|
@ -695,29 +704,9 @@ DRESULT disk_read (
|
||||||
if (drv || !count) return RES_PARERR;
|
if (drv || !count) return RES_PARERR;
|
||||||
if (Stat & STA_NOINIT) return RES_NOTRDY;
|
if (Stat & STA_NOINIT) return RES_NOTRDY;
|
||||||
|
|
||||||
if (!(CardType & CT_BLOCK)) sector *= 512; /* Convert to byte address if needed */
|
SD_ReadSectors(buff, sector, count);
|
||||||
|
|
||||||
if (count == 1) { /* Single block read */
|
return RES_OK;
|
||||||
if (send_cmd(CMD17, sector) == 0) { /* READ_SINGLE_BLOCK */
|
|
||||||
if (rcvr_datablock(buff, 512)) {
|
|
||||||
count = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else { /* Multiple block read */
|
|
||||||
if (send_cmd(CMD18, sector) == 0) { /* READ_MULTIPLE_BLOCK */
|
|
||||||
do {
|
|
||||||
if (!rcvr_datablock(buff, 512)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
buff += 512;
|
|
||||||
} while (--count);
|
|
||||||
send_cmd(CMD12, 0); /* STOP_TRANSMISSION */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
release_spi();
|
|
||||||
|
|
||||||
return count ? RES_ERROR : RES_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
#define WriteData(x) AspiData(x)
|
#define WriteData(x) AspiData(x)
|
||||||
#define WriteCommand(x) AspiCmd(x)
|
#define WriteCommand(x) AspiCmd(x)
|
||||||
#define CONTRAST_OFS 5
|
#define CONTRAST_OFS 5
|
||||||
|
|
||||||
static void LCD_Init()
|
static void LCD_Init()
|
||||||
{
|
{
|
||||||
|
@ -22,9 +22,9 @@ static void LCD_Init()
|
||||||
AspiCmd(0xEA); //set bias=1/10 :Command table NO.27
|
AspiCmd(0xEA); //set bias=1/10 :Command table NO.27
|
||||||
AspiCmd(0x81); //Set Vop
|
AspiCmd(0x81); //Set Vop
|
||||||
#if defined(BOOT)
|
#if defined(BOOT)
|
||||||
AspiCmd(CONTRAST_OFS);
|
AspiCmd(CONTRAST_OFS+25);
|
||||||
#else
|
#else
|
||||||
AspiCmd(g_eeGeneral.contrast+CONTRAST_OFS); //0--255
|
AspiCmd(CONTRAST_OFS+g_eeGeneral.contrast);
|
||||||
#endif
|
#endif
|
||||||
AspiCmd(0xA6); //inverse display off
|
AspiCmd(0xA6); //inverse display off
|
||||||
AspiCmd(0xD1); //SET RGB:Command table NO.21 .SET RGB or BGR. D1=RGB
|
AspiCmd(0xD1); //SET RGB:Command table NO.21 .SET RGB or BGR. D1=RGB
|
||||||
|
|
|
@ -203,14 +203,11 @@ int8_t STORAGE_Read (uint8_t lun,
|
||||||
uint16_t blk_len)
|
uint16_t blk_len)
|
||||||
{
|
{
|
||||||
if (lun == 1) {
|
if (lun == 1) {
|
||||||
if (fat12Read(buf, blk_addr, blk_len) != 0) {
|
if (fat12Read(buf, blk_addr, blk_len) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (SD_ReadSectors(buf,
|
if (SD_ReadSectors(buf, blk_addr, blk_len) != 0) {
|
||||||
blk_addr,
|
|
||||||
blk_len) != 0) {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -238,9 +235,7 @@ int8_t STORAGE_Write (uint8_t lun,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (SD_WriteSectors(buf,
|
if (SD_WriteSectors(buf, blk_addr, blk_len) != 0)
|
||||||
blk_addr,
|
|
||||||
blk_len) != 0)
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue