- use fancy short pulse heartbeat led flashing
- bootloader now checks BSEL git-svn-id: http://moon:8086/svn/projects/HendiControl@153 fda53097-d464-4ada-af97-ba876c37ca34
This commit is contained in:
@@ -58,6 +58,14 @@ void init_page(uint8_t *pPageBuffer, size_t size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int port_init()
|
||||||
|
{
|
||||||
|
DDRB = 0x00;
|
||||||
|
DDRD = 0x40;
|
||||||
|
PORTD = 0x00;
|
||||||
|
return (PINB0 == 1);
|
||||||
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
uint8_t page_buffer[SPM_PAGESIZE];
|
uint8_t page_buffer[SPM_PAGESIZE];
|
||||||
@@ -66,10 +74,13 @@ int main(void)
|
|||||||
State state_next;
|
State state_next;
|
||||||
srec_t srec;
|
srec_t srec;
|
||||||
cli();
|
cli();
|
||||||
|
|
||||||
bootloader_enter();
|
bootloader_enter();
|
||||||
|
|
||||||
|
int bsel = port_init();
|
||||||
|
if (bsel)
|
||||||
|
{
|
||||||
uart_init(9600);
|
uart_init(9600);
|
||||||
|
|
||||||
uart_puts("Hendi-Control Bootloader v1.1\n");
|
uart_puts("Hendi-Control Bootloader v1.1\n");
|
||||||
size_t image_size = 0;
|
size_t image_size = 0;
|
||||||
uint16_t page_addr = 0xFFFF;
|
uint16_t page_addr = 0xFFFF;
|
||||||
@@ -202,6 +213,7 @@ int main(void)
|
|||||||
} while (!leave_loop);
|
} while (!leave_loop);
|
||||||
|
|
||||||
uart_puts("Exit bootloader!\n\n");
|
uart_puts("Exit bootloader!\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
bootloader_exit();
|
bootloader_exit();
|
||||||
|
|
||||||
|
|||||||
@@ -206,8 +206,15 @@ int main(void)
|
|||||||
{
|
{
|
||||||
case TIMER_GENERAL:
|
case TIMER_GENERAL:
|
||||||
{
|
{
|
||||||
timer_start(timer_id, TIMER_SW_DELAY_MS(500));
|
|
||||||
hb_state = !hb_state;
|
hb_state = !hb_state;
|
||||||
|
if (hb_state)
|
||||||
|
{
|
||||||
|
timer_start(timer_id, TIMER_SW_DELAY_MS(50));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
timer_start(timer_id, TIMER_SW_DELAY_MS(950));
|
||||||
|
}
|
||||||
portSet(Led_HB, hb_state);
|
portSet(Led_HB, hb_state);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user