Root Folder

Board

The board folder contains a root board config file called "board.h". This file includes the specific board layout for this build, such as "board_16_h.h".

Each board definition needs to contain a full set of pin definitions, which are then referenced elsewhere in the code.

  • GREEN_LED
  • BLUE_LED
  • RED_LED
  • BUTTON_DEC
  • BUTTON_INC
  • PIN_PSOC_RX
  • PIN_PSOC_TX
  • CRADEL_LED

Certs

the certs folder contains 2 certs and a key

  • egymCA.crt:
    • Energym Root CA
    • used to authenticate MQTT server certificate when connecting to broker
    • can be used for authenticating HTTPS server for downloading OTA's if we move back to ESP driven ota's
  • esp.crt:
    • ESP32 identifying certificate
    • Signed by egymCA root certificate
    • used to authenticate ESP with MQTT server and OTA server on broker
  • esp.key:
    • private key for esp.crt

Main Globals

used to hold "true" globals that are used in multiple places in the codebase, currently just contains the global metrics and session variables, which contain the metrics and session data as synchronized with the PSOC.

Metadata

currently just contains the firmware version as a static definition in the header file.

versions must match the format: "vX.Y-S" where X, Y, are integers, and S is a freeform string. in total, the version string must be less than 15 characters long.

Utils

Miscelanious legacy librarys

crc16.c

Energym Specific CRC16 implementation, must exactly match the CRC16 implementation of PSOC so specified explicitly.

should be a direct implementation of CRC16-CCITT with polynomial 0x8005U and initial value 0x0000U, but compliance with the CRC16-CCITT standard is not guaranteed.

must be tested with the PSOC CRC16 implementation on any changes.

misc.c

holdover catchall, for now just contains boundi and boundf functions which bound an integer or float to a specified range.

Session

Leggacy session management, to be replaced.