3-phase PV router
Loading...
Searching...
No Matches
shared_var.h
Go to the documentation of this file.
1#ifndef SHARED_VAR_H
2#define SHARED_VAR_H
3
4#include <Arduino.h>
5
6// Shared variables - carefully managed between ISR and loop
7namespace Shared
8{
9// for interaction between the main processor and the ISR
10inline volatile bool b_datalogEventPending{ false };
11inline volatile bool b_newMainsCycle{ false };
12inline volatile bool b_overrideLoadOn[NO_OF_DUMPLOADS]{};
13inline volatile bool b_reOrderLoads{ false };
14inline volatile bool b_diversionEnabled{ true };
15
16inline volatile uint16_t absenceOfDivertedEnergyCountInSeconds{ 0 };
17
18// since there's no real locking feature for shared variables, a couple of data
19// generated from inside the ISR are copied from time to time to be passed to the
20// main processor. When the data are available, the ISR signals it to the main processor.
21inline volatile int32_t copyOf_sumP_atSupplyPoint[NO_OF_PHASES];
22inline volatile int32_t copyOf_sum_Vsquared[NO_OF_PHASES];
23inline volatile float copyOf_energyInBucket_main;
26inline volatile uint16_t copyOf_countLoadON[NO_OF_DUMPLOADS];
27}
28
29#endif /* SHARED_VAR_H */
constexpr uint8_t NO_OF_DUMPLOADS
Definition config.h:32
constexpr uint8_t NO_OF_PHASES
volatile int32_t copyOf_sum_Vsquared[NO_OF_PHASES]
Definition shared_var.h:22
volatile float copyOf_energyInBucket_main
Definition shared_var.h:23
volatile bool b_datalogEventPending
Definition shared_var.h:10
volatile bool b_overrideLoadOn[NO_OF_DUMPLOADS]
Definition shared_var.h:12
volatile bool b_reOrderLoads
Definition shared_var.h:13
volatile uint16_t copyOf_sampleSetsDuringThisDatalogPeriod
Definition shared_var.h:25
volatile int32_t copyOf_sumP_atSupplyPoint[NO_OF_PHASES]
Definition shared_var.h:21
volatile uint8_t copyOf_lowestNoOfSampleSetsPerMainsCycle
Definition shared_var.h:24
volatile uint16_t copyOf_countLoadON[NO_OF_DUMPLOADS]
Definition shared_var.h:26
volatile uint16_t absenceOfDivertedEnergyCountInSeconds
Definition shared_var.h:16
volatile bool b_newMainsCycle
Definition shared_var.h:11
volatile bool b_diversionEnabled
Definition shared_var.h:14