|
@@ -290,16 +290,20 @@ optiboot_version = 256*(OPTIBOOT_MAJVER + OPTIBOOT_CUSTOMVER) + OPTIBOOT_MINVER;
|
|
|
|
|
|
#define BAUD_SETTING (( (F_CPU + BAUD_RATE * 4L) / ((BAUD_RATE * 8L))) - 1 )
|
|
|
#define BAUD_ACTUAL (F_CPU/(8 * ((BAUD_SETTING)+1)))
|
|
|
-#define BAUD_ERROR (( 100*(BAUD_RATE - BAUD_ACTUAL) ) / BAUD_RATE)
|
|
|
-
|
|
|
-#if BAUD_ERROR >= 5
|
|
|
-#error BAUD_RATE error greater than 5%
|
|
|
-#elif BAUD_ERROR <= -5
|
|
|
-#error BAUD_RATE error greater than -5%
|
|
|
-#elif BAUD_ERROR >= 2
|
|
|
-#warning BAUD_RATE error greater than 2%
|
|
|
-#elif BAUD_ERROR <= -2
|
|
|
-#warning BAUD_RATE error greater than -2%
|
|
|
+#if BAUD_ACTUAL <= BAUD_RATE
|
|
|
+ #define BAUD_ERROR (( 100*(BAUD_RATE - BAUD_ACTUAL) ) / BAUD_RATE)
|
|
|
+ #if BAUD_ERROR >= 5
|
|
|
+ #error BAUD_RATE error greater than -5%
|
|
|
+ #elif BAUD_ERROR >= 2
|
|
|
+ #warning BAUD_RATE error greater than -2%
|
|
|
+ #endif
|
|
|
+#else
|
|
|
+ #define BAUD_ERROR (( 100*(BAUD_ACTUAL - BAUD_RATE) ) / BAUD_RATE)
|
|
|
+ #if BAUD_ERROR >= 5
|
|
|
+ #error BAUD_RATE error greater than 5%
|
|
|
+ #elif BAUD_ERROR >= 2
|
|
|
+ #warning BAUD_RATE error greater than 2%
|
|
|
+ #endif
|
|
|
#endif
|
|
|
|
|
|
#if (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 > 250
|