3-phase PV router
Loading...
Searching...
No Matches
Initialization

Functions and classes responsible for system setup and configuration. More...

Functions

constexpr uint16_t getInputPins ()
 Retrieves the input pins configuration.
 
constexpr uint16_t getOutputPins ()
 Retrieves the output pins configuration.
 
template<size_t N>
constexpr void initializeArray (int32_t(&array)[N], int32_t value)
 Initializes all elements of a given array to a specified value.
 
void initializeProcessing ()
 Initializes the processing engine, including ports, load states, and ADC setup.
 
void printConfiguration ()
 Print the configuration during startup.
 
void setup ()
 Called once during startup.
 

Detailed Description

Functions and classes responsible for system setup and configuration.

This group includes functions and classes that handle the initialization of hardware components, system parameters, and other configurations required for the proper operation of the system.

Function Documentation

◆ getInputPins()

uint16_t getInputPins ( )
constexpr

Retrieves the input pins configuration.

This function determines which pins are configured as input pins based on the current hardware setup. It ensures that no pin is configured multiple times and handles special cases like the dual tariff, diversion, rotation, and force pins.

Returns
A 16-bit value representing the configured input pins. Returns 0 if an invalid configuration is detected.
Note
This function is marked as constexpr and can be evaluated at compile time.

Definition at line 177 of file processing.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getOutputPins()

uint16_t getOutputPins ( )
constexpr

Retrieves the output pins configuration.

This function determines which pins are configured as output pins based on the current hardware setup. It ensures that no pin is configured multiple times and handles special cases like the watchdog pin.

Returns
A 16-bit value representing the configured output pins. Returns 0 if an invalid configuration is detected.
Note
This function is marked as constexpr and can be evaluated at compile time.

Definition at line 126 of file processing.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initializeArray()

template<size_t N>
void initializeArray ( int32_t(&) array[N],
int32_t value )
constexpr

Initializes all elements of a given array to a specified value.

This function is a compile-time constant expression (constexpr) that allows initializing arrays of any size with a specific value. It is particularly useful in embedded systems where predictable initialization is required.

Template Parameters
NThe size of the array (deduced automatically).
Parameters
arrayA reference to the array to be initialized.
valueThe value to assign to each element of the array.
Note
The function can be evaluated at compile time if all inputs are known at compile time.

Definition at line 104 of file processing.cpp.

Here is the caller graph for this function:

◆ initializeProcessing()

void initializeProcessing ( )

Initializes the processing engine, including ports, load states, and ADC setup.

This function performs the following tasks:

  • Initializes the DC offset array for voltage samples.
  • Configures the input and output pins based on the hardware setup.
  • Sets up the ADC in free-running mode with interrupts enabled.
  • Prepares the system for processing energy and load states.
Note
This function must be called during system initialization to ensure proper operation.

Definition at line 229 of file processing.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printConfiguration()

void printConfiguration ( )
inline

Print the configuration during startup.

This function outputs the system configuration to the Serial output during startup. It includes details about the sketch, build information, electrical settings, and enabled features.

  • Prints the sketch ID, branch name, commit hash, and build date/time.
  • Outputs electrical settings such as power calibration, voltage calibration, and phase calibration.
  • Displays enabled features like temperature sensing, dual tariff, load rotation, relay diversion, and RF communication.
  • Logs the selected datalogging format (Human-readable, IoT, or EmonCMS).

Definition at line 46 of file utils.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup()

void setup ( )

Called once during startup.

This function initializes the system, configures pins, and prints system configuration to the Serial Monitor. It also initializes optional features like temperature sensing and load priorities.

  • Delays startup to allow time to open the Serial Monitor.
  • Initializes the Serial interface and debug port.
  • Displays configuration information.
  • Initializes all loads to OFF at startup.
  • Logs load priorities and initializes temperature sensors if present.
  • Prints available free RAM for debugging purposes.

Definition at line 295 of file main.cpp.

Here is the call graph for this function: