[X9D] Backlight support on simu

This commit is contained in:
bsongis
2012-12-28 08:20:22 +00:00
parent 7eae709938
commit 3d92371570
10 changed files with 27 additions and 62 deletions
+11 -18
View File
@@ -66,7 +66,7 @@ struct t_file_entry File_system[MAX_MODELS+1] ;
char ModelNames[MAX_MODELS][sizeof(g_model.name)] ; // Allow for general
// TODO check everything here
uint8_t Eeprom32_process_state ;
uint8_t Eeprom32_process_state = E32_IDLE;
uint8_t Eeprom32_state_after_erase ;
uint8_t Eeprom32_write_pending ;
uint8_t Eeprom32_file_index ;
@@ -449,8 +449,18 @@ void ee32LoadModelName(uint8_t id, char *buf, uint8_t len)
}
}
void fill_file_index()
{
for (uint32_t i = 0 ; i < MAX_MODELS + 1 ; i += 1 )
{
File_system[i].block_no = get_current_block_number( i * 2, &File_system[i].size, &File_system[i].sequence_no ) ;
}
}
void eeReadAll()
{
fill_file_index() ;
if (!eeLoadGeneral() )
{
generalDefault();
@@ -677,14 +687,6 @@ void ee32_process()
}
}
void fill_file_index()
{
for (uint32_t i = 0 ; i < MAX_MODELS + 1 ; i += 1 )
{
File_system[i].block_no = get_current_block_number( i * 2, &File_system[i].size, &File_system[i].sequence_no ) ;
}
}
void ee32_read_model_names()
{
for (uint32_t i=0; i<MAX_MODELS; i++)
@@ -693,15 +695,6 @@ void ee32_read_model_names()
}
}
void eeprom_init()
{
#ifndef SIMU
init_spi();
#endif
fill_file_index() ;
Eeprom32_process_state = E32_IDLE ;
}
#if defined(SDCARD)
const pm_char * eeBackupModel(uint8_t i_fileSrc)
{
-1
View File
@@ -44,7 +44,6 @@ extern uint8_t *Eeprom32_source_address ;
extern uint8_t Eeprom32_file_index ;
extern uint32_t Eeprom32_data_size ;
extern void eeprom_init( void ) ;
extern void end_spi(); // TODO not public
extern void ee32_process( void ) ;
extern bool eeLoadGeneral( void ) ;
-4
View File
@@ -318,10 +318,6 @@ void *main_thread(void *)
g_menuStack[0] = menuMainView;
g_menuStack[1] = menuModelSelect;
#if defined(CPUARM)
eeprom_init();
#endif
eeReadAll(); //load general setup and selected model
if (g_eeGeneral.backlightMode != e_backlight_mode_off) backlightOn(); // on Tx start turn the light on
+3 -2
View File
@@ -345,8 +345,9 @@ void eeprom_read_block (void *pointer_ram,
#if defined(PCBX9D) || defined(PCBACT)
inline void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct) { }
#define GPIO_SetBits(...)
#define GPIO_ResetBits(...)
#define GPIO_SetBits(GPIOx, pin) GPIOx->BSRRL |= pin
#define GPIO_ResetBits(GPIOx, pin) GPIOx->BSRRL &= ~pin
#define GPIO_IsSet(GPIOx, pin) (GPIOx->BSRRL & pin)
#define RCC_AHB1PeriphClockCmd(...)
#define GPIO_ReadInputDataBit(...) true
#endif
+1 -1
View File
@@ -686,7 +686,7 @@ void boardInit()
codecsInit();
eeprom_init();
eepromInit();
init_rotary_encoder();
+1 -1
View File
@@ -194,7 +194,7 @@ uint32_t eeprom_read_status()
// MOSI PA13 (peripheral A)
// SCK PA14 (peripheral A)
// Set clock to 3 MHz, AT25 device is rated to 70MHz, 18MHz would be better
void init_spi()
void eepromInit()
{
register Spi *spiptr ;
register uint32_t timer ;
-27
View File
@@ -1,27 +0,0 @@
/**
******************************************************************************
* @file Project/Macro_define.h
* @author X9D Application Team
* @Hardware version V0.2
* @date 11-July-2012
* @brief This file provides Macro defines for testing or working.
* *
******************************************************************************
*/
#ifndef _Macro_Define_H_
#define _Macro_Define_H_
#include "stm32f2xx.h"
#define assert(x) do{ if(!(x)) while(1);}while(0);
#define udelay(x) do{ uint32_t temp; temp=((x+0)<<3); while(--temp);}while(0)
#define delayUsec(x) udelay(x)
#define LCD_TEST
#define AUDIO_TEST
//#define I2C_TEST
//#define ADC_TEST
#endif
+4 -1
View File
@@ -109,6 +109,9 @@ uint32_t check_soft_power();
#define setBacklight(xx)
#define __BACKLIGHT_ON GPIO_SetBits(GPIOB, GPIO_Pin_BL)
#define __BACKLIGHT_OFF GPIO_ResetBits(GPIOB, GPIO_Pin_BL)
#define IS_BACKLIGHT_ON() (GPIOB & GPIO_Pin_BL)
#define IS_BACKLIGHT_ON() GPIO_IsSet(GPIOB, GPIO_Pin_BL)
#define udelay(x) do { uint32_t temp; temp=((x+0)<<3); while(--temp); } while (0)
#define delayUsec(x) udelay(x)
#endif
+4 -1
View File
@@ -33,8 +33,11 @@
#include "../open9x.h"
void init_spi()
void eepromInit()
{
#if !defined(SIMU)
I2C_EE_Init();
#endif
}
void eeprom_write_enable()
+3 -6
View File
@@ -10,10 +10,7 @@
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "i2c_ee.h"
#include "hal.h"
#include "Macro_define.h"
#include "../open9x.h"
uint16_t EEPROM_ADDRESS;
@@ -136,11 +133,11 @@ void I2C_SEND_DATA(char SendByte)
while (i--) {
SCL_L;
I2C_delay();
if (SendByte&0x80)
if (SendByte & 0x80)
SDA_H;
else
SDA_L;
SendByte<<=1;
SendByte <<= 1;
I2C_delay();
SCL_H;
I2C_delay();