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