My LoRaWAN Signal Mapping MSc summer project. This is a copy of the actual repository with personal information removed.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.6 KiB

#include "settings.h"
#include <Arduino.h>
#include <TinyGPS++.h>
#include <MemoryFree.h>
#include "random.h"
// BAD PRACTICE: For some extremely strange reason, the Arduino IDE doesn't pick up random.cpp like it does our other source files - so we've got to explicitly include it here. If we had control over the build process (which we don't), we've use a Makefile here that handled this better.
#include "random.cpp"
#include "gps.h"
#include "peripheral.h"
#include "storage.h"
#include "power.h"
#include "transmission.h"
void setup() {
Serial.begin(BAUD_PC);
Serial.println(F("[main] Starting"));
random_begin();
Serial.println(freeMemory(), DEC);
GPSLocation gps_data = gps_fetch();
Serial.println(freeMemory(), DEC);
Serial.print(F("[main] Location ")); Serial.print(gps_data.lat); Serial.print(F(", ")); Serial.println(gps_data.lng);
uint32_t id = random_get();
Serial.print(F("[main] Id "));
Serial.println(id);
// Activate microSD card breakout board on the SPI bus
peripheral_register(PIN_SPI_CS_RFM95);
peripheral_register(PIN_SPI_CS_SD);
peripheral_unsilence(PIN_SPI_CS_SD);
Serial.println(freeMemory(), DEC);
store_reading(id, gps_data);
Serial.println(freeMemory(), DEC);
#ifdef SD_DEBUG_ENABLED
store_debug(gps_data.time, 19 - 1); // Don't print the null byte
Serial.println(freeMemory(), DEC);
#endif
// ------------------------------------------------------------------------
// Activate the RFM95
peripheral_switch(PIN_SPI_CS_SD, PIN_SPI_CS_RFM95);
uint8_t message[] = "testing";
// transmit_init();
// transmit_send(message, 7);
power_off(); // Doesn't return
}
void loop() {
}