From df56c546975989bfece02ee4e600703a8dc27242 Mon Sep 17 00:00:00 2001 From: Olaf Rempel Date: Fri, 23 Oct 2020 23:40:08 +0200 Subject: [PATCH] Align identation and some cleanup --- main.c | 53 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/main.c b/main.c index 222094b..e5062e2 100644 --- a/main.c +++ b/main.c @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 11/2019 by Olaf Rempel * + * Copyright (C) 10/2020 by Olaf Rempel * * razzor@kopf-tisch.de * * * * This program is free software; you can redistribute it and/or modify * @@ -21,27 +21,34 @@ #include #include -#define VERSION_STRING "TWIBOOT v3.0" -#define EEPROM_SUPPORT 1 -#define LED_SUPPORT 1 -#define USE_CLOCKSTRETCH 0 +#define VERSION_STRING "TWIBOOT v3.1" +#define EEPROM_SUPPORT 1 +#define LED_SUPPORT 1 -#define F_CPU 8000000ULL -#define TIMER_DIVISOR 1024 -#define TIMER_IRQFREQ_MS 25 -#define TIMEOUT_MS 1000 +#ifndef USE_CLOCKSTRETCH +#define USE_CLOCKSTRETCH 0 +#endif + +#ifndef TWI_ADDRESS +#define TWI_ADDRESS 0x29 +#endif + +#define F_CPU 8000000ULL +#define TIMER_DIVISOR 1024 +#define TIMER_IRQFREQ_MS 25 +#define TIMEOUT_MS 1000 #define TIMER_MSEC2TICKS(x) ((x * F_CPU) / (TIMER_DIVISOR * 1000ULL)) #define TIMER_MSEC2IRQCNT(x) (x / TIMER_IRQFREQ_MS) -#if LED_SUPPORT -#define LED_INIT() DDRB = ((1< send data */ case 0xB8: @@ -593,10 +600,12 @@ int main(void) LED_OFF(); +#if (LED_SUPPORT) uint16_t wait = 0x0000; do { __asm volatile ("nop"); } while (--wait); +#endif /* (LED_SUPPORT) */ jump_to_app(); } /* main */