FOSSASAT-1B
configuration.cpp
1 #include "configuration.h"
2 
3 // flag to signal interrupts enabled/disabled
4 volatile bool interruptsEnabled = true;
5 
6 // flag to signal data was received from ISR
7 volatile bool dataReceived = false;
8 
9 // current modem configuration
10 uint8_t currentModem;
11 
12 // current spreading factor mode
14 
15 // timestamps
16 uint32_t lastHeartbeat = 0;
17 
18 // INA226 instance
19 INA226 ina;
20 
21 // RadioLib instances
23 MorseClient morse(&radio);
24 
25 // transmission password
26 const char* password = "password";
27 
28 // encryption key
29 const uint8_t encryptionKey[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
30  0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00};
31 
33  // set up digital pins
34  pinMode(DIGITAL_OUT_MOSFET_1, OUTPUT);
35  pinMode(DIGITAL_OUT_MOSFET_2, OUTPUT);
36  pinMode(DIGITAL_OUT_WATCHDOG_HEARTBEAT, OUTPUT);
37  pinMode(DIGITAL_OUT_MPPT_PIN, OUTPUT);
38 
39  // set up analog pins
40  pinMode(ANALOG_IN_SOLAR_A_VOLTAGE_PIN, INPUT);
41  pinMode(ANALOG_IN_SOLAR_B_VOLTAGE_PIN, INPUT);
42  pinMode(ANALOG_IN_SOLAR_C_VOLTAGE_PIN, INPUT);
43  pinMode(ANALOG_IN_RANDOM_SEED, INPUT);
44 
45  // bring deployment MOSFETs low
46  digitalWrite(DIGITAL_OUT_MOSFET_1, LOW);
47  digitalWrite(DIGITAL_OUT_MOSFET_2, LOW);
48 
49  // provide seed for encrpytion PRNG
50  randomSeed(analogRead(ANALOG_IN_RANDOM_SEED));
51 }
void Configuration_Setup_Pins()
This function is called at the very beginning of the satellite's startup to configure each pin...
#define RADIO_NRST
uint32_t lastHeartbeat
#define DIGITAL_OUT_WATCHDOG_HEARTBEAT
uint8_t spreadingFactorMode
#define DIGITAL_OUT_MOSFET_2
#define RADIO_NSS
const uint8_t encryptionKey[]
volatile bool interruptsEnabled
INA226 ina
uint8_t currentModem
#define ANALOG_IN_SOLAR_C_VOLTAGE_PIN
#define ANALOG_IN_RANDOM_SEED
#define DIGITAL_OUT_MOSFET_1
#define RADIO_BUSY
#define RADIO_DIO1
#define ANALOG_IN_SOLAR_B_VOLTAGE_PIN
volatile bool dataReceived
#define ANALOG_IN_SOLAR_A_VOLTAGE_PIN
#define DIGITAL_OUT_MPPT_PIN
const char * password
MorseClient morse
SX1268 radio