Bladeren bron

Include files refactoring

kbere 2 dagen geleden
bovenliggende
commit
132898def8
9 gewijzigde bestanden met toevoegingen van 33 en 79 verwijderingen
  1. 0 5
      soft/display.c
  2. 0 12
      soft/gpx.c
  3. 0 24
      soft/main.c
  4. 33 1
      soft/main.h
  5. 0 4
      soft/menu.c
  6. 0 14
      soft/nmea.c
  7. 0 7
      soft/settings.c
  8. 0 5
      soft/timec.c
  9. 0 7
      soft/working_modes.c

+ 0 - 5
soft/display.c

@@ -1,9 +1,4 @@
-#include <avr/pgmspace.h>
 #include "main.h"
-#include "display.h"
-#include "xprintf.h"
-#include "working_modes.h"
-#include "timec.h"
 
 #ifndef LCD_GRAPHIC
 __flash const unsigned char battery_states[][8] = {

+ 0 - 12
soft/gpx.c

@@ -4,18 +4,6 @@
 #include "main.h"
 #endif
 
-/* These are now included via main.h */
-#ifndef PC_BUILD
-#include <string.h>
-#include <avr/pgmspace.h>
-#include "xprintf.h"
-#include "math.h"
-#include "gpx.h"
-#include "ff.h"
-#include "settings.h"
-#include "timec.h"
-#endif
-
 #define KALMAN_Q	8.5e-6
 #define KALMAN_R	4e-5
 #define KALMAN_ERR_MAX	6e-4

+ 0 - 24
soft/main.c

@@ -3,31 +3,7 @@
  * Modified                                       k4be, 2022     *
  *---------------------------------------------------------------*/
 
-#include <avr/io.h>
-#include <avr/interrupt.h>
-#include <avr/sleep.h>
-#include <util/delay.h>
-#include <avr/pgmspace.h>
-#include <avr/wdt.h>
-#include <string.h>
-#include <stdlib.h>
 #include "main.h"
-#include "ff.h"
-#include "diskio.h"
-#include "uart0.h"
-#include "uart1.h"
-#include "xprintf.h"
-#include "stime.h"
-#include "ds18b20.h"
-#include "I2C.h"
-#include "expander.h"
-#include "gpx.h"
-#include "display.h"
-#include "working_modes.h"
-#include "timec.h"
-#include "nmea.h"
-#include "settings.h"
-#include "menu.h"
 
 /*FUSES = {0xFF, 0x11, 0xFE};*/		/* ATmega644PA fuses: Low, High, Extended.
 This is the fuse settings for this project. The fuse bits will be included

+ 33 - 1
soft/main.h

@@ -1,13 +1,37 @@
 #pragma once
 
 #define __PROG_TYPES_COMPAT__
+
+/* Standard library includes */
 #include <inttypes.h>
+#include <avr/io.h>
 #include <avr/pgmspace.h>
 #include <avr/interrupt.h>
+#include <avr/sleep.h>
+#include <avr/wdt.h>
+#include <avr/eeprom.h>
+#include <util/delay.h>
+#include <util/crc16.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <ctype.h>
+#include <stdarg.h>
+#include <math.h>
+
+/* Project includes - basic headers without struct dependencies */
 #include "stime.h"
 #include "expander.h"
 #include "settings.h"
-
+#include "ff.h"
+#include "diskio.h"
+#include "uart0.h"
+#include "uart1.h"
+#include "xprintf.h"
+#include "ds18b20.h"
+#include "I2C.h"
+
+/* LCD driver includes */
 #if defined(LCD_GRAPHIC)
 #include "UC1601S-I2C.h"
 #elif defined(LCD_ALNUM)
@@ -193,6 +217,14 @@ extern volatile struct system_s System;
 extern struct location_s location;
 extern time_t utc;
 
+/* Project includes - headers that depend on struct definitions above */
+#include "gpx.h"
+#include "display.h"
+#include "working_modes.h"
+#include "timec.h"
+#include "nmea.h"
+#include "menu.h"
+
 static inline void atomic_set_uint(volatile unsigned int *volatile data, unsigned int value) __attribute__((always_inline));
 static inline void atomic_set_uint(volatile unsigned int *volatile data, unsigned int value){
 	cli();

+ 0 - 4
soft/menu.c

@@ -1,8 +1,4 @@
 #include "main.h"
-#include "menu.h"
-#include "settings.h"
-#include "display.h"
-#include "xprintf.h"
 
 unsigned char __menu_num; // Menu stack variables
 struct menu_struct __menu_data[DATA_NUM];

+ 0 - 14
soft/nmea.c

@@ -4,20 +4,6 @@
 #include "main.h"
 #endif
 
-/* These are now included via main.h */
-#ifndef PC_BUILD
-#include <avr/wdt.h>
-#include <stddef.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <avr/sleep.h>
-#include "nmea.h"
-#include "uart0.h"
-#include "uart1.h"
-#include "xprintf.h"
-#endif
-
 /*----------------------------------------------------*/
 /*  Get a line received from GPS module               */
 /*----------------------------------------------------*/

+ 0 - 7
soft/settings.c

@@ -1,11 +1,4 @@
-#include <util/crc16.h>
 #include "main.h"
-#include "settings.h"
-#include "display.h"
-#include "xprintf.h"
-#include "working_modes.h"
-#include "nmea.h"
-#include "menu.h"
 
 EEMEM struct config_s config_eep;
 EEMEM unsigned char config_crc;

+ 0 - 5
soft/timec.c

@@ -1,9 +1,4 @@
-#include <avr/pgmspace.h>
-#include "stime.h"
-#include "timec.h"
 #include "main.h"
-#include "ff.h"
-#include "xprintf.h"
 
 __flash const unsigned char mi[] = {3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5};
 

+ 0 - 7
soft/working_modes.c

@@ -1,11 +1,4 @@
 #include "main.h"
-#include "working_modes.h"
-#include "display.h"
-#include "xprintf.h"
-#include "settings.h"
-#include "nmea.h"
-#include "gpx.h"
-#include "menu.h"
 
 void tracking_pause(unsigned char cmd, unsigned char display) {
 	switch (cmd) {