Fix a pile of yellow in the bootloader
Change-Id: Ia89a33bbb13683566e421ac2a002baa20cdb07de
This commit is contained in:
parent
b4865b05b0
commit
4a3d046545
9 changed files with 87 additions and 58 deletions
|
@ -66,6 +66,7 @@ void rtc_init(void)
|
|||
|
||||
/* read value of the Control 2 register - we'll need it to preserve alarm and timer interrupt assertion flags */
|
||||
rv = i2c_readbytes(RTC_ADDR, RTC_CTRL2, 1, &tmp);
|
||||
(void)rv;
|
||||
/* preserve alarm and timer interrupt flags */
|
||||
tmp &= (RTC_TF | RTC_AF | RTC_TIE | RTC_AIE);
|
||||
pp_i2c_send(RTC_ADDR, RTC_CTRL2, tmp);
|
||||
|
@ -119,6 +120,7 @@ void rtc_set_alarm(int h, int m)
|
|||
|
||||
/* clear alarm interrupt */
|
||||
rv = i2c_readbytes(RTC_ADDR, RTC_CTRL2, 1, buf);
|
||||
(void)rv;
|
||||
buf[0] &= RTC_AF;
|
||||
pp_i2c_send(RTC_ADDR, RTC_CTRL2, buf[0]);
|
||||
|
||||
|
@ -180,6 +182,7 @@ void rtc_enable_alarm(bool enable)
|
|||
tmp &= ~(RTC_AIE | RTC_AF);
|
||||
pp_i2c_send(RTC_ADDR, RTC_CTRL2, tmp);
|
||||
}
|
||||
(void)rv;
|
||||
}
|
||||
|
||||
bool rtc_check_alarm_started(bool release_alarm)
|
||||
|
@ -211,6 +214,7 @@ bool rtc_check_alarm_started(bool release_alarm)
|
|||
run_before = true;
|
||||
rtc_lock_alarm_clear = false;
|
||||
}
|
||||
(void)rv;
|
||||
|
||||
return started;
|
||||
}
|
||||
|
@ -226,4 +230,3 @@ bool rtc_check_alarm_flag(void)
|
|||
return (tmp & RTC_AF);
|
||||
}
|
||||
#endif /* HAVE_RTC_ALARM */
|
||||
|
||||
|
|
|
@ -64,13 +64,18 @@ int button_read_device(void)
|
|||
int btn = BUTTON_NONE;
|
||||
int data;
|
||||
unsigned char state;
|
||||
|
||||
static bool hold_button = false;
|
||||
static bool remote_hold_button = false;
|
||||
#ifndef BOOTLOADER
|
||||
bool hold_button_old;
|
||||
bool remote_hold_button_old;
|
||||
#endif
|
||||
|
||||
/* Hold */
|
||||
#ifndef BOOTLOADER
|
||||
hold_button_old = hold_button;
|
||||
#endif
|
||||
hold_button = button_hold();
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
|
@ -112,8 +117,10 @@ int button_read_device(void)
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
/* remote buttons */
|
||||
remote_hold_button_old = remote_hold_button;
|
||||
#endif
|
||||
|
||||
data = adc_scan(ADC_REMOTE);
|
||||
remote_hold_button = data < 0x2B;
|
||||
|
|
|
@ -77,10 +77,14 @@ int button_read_device(void)
|
|||
static int lastbutton;
|
||||
unsigned short remote_adc;
|
||||
int btn = BUTTON_NONE;
|
||||
#ifndef BOOTLOADER
|
||||
bool hold_button_old;
|
||||
#endif
|
||||
|
||||
/* normal buttons */
|
||||
#ifndef BOOTLOADER
|
||||
hold_button_old = hold_button;
|
||||
#endif
|
||||
hold_button = button_hold();
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
|
|
|
@ -159,6 +159,7 @@ void irq_handler(void)
|
|||
|
||||
void* dummy = VIC0ADDRESS;
|
||||
dummy = VIC1ADDRESS;
|
||||
(void)dummy;
|
||||
uint32_t irqs0 = VIC0IRQSTATUS;
|
||||
uint32_t irqs1 = VIC1IRQSTATUS;
|
||||
for (current_irq = 0; irqs0; current_irq++, irqs0 >>= 1)
|
||||
|
|
|
@ -50,11 +50,15 @@ int button_read_device(int *data)
|
|||
static int old_data = 0;
|
||||
|
||||
static bool hold_button = false;
|
||||
#ifndef BOOTLOADER
|
||||
bool hold_button_old;
|
||||
#endif
|
||||
|
||||
*data = old_data;
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
hold_button_old = hold_button;
|
||||
#endif
|
||||
hold_button = button_hold();
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
|
|
|
@ -63,7 +63,7 @@ const unsigned short percent_to_volt_charge[11] =
|
|||
int _battery_voltage(void)
|
||||
{
|
||||
short bat1, bat2, aux;
|
||||
static unsigned last_tick = 0;
|
||||
// static unsigned last_tick = 0;
|
||||
short tsadc;
|
||||
|
||||
tsadc=tsc2100_readreg(TSADC_PAGE, TSADC_ADDRESS);
|
||||
|
@ -72,7 +72,7 @@ int _battery_voltage(void)
|
|||
if(!(tsadc & TSADC_PSTCM))
|
||||
{
|
||||
tsc2100_set_mode(true, 0x0B);
|
||||
last_tick = current_tick;
|
||||
// last_tick = current_tick;
|
||||
}
|
||||
|
||||
if(tsc2100_read_volt(&bat1, &bat2, &aux))
|
||||
|
@ -87,4 +87,3 @@ int _battery_voltage(void)
|
|||
|
||||
return current_voltage;
|
||||
}
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ void system_exception_wait(void)
|
|||
|
||||
void system_init(void)
|
||||
{
|
||||
unsigned int vector_addr;
|
||||
// unsigned int vector_addr;
|
||||
/* Pin 33 is connected to a buzzer, for an annoying sound set
|
||||
* PWM0C == 0x3264
|
||||
* PWM0H == 0x1932
|
||||
|
@ -335,7 +335,7 @@ void system_init(void)
|
|||
/* IRQENTRY only reflects enabled interrupts */
|
||||
IO_INTC_RAW = 0;
|
||||
|
||||
vector_addr = (unsigned int) irqvector;
|
||||
// vector_addr = (unsigned int) irqvector;
|
||||
IO_INTC_ENTRY_TBA0 = 0;//(short) vector_addr & ~0x000F;
|
||||
IO_INTC_ENTRY_TBA1 = 0;//(short) (vector_addr >> 16);
|
||||
|
||||
|
@ -503,4 +503,3 @@ void system_prepare_fw_start(void)
|
|||
IO_INTC_EINT2 = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -49,12 +49,16 @@ bool remote_button_hold(void)
|
|||
int button_read_device(void)
|
||||
{
|
||||
int btn = BUTTON_NONE;
|
||||
#ifndef BOOTLOADER
|
||||
bool hold_button_old;
|
||||
bool remote_hold_button_old;
|
||||
#endif
|
||||
int data;
|
||||
|
||||
/* normal buttons */
|
||||
#ifndef BOOTLOADER
|
||||
hold_button_old = hold_button;
|
||||
#endif
|
||||
hold_button = button_hold();
|
||||
|
||||
if (!hold_button)
|
||||
|
@ -87,7 +91,9 @@ int button_read_device(void)
|
|||
/* remote buttons */
|
||||
data = remote_detect() ? adc_read(ADC_REMOTE) : 0xff;
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
remote_hold_button_old = remote_hold_button;
|
||||
#endif
|
||||
remote_hold_button = data < 0x14;
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
|
|
|
@ -60,14 +60,18 @@ bool remote_button_hold(void)
|
|||
int button_read_device(void)
|
||||
{
|
||||
int btn = BUTTON_NONE;
|
||||
#ifndef BOOTLOADER
|
||||
bool hold_button_old;
|
||||
bool remote_hold_button_old;
|
||||
#endif
|
||||
static int prev_data = 0xff;
|
||||
static int last_valid = 0xff;
|
||||
int data;
|
||||
|
||||
/* normal buttons */
|
||||
#ifndef BOOTLOADER
|
||||
hold_button_old = hold_button;
|
||||
#endif
|
||||
hold_button = button_hold();
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
|
@ -114,7 +118,9 @@ int button_read_device(void)
|
|||
/* remote buttons */
|
||||
data = remote_detect() ? adc_scan(ADC_REMOTE) : 0xff;
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
remote_hold_button_old = remote_hold_button;
|
||||
#endif
|
||||
remote_hold_button = data < 0x17;
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
|
|
Loading…
Reference in a new issue