- make bootloader silent if not selected

git-svn-id: http://moon:8086/svn/projects/HendiControl@156 fda53097-d464-4ada-af97-ba876c37ca34
This commit is contained in:
2019-03-29 23:53:37 +00:00
parent c7a3aa29ee
commit a25276d633
+24 -8
View File
@@ -58,14 +58,30 @@ void init_page(uint8_t *pPageBuffer, size_t size)
}
}
int port_init()
void port_init()
{
DDRB = 0x00;
DDRD = 0x40;
PORTD = 0x00;
PORTD = 0x40;
}
int is_bsel()
{
return ((PINB & 1) == 0);
}
void led_bsel(int enable)
{
if (enable)
{
PORTD = 0x00;
}
else
{
PORTD = 0x40;
}
}
int main(void)
{
uint8_t page_buffer[SPM_PAGESIZE];
@@ -73,15 +89,15 @@ int main(void)
State state = StateIdle;
State state_next;
srec_t srec;
port_init();
cli();
uart_init(9600);
uart_puts("Hendi-Control Bootloader v1.1\n");
int bsel = port_init();
if (bsel)
if (is_bsel())
{
bootloader_enter();
led_bsel(1);
uart_init(9600);
uart_puts("Hendi-Control Bootloader v1.2\n");
size_t image_size = 0;
uint16_t page_addr = 0xFFFF;
size_t hex_buffer_size = 0;