#include #include #include #include #include #include #include #include #include "device.h" #include "hardware/VREF.h" #include "hardware/AFSK.h" #include "hardware/Serial.h" #include "hardware/LED.h" #include "hardware/UserIO.h" #include "hardware/SD.h" #include "hardware/Crypto.h" #include "hardware/Bluetooth.h" #include "hardware/BME280.h" #include "hardware/GPS.h" #include "protocol/AX25.h" #include "protocol/KISS.h" #include "util/Config.h" #include "util/time.h" #include "util/FIFO.h" uint8_t boot_vector = 0x00; uint8_t OPTIBOOT_MCUSR __attribute__ ((section(".noinit"))); void resetFlagsInit(void) __attribute__ ((naked)) __attribute__ ((used)) __attribute__ ((section (".init0"))); void resetFlagsInit(void) { __asm__ __volatile__ ("sts %0, r2\n" : "=m" (OPTIBOOT_MCUSR) :); } Serial serial; Afsk modem; AX25Ctx AX25; static void ax25_callback(struct AX25Ctx *ctx) { kiss_messageCallback(ctx); } void system_check(void) { // Check boot vector if (OPTIBOOT_MCUSR & (1< sensor_poll_time) { if (config_sensor_bme280_enabled && bme280_ready) { bme280_poll(); } sensor_poll_time = milliseconds() + config_sensor_interval_ms; } } void user_init(void) { // Place user-specified initialisation code here } void user_jobs(void) { // Place user-specified tasks and jobs here } int main (void) { init(); while (true) { ax25_poll(&AX25); kiss_poll(); kiss_csma(); sd_jobs(); gps_poll(); if (config_sensors_enabled) sensor_jobs(); if (config_user_jobs_enabled) user_jobs(); } return(0); }