Skip to content

Commit

Permalink
Make register array volatile
Browse files Browse the repository at this point in the history
  • Loading branch information
CameronRP committed Apr 11, 2024
1 parent 41276d8 commit a69896e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <avr/io.h>

#define MAJOR_VERSION 12 // Needs to be updated if the compatibility will change with tc2-agent, tc2-firmware, or tc2-hat-controller
#define MINOR_VERSION 5 // Update for just small bug fixes that doesn't cause compatibility issues with other software.
#define MINOR_VERSION 6 // Update for just small bug fixes that doesn't cause compatibility issues with other software.

//=====DEFINITIONS=====//
#define BATTERY_HYSTERESIS 10
Expand Down Expand Up @@ -52,12 +52,11 @@
#define POWER_OFF_RPI 0x01 << 3
#define TOGGLE_AUX_TERMINAL_FLAG 0x01 << 4


uint8_t registers[REG_LEN] = {0};
uint8_t writeMasks[REG_LEN] = {}; // Should all be initialised to 0xFF
uint8_t registerAddress = 0;

//=====GLOBAL VARIABLES=====//
volatile uint8_t registers[REG_LEN] = {0};
volatile uint8_t registerAddress = 0;
volatile uint16_t battLowVoltageDiv = 0; // Raw reading value from ADC
volatile uint16_t battHighVoltageDiv = 0; // Raw reading value from ADC
volatile uint16_t battRTC = 0; // Raw reading value from ADC
Expand Down Expand Up @@ -217,7 +216,7 @@ void loop() {

updateLEDs();
//delay(50);
sleep_cpu();
sleep_mode();
}

void updateLEDs() {
Expand Down

0 comments on commit a69896e

Please sign in to comment.