Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Functions | Variables
lampda Namespace Reference

Program scope. More...

Namespaces

namespace  bsp
 Board Support Layer, handle the low level logic above the HAL.
 
namespace  common
 Shared interfaces & general utilities.
 
namespace  component
 Medium level logic, above BSP.
 
namespace  driver
 Specific component driver logic.
 
namespace  hal
 Hardware Abstraction Layer, handle the platform specific interactions. Can be changed to support different platforms.
 
namespace  logic
 Handle the main high level logics.
 
namespace  modes
 Contains basic interface types to implement custom user modes.
 
namespace  physical_constants
 Define the board and hardware physical constants.
 
namespace  user
 Contains code handling custom user mode functions for indexable strips.
 
namespace  utils
 Utility function and classes.
 

Classes

class  CEveryNMillis
 define time routines More...
 
union  COLOR
 Use this to convert color to bytes. More...
 
struct  is_power_of_two
 

Typedefs

using byte = uint8_t
 
using brightness_t = uint16_t
 Define the type of the brightness parameters.
 

Functions

void secondary_thread ()
 
void check_loop_runtime (const uint32_t runTime)
 
void main_setup ()
 Setup of the program, call once on systel start.
 
void regulate_loop_runtime (const uint32_t addedDelay)
 
void main_loop (const uint32_t addedDelay)
 Run the main program loop.
 
bool is_cell_voltage_valid (const uint16_t cellVoltage_mv)
 check battery cell voltage against min/max limits
 
template<typename N >
static constexpr N min (const N a, const N b)
 Minimum of two numbers.
 
template<typename N >
static constexpr N max (const N a, const N b)
 Maximum of two numbers.
 
template<typename N >
static constexpr N abs (const N a)
 absolute of a number
 
template<typename T >
static constexpr T lmpd_constrain (const T &a, const T &mini, const T &maxi)
 Constrain a number between two numbers.
 
template<typename T = float>
static T lmpd_map (float x, const float in_min, const float in_max, const float out_min, const float out_max)
 Linearly interpolate a number between two numbers.
 
static constexpr float to_radians (float degrees)
 Convert an angle in degrees to an angle in radians.
 
static constexpr float wrap_angle (const float angle_rad)
 Wrap an angle in radians between 0 and 2*PI.
 

Variables

static constexpr size_t stripNbBuffers = 3
 
static constexpr float baseCurrentConsumption = 0.4f
 
static constexpr float maxCurrentConsumption = 2.7f - baseCurrentConsumption
 
static constexpr float ampPerLed = maxCurrentConsumption / (float)LED_COUNT
 
static constexpr uint8_t BASE_SOFTWARE_VERSION_MAJOR = 1
 Base major software version, common to all systems. increment for every release.
 
static constexpr uint8_t BASE_SOFTWARE_VERSION_MINOR = 9
 Base minor software version, common to all systems. increment for every release.
 
static constexpr uint8_t ADC_RES_EXP = 12
 resolution of the ADC, in bits (can be 8, 10, 12 or 14)
 
static const uint32_t ADC_MAX_VALUE = static_cast<uint32_t>(pow(2, ADC_RES_EXP))
 corresponding ADC max value
 
static constexpr float internalReferenceVoltage = 3.0f
 internal voltage reference
 
static constexpr uint8_t USER_WATCHDOG_ID = 0
 user thread watchdog
 
static constexpr uint8_t POWER_WATCHDOG_ID = 2
 power thread watchdog
 
static constexpr bool usermodeDefaultsToLockdown = false
 
static constexpr float c_PI = 3.1415926535897f
 PI constant.
 
static constexpr float c_TWO_PI = 6.2831853071795f
 2*PI constant
 
static constexpr float c_HALF_PI = 1.5707963267948f
 PI/2 constant.
 
static constexpr float c_degreesToRadians = c_PI / 180.0f
 convert degrees to radians
 
static constexpr uint8_t USER_SOFTWARE_VERSION_MAJOR = 1
 
static constexpr uint8_t USER_SOFTWARE_VERSION_MINOR = 10
 
static constexpr uint32_t MAIN_LOOP_UPDATE_PERIOD_MS = static_cast<uint32_t>(1000 / 80.0f)
 
static constexpr float consWattByMeter = 12
 
static constexpr uint16_t stripInputMinVoltage_mV = 9400
 
static constexpr uint16_t stripInputMaxVoltage_mV = 12000
 
static constexpr float ledStripLength_mm = 91.0f * 25.0f
 
static constexpr float circuitToLedZeroRotationX_degrees = 0.0f
 
static constexpr float circuitToLedZeroRotationY_degrees = 0.0f
 
static constexpr float circuitToLedZeroRotationZ_degrees = 88.0f
 
static constexpr float lampBodyRadius_mm = 25
 
static constexpr uint16_t LED_COUNT = 870
 
static constexpr float ledByMeter = 244
 
static constexpr float ledStripWidth_mm = 5.2f
 
static constexpr float ledStripHeigh_mm = 0.7f
 
static constexpr uint8_t minimumAllowedBrightness_8 = 3
 
static constexpr float ledSize_mm = 1000.0f / ledByMeter
 
static constexpr float lampBodyCircumpherence_mm = c_TWO_PI * lampBodyRadius_mm
 
static constexpr float ledPerTurn = lampBodyCircumpherence_mm / ledSize_mm
 
static constexpr float lampHeight = ledStripWidth_mm * LED_COUNT / ledPerTurn
 
static constexpr float stripXCoordinates = lampBodyCircumpherence_mm / ledSize_mm
 
static constexpr float stripYCoordinates = ledStripLength_mm / lampBodyCircumpherence_mm
 
static constexpr float lampBodyHeight_mm = stripYCoordinates * ledStripWidth_mm
 
constexpr uint16_t stripMatrixWidth = ceil(stripXCoordinates)
 
constexpr uint16_t stripMatrixHeight = ceil(stripYCoordinates)
 

Detailed Description

Program scope.

Function Documentation

◆ is_cell_voltage_valid()

bool lampda::is_cell_voltage_valid ( const uint16_t  cellVoltage_mv)
inline

check battery cell voltage against min/max limits

Parameters
[in]cellVoltage_mvVoltage to check

◆ lmpd_constrain()

template<typename T >
static constexpr T lampda::lmpd_constrain ( const T &  a,
const T &  mini,
const T &  maxi 
)
staticconstexpr

Constrain a number between two numbers.

Parameters
[in]aNumber to constrain
[in]miniminimum bound
[in]maximaximum bound
Returns
the input number, constraint between mini & maxi

◆ lmpd_map()

template<typename T = float>
static T lampda::lmpd_map ( float  x,
const float  in_min,
const float  in_max,
const float  out_min,
const float  out_max 
)
inlinestatic

Linearly interpolate a number between two numbers.

Parameters
[in]xNumber to map
[in]in_minlower bound of the input number
[in]in_maxhigher bound of the input number
[in]out_minlower bound of the output number
[in]out_maxhigher bound of the output number
Returns
the input number, mapped between out_min & out_max

◆ main_loop()

void lampda::main_loop ( const uint32_t  addedDelay = 0)

Run the main program loop.

Main loop of the program.

Parameters
[in]addedDelayDebug tool: adds delay to the loop to test errors