/************************************************************************************
 * This file was auto-generated by CIDEA                           .                *
 * Please do not modify the contents of this file manually.                         *
 ***********************************************************************************/

#ifndef __COMMON2_H
#define __COMMON2_H

#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>

#include "types.h"

#ifdef __cplusplus
extern "C" {
#endif

/***************************************************************************//**
* @addtogroup CubeComponents
* @{
******************************************************************************/

/***************************************************************************//**
* @addtogroup CubeComputer4Common
* @brief CubeComputer4 Commmon Interface API
* @{
******************************************************************************/

/// CubeComputer4Common Telemetry enumeration
typedef enum {
    BlockChecksum = 246, ///< File upload Block CRC16 Checksum
    BootIndexStatus = 130, ///< Current selected boot index and status of last boot
    Cache = 131, ///< Cache enabled state
    CommsStatus = 144, ///< Communication status - includes command and telemetry counters and error flags
    DownloadBlockReady = 242, ///< Status about download block preparation
    EdacErrors = 143, ///< EDAC Error Counters
    ExtendedIdentification = 129, ///< Boot And Running Program Status
    FileDownload = 241, ///< File Download buffer 20-byte packet
    FileInfo = 243, ///< File Information
    HoleMap1 = 247, ///< File Upload Hole Map 1
    HoleMap2 = 248, ///< File Upload Hole Map 2
    HoleMap3 = 249, ///< File Upload Hole Map 3
    HoleMap4 = 250, ///< File Upload Hole Map 4
    HoleMap5 = 251, ///< File Upload Hole Map 5
    HoleMap6 = 252, ///< File Upload Hole Map 6
    HoleMap7 = 253, ///< File Upload Hole Map 7
    HoleMap8 = 254, ///< File Upload Hole Map 8
    Identification = 128, ///< Identification information for this node
    InitializeUploadComplete = 244, ///< Initialize Upload Complete
    LastLogEvent = 141, ///< Last Logged Event (relative to pointer - adjusted via Advance and Reset TCs (3 & 4)
    LatchupErrors = 142, ///< SRAM Latchup counters
    SdProgress = 234, ///< SD card format or erase progress
    SramScrubSettings = 134, ///< SRAM scrubbing size
    TelecommandAcknowledge = 240, ///< Telemetry frame with acknowledge status of the previously sent command
    UnixTime = 140, ///< Current Unix Time
    UnixTimeSave = 145, ///< Configuration settings for Unix time flash memory persistence
    UploadBlockComplete = 245, ///< Finalize Upload Block Complete
} COMMON_Telemetry_t; 

/// BootCause enumeration
typedef enum {
    BootCause_Unexpected = 0, ///< Unexpected reset
    BootCause_TrxuvI2cError = 1, ///< Not Used
    BootCause_CommsTimeout = 2, ///< Timeout due to lack of communications
    BootCause_CommandedMcuReset = 3, ///< Software commanded MCU reset
    BootCause_CommandedEpsReset = 4, ///< Not Used
    BootCause_SramLatchup = 5, ///< Latchup detected in SRAM
} COMMON_BootCause_t;

/// BootProgramsList enumeration
typedef enum {
    BootProgramsList_RunInternalFlashProgram = 1, ///< Internal Flash Program
    BootProgramsList_RunBootloader = 2, ///< Bootloader
} COMMON_BootProgramsList_t;

/// BootStatus enumeration
typedef enum {
    BootStatus_BootNew = 0, ///< New Selection
    BootStatus_BootSuccess = 1, ///< Boot Success
    BootStatus_BootTry1 = 2, ///< 1 Failed boot attempt
    BootStatus_BootTry2 = 3, ///< 2 Failed boot attempts
    BootStatus_BootFail = 4, ///< 3 Failed boot attempts
} COMMON_BootStatus_t;

/// FileType enumeration
typedef enum {
    FileType_TlmLog = 2, ///< Telemetry Log File
    FileType_JpgImg = 3, ///< JPG Image File
    FileType_BmpImg = 4, ///< BMP Image File
    FileType_IndexFile = 15, ///< Index File
} COMMON_FileType_t;

/// FileUploadDestination enumeration
typedef enum {
    FileUploadDestination_UlEeprom = 2, ///< EEPROM
    FileUploadDestination_UlFlash1 = 3, ///< Flash program 1
    FileUploadDestination_UlFlash2 = 4, ///< Flash program 2
    FileUploadDestination_UlFlash3 = 5, ///< Flash program 3
    FileUploadDestination_UlFlash4 = 6, ///< Flash program 4
    FileUploadDestination_UlFlash5 = 7, ///< Flash program 5
    FileUploadDestination_UlFlash6 = 8, ///< Flash program 6
    FileUploadDestination_UlFlash7 = 9, ///< Flash program 7
    FileUploadDestination_UlSdUser1 = 10, ///< SD User file 1
    FileUploadDestination_UlSdUser2 = 11, ///< SD User file 2
    FileUploadDestination_UlSdUser3 = 12, ///< SD User file 3
    FileUploadDestination_UlSdUser4 = 13, ///< SD User file 4
    FileUploadDestination_UlSdUser5 = 14, ///< SD User file 5
    FileUploadDestination_UlSdUser6 = 15, ///< SD User file 6
    FileUploadDestination_UlSdUser7 = 16, ///< SD User file 7
    FileUploadDestination_UlSdUser8 = 17, ///< SD User file 8
} COMMON_FileUploadDestination_t;

/// ResetCause enumeration
typedef enum {
    ResetCause_PowerOnReset = 0, ///< Power-On Reset
    ResetCause_BrownOutRegulated = 1, ///< Brown-Out Detected on Regulated Power
    ResetCause_BrownOutUnregulated = 2, ///< Brown-Out Detected on Unregulated Power
    ResetCause_ExternalWatchdog = 3, ///< External Watchdog Reset
    ResetCause_ExternalReset = 4, ///< External Reset
    ResetCause_WatchdogReset = 5, ///< Watchdog Reset
    ResetCause_LockupSystemReset = 6, ///< Lockup System Reset
    ResetCause_LockupReset = 7, ///< Lockup Reset
    ResetCause_SystemReqReset = 8, ///< System Request Reset
    ResetCause_BackupBrownOut = 9, ///< Backup domain brown-out reset
    ResetCause_BackupModeRst = 10, ///< Backup mode reset
    ResetCause_BackupModeRST_BackupBrownOutVddRegulated = 11, ///< Backup Mode reset and Backup domain brown-out on VDD regulated
    ResetCause_BackupModeRST_BackupBrownOutVddRegulated_BrownOutRegulated = 12, ///< Backup Mode reset and Backup domain brown-out on VDD regulated and brown out on regulated
    ResetCause_BackupModeRST_WatchdogReset = 13, ///< Backup mode reset and Watchdog reset
    ResetCause_BackupBrownOutBuvin_SystemReqReset = 14, ///< Backup Domain brown-out on BUVIN and System request reset.
    ResetCause_Unknown = 15, ///< Unkown Reset Cause
} COMMON_ResetCause_t;

/// SramBank enumeration
typedef enum {
    SramBank_Sram1 = 1, ///< SRAM bank 1
    SramBank_Sram2 = 2, ///< SRAM bank 2
} COMMON_SramBank_t;

/// TcErrorReason enumeration
typedef enum {
    TcErrorReason_NoError = 0, ///< No error
    TcErrorReason_InvalidTc = 1, ///< Invalid telecommand ID
    TcErrorReason_IncorrectLen = 2, ///< Incorrect TC parameter length
    TcErrorReason_IncorrectParams = 3, ///< Incorrect TC parameter value
    TcErrorReason_CrcError = 4, ///< CRC check failed
} COMMON_TcErrorReason_t;

/*******************************************************************************
 *******************************   STRUCTS   ***********************************
 ******************************************************************************/

/**
 * @brief NodeDef Information Structure
 * @details Contains NodeDef-specific Information
 */
typedef struct  {
    U8 nodeTypeId;
    U8 interfaceVersion;
} COMMON_NodeDefInfo_t;

/**
 * @brief Boot Index and Status message structure
 * @details Current selected boot index and status of last boot
 */
typedef struct  {
    COMMON_BootProgramsList_t programIndex;    /**< Program Index  */
    COMMON_BootStatus_t bootStatus;            /**< Boot Status  */
} COMMON_BootIndexStatus_t;

/**
 * @brief Communication Status message structure
 * @details Communication status - includes command and telemetry counters and error flags
 */
typedef struct  {
    U16 tcCounter;                /**< No. of telecommands received  */
    U16 tlmCounter;               /**< No. of telemetry requests received  */
    Boolean uartBufferOverrun;    /**< TC buffer was overrun while receiving a telecommand  */
    Boolean uartProtocolError;    /**< UART protocol error occurred  */
    Boolean uartMsgIncomplete;    /**< UART start-of-message identifier was received without a preceding end-of-message  */
    Boolean i2CTelemetryError;    /**< Number of data clocked out was more than telemetry package  */
    Boolean i2CBufferError;       /**< Telecommand sent exceeds buffer size  */
    Boolean cANBufferError;       /**< Telecommand sent exceeds buffer size  */
} COMMON_CommsStatus_t;

/**
 * @brief Download Block Ready message structure
 * @details Status about download block preparation
 */
typedef struct  {
    Boolean ready;             /**< Ready  */
    Boolean parameterError;    /**< The combination of message length and hole map resulted in invalid array lengths  */
    U16 checksum;              /**< Block CRC16 Checksum  */
    U16 length;                /**< Block length  */
} COMMON_DownloadBlockReady_t;

/**
 * @brief Initiate Download Burst message structure
 * @details Initiate Download Burst
 */
typedef struct  {
    U8 messageLength;         /**< Message Length  */
    Boolean ignoreHoleMap;    /**< Ignore Hole Map  */
} COMMON_DownloadBurst_t;

/**
 * @brief EDAC Error Counters message structure
 * @details EDAC Error Counters
 */
typedef struct  {
    U16 singleSRAMSEUs;    /**< The number of single SRAM upsets (per byte) detected  */
    U16 doubleSRAMSEUs;    /**< The number of double SRAM upsets (per byte) detected  */
    U16 multiSRAMSEUs;     /**< The number of multiple SRAM upsets (per byte) detected  */
} COMMON_EdacErrors_t;

/**
 * @brief Erase File message structure
 * @details Erase File
 */
typedef struct  {
    COMMON_FileType_t fileType;    /**< File Type  */
    U8 fileCtr;                    /**< File Counter  */
    Boolean eraseAll;              /**< Erase All  */
} COMMON_EraseFile_t;

/**
 * @brief Boot And Running Program Status message structure
 * @details Boot And Running Program Status
 */
typedef struct  {
    COMMON_ResetCause_t mcuResetCause;                /**< Cause of MCU reset  */
    COMMON_BootCause_t bootCause;                     /**< Cause of last reboot  */
    U16 bootCounter;                                  /**< Number of times CubeComputer has booted  */
    COMMON_BootProgramsList_t runningProgramIndex;    /**< Location of program that is currently running  */
    U8 firmwareMajorVersion;                          /**< Firmware version (Major)  */
    U8 firmwareMinorVersion;                          /**< Firmware version (Minor)  */
} COMMON_ExtendedIdentification_t;

/**
 * @brief File Download Buffer with File Contents message structure
 * @details File Download buffer 20-byte packet
 */
typedef struct  {
    U16 packetNo;        /**< Packet counter of this file download packet  */
    U8 fileBytes[20];    /**< File 20-byte packet  */
} COMMON_FileDownload_t;

/**
 * @brief File Information message structure
 * @details File Information
 */
typedef struct  {
    COMMON_FileType_t fileType;    /**< File Type  */
    Boolean busyUpdating;          /**< Busy Updating  */
    U8 fileCtr;                    /**< File Counter  */
    U32 size;                      /**< File Size  */
    U32 unixTime;                  /**< File Date and Time (in MS-DOS format)  (measurment unit is [s]) */
    U16 checksum;                  /**< File CRC16 Checksum  */
} COMMON_FileInfo_t;

/**
 * @brief File Upload Packet message structure
 * @details File Upload Packet
 */
typedef struct  {
    U16 packetNo;        /**< Packet Number  */
    U8 fileBytes[20];    /**< File Bytes  */
} COMMON_FileUpload_t;

/**
 * @brief Finalize Upload Block message structure
 * @details Finalize Uploaded File Block
 */
typedef struct  {
    COMMON_FileUploadDestination_t destination;    /**< Destination  */
    U32 offset;                                    /**< Offset into file  */
    U16 blockLen;                                  /**< Length of block   */
} COMMON_FinalizeUploadBlock_t;

/**
 * @brief Identification message structure
 * @details Identification information for this node
 */
typedef struct  {
    U8 nodeType;                /**< Node type identifier.  */
    U8 interfaceVersion;        /**< Interface version. This field should have a value of 1  */
    U8 firmwareMajorVersion;    /**< Firmware version (Major)  */
    U8 firmwareMinorVersion;    /**< Firmware version (Minor)  */
    U16 runtimeSeconds;         /**< Number of seconds since processor start-up  */
    U16 runtimeMilliseconds;    /**< Number of milliseconds (after the integer second) since processor start-up  */
} COMMON_Identification_t;

/**
 * @brief Initiate File Upload message structure
 * @details Initiate File Upload
 */
typedef struct  {
    COMMON_FileUploadDestination_t destination;    /**< Destination  */
    U8 blockSize;                                  /**< Block Size  */
} COMMON_InitiateFileUpload_t;

/**
 * @brief Last Logged Event message structure
 * @details Last Logged Event (relative to pointer - adjusted via Advance and Reset TCs (3 & 4)
 */
typedef struct  {
    U32 unixTime;     /**< Time of Event  */
    U8 eventId;       /**< Event ID  */
    U8 eventParam;    /**< Event Parameter  */
} COMMON_LastLogEvent_t;

/**
 * @brief SRAM Latchup counters message structure
 * @details SRAM Latchup counters
 */
typedef struct  {
    U16 sRAM1SELs;    /**< The number of SRAM1 latchups detected  */
    U16 sRAM2SELs;    /**< The number of SRAM2 latchups detected  */
} COMMON_LatchupErrors_t;

/**
 * @brief Load File Download Block message structure
 * @details Fill download buffer with file contents
 */
typedef struct  {
    COMMON_FileType_t fileType;    /**< File Type  */
    U8 counter;                    /**< Counter  */
    U32 offset;                    /**< Offset  */
    U16 length;                    /**< Block Length  */
} COMMON_LoadDownloadBlock_t;

/**
 * @brief SD card format/erase progress message structure
 * @details SD card format or erase progress
 */
typedef struct  {
    Boolean formatBusy;      /**< Busy formatting SD card  */
    Boolean eraseAllBusy;    /**< Busy formatting erasing all SD files  */
} COMMON_SdProgress_t;

/**
 * @brief Telecommand Acknowledge message structure
 * @details Telemetry frame with acknowledge status of the previously sent command
 */
typedef struct  {
    U8 lastTCID;                              /**< ID of last received TC  */
    Boolean processedFlag;                    /**< Flag to indicate if the last TC has been processed.  */
    COMMON_TcErrorReason_t tCerrorStatus ;    /**< Status of last processed telecommand  */
    U8 tCParameterErrorIndex;                 /**< Index of incorrect TC parameter  */
} COMMON_TelecommandAcknowledge_t;

/**
 * @brief Current Unix Time message structure
 * @details Current Unix Time
 */
typedef struct  {
    U32 time;        /**< Time in s since 01/01/1970, 00:00  (measurment unit is [s]) */
    U16 milliSec;    /**< Current millisecond count  (measurment unit is [ms]) */
} COMMON_UnixTime_t;

/**
 * @brief Unix Time Save to Flash message structure
 * @details Configuration settings for Unix time flash memory persistence
 */
typedef struct  {
    Boolean saveNow;         /**< Save current Unix time to flash memory  */
    Boolean saveOnUpdate;    /**< Save Unix time to flash memory whenever there is a command to update the Unix time  */
    Boolean savePeriodic;    /**< Save Unix time to flash memory periodically  */
    U8 period;               /**< Interval at which to save Unix time to flash memory  (measurment unit is [s]) */
} COMMON_UnixTimeSave_t;

/**
 * @brief Upload Block Complete message structure
 * @details Finalize Upload Block Complete
 */
typedef struct  {
    Boolean busy;     /**< Busy with block finalization  */
    Boolean error;    /**< Error in block finalization  */
} COMMON_UploadBlockComplete_t;


/*******************************************************************************
 *****************************   PROTOTYPES   **********************************
 ******************************************************************************/

/***************************************************************************//**
Return the expected length of a telemetry frame
 *
 * @param[in] tlm
 *   Enumeration of specified telemetry request
 * @return
 *   Returns the length of the telemetry frame in bytes
 ******************************************************************************/
uint16_t COMMON_GetTlmLen(COMMON_Telemetry_t tlm);

/***************************************************************************//**
 * Decode a Block  Checksum telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] checksum
 *   Pointer to a U16 in which the Checksum will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, checksum, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractBlockChecksumTlm(uint8_t* rxBuffer, U16* checksum);

/***************************************************************************//**
 * Decode a Boot Index and Status telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] returnVal
 *   Pointer to a COMMON_BootIndexStatus_t struct in which the telemetry will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, returnVal, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractBootIndexStatusTlm(uint8_t* rxBuffer, COMMON_BootIndexStatus_t* returnVal);

/***************************************************************************//**
 * Decode a Cache enabled state telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] enabled
 *   Pointer to a Boolean in which the Enabled state will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, enabled, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractCacheTlm(uint8_t* rxBuffer, Boolean* enabled);

/***************************************************************************//**
 * Decode a Communication Status telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] returnVal
 *   Pointer to a COMMON_CommsStatus_t struct in which the telemetry will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, returnVal, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractCommsStatusTlm(uint8_t* rxBuffer, COMMON_CommsStatus_t* returnVal);

/***************************************************************************//**
 * Decode a Download Block Ready telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] returnVal
 *   Pointer to a COMMON_DownloadBlockReady_t struct in which the telemetry will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, returnVal, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractDownloadBlockReadyTlm(uint8_t* rxBuffer, COMMON_DownloadBlockReady_t* returnVal);

/***************************************************************************//**
 * Decode a EDAC Error Counters telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] returnVal
 *   Pointer to a COMMON_EdacErrors_t struct in which the telemetry will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, returnVal, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractEdacErrorsTlm(uint8_t* rxBuffer, COMMON_EdacErrors_t* returnVal);

/***************************************************************************//**
 * Decode a Boot And Running Program Status telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] returnVal
 *   Pointer to a COMMON_ExtendedIdentification_t struct in which the telemetry will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, returnVal, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractExtendedIdentificationTlm(uint8_t* rxBuffer, COMMON_ExtendedIdentification_t* returnVal);

/***************************************************************************//**
 * Decode a File Download Buffer with File Contents telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] returnVal
 *   Pointer to a COMMON_FileDownload_t struct in which the telemetry will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, returnVal, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractFileDownloadTlm(uint8_t* rxBuffer, COMMON_FileDownload_t* returnVal);

/***************************************************************************//**
 * Decode a File Information telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] returnVal
 *   Pointer to a COMMON_FileInfo_t struct in which the telemetry will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, returnVal, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractFileInfoTlm(uint8_t* rxBuffer, COMMON_FileInfo_t* returnVal);

/***************************************************************************//**
 * Decode a Hole Map 1 telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] holeMap
 *   Pointer to a byte array in which the Hole Map will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, holeMap, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractHoleMap1Tlm(uint8_t* rxBuffer, uint8_t* holeMap);

/***************************************************************************//**
 * Decode a Hole Map 2 telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] holeMap
 *   Pointer to a byte array in which the Hole Map will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, holeMap, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractHoleMap2Tlm(uint8_t* rxBuffer, uint8_t* holeMap);

/***************************************************************************//**
 * Decode a Hole Map 3 telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] holeMap
 *   Pointer to a byte array in which the Hole Map will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, holeMap, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractHoleMap3Tlm(uint8_t* rxBuffer, uint8_t* holeMap);

/***************************************************************************//**
 * Decode a Hole Map 4 telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] holeMap
 *   Pointer to a byte array in which the Hole Map will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, holeMap, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractHoleMap4Tlm(uint8_t* rxBuffer, uint8_t* holeMap);

/***************************************************************************//**
 * Decode a Hole Map 5 telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] holeMap
 *   Pointer to a byte array in which the Hole Map will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, holeMap, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractHoleMap5Tlm(uint8_t* rxBuffer, uint8_t* holeMap);

/***************************************************************************//**
 * Decode a Hole Map 6 telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] holeMap
 *   Pointer to a byte array in which the Hole Map will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, holeMap, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractHoleMap6Tlm(uint8_t* rxBuffer, uint8_t* holeMap);

/***************************************************************************//**
 * Decode a Hole Map 7 telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] holeMap
 *   Pointer to a byte array in which the Hole Map will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, holeMap, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractHoleMap7Tlm(uint8_t* rxBuffer, uint8_t* holeMap);

/***************************************************************************//**
 * Decode a Hole Map 8 telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] holeMap
 *   Pointer to a byte array in which the Hole Map will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, holeMap, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractHoleMap8Tlm(uint8_t* rxBuffer, uint8_t* holeMap);

/***************************************************************************//**
 * Decode a Identification telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] returnVal
 *   Pointer to a COMMON_Identification_t struct in which the telemetry will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, returnVal, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractIdentificationTlm(uint8_t* rxBuffer, COMMON_Identification_t* returnVal);

/***************************************************************************//**
 * Decode a Initialize Upload Complete telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] busy
 *   Pointer to a Boolean in which the Busy will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, busy, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractInitializeUploadCompleteTlm(uint8_t* rxBuffer, Boolean* busy);

/***************************************************************************//**
 * Decode a Last Logged Event telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] returnVal
 *   Pointer to a COMMON_LastLogEvent_t struct in which the telemetry will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, returnVal, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractLastLogEventTlm(uint8_t* rxBuffer, COMMON_LastLogEvent_t* returnVal);

/***************************************************************************//**
 * Decode a SRAM Latchup counters telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] returnVal
 *   Pointer to a COMMON_LatchupErrors_t struct in which the telemetry will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, returnVal, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractLatchupErrorsTlm(uint8_t* rxBuffer, COMMON_LatchupErrors_t* returnVal);

/***************************************************************************//**
 * Decode a SD card format/erase progress telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] returnVal
 *   Pointer to a COMMON_SdProgress_t struct in which the telemetry will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, returnVal, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractSdProgressTlm(uint8_t* rxBuffer, COMMON_SdProgress_t* returnVal);

/***************************************************************************//**
 * Decode a SRAM Scrub Parameters telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] scrubSize
 *   Pointer to a U16 in which the Scrub Size will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, scrubSize, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractSramScrubSettingsTlm(uint8_t* rxBuffer, U16* scrubSize);

/***************************************************************************//**
 * Decode a Telecommand Acknowledge telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] returnVal
 *   Pointer to a COMMON_TelecommandAcknowledge_t struct in which the telemetry will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, returnVal, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractTelecommandAcknowledgeTlm(uint8_t* rxBuffer, COMMON_TelecommandAcknowledge_t* returnVal);

/***************************************************************************//**
 * Decode a Current Unix Time telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] returnVal
 *   Pointer to a COMMON_UnixTime_t struct in which the telemetry will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, returnVal, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractUnixTimeTlm(uint8_t* rxBuffer, COMMON_UnixTime_t* returnVal);

/***************************************************************************//**
 * Decode a Unix Time Save to Flash telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] returnVal
 *   Pointer to a COMMON_UnixTimeSave_t struct in which the telemetry will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, returnVal, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractUnixTimeSaveTlm(uint8_t* rxBuffer, COMMON_UnixTimeSave_t* returnVal);

/***************************************************************************//**
 * Decode a Upload Block Complete telemetry frame from the CubeComputer4 Commmon
 *
 * @param[in] rxBuffer
 *   Buffer containing raw bytes
 * @param[in] returnVal
 *   Pointer to a COMMON_UploadBlockComplete_t struct in which the telemetry will be returned.
 * @return
 *   Returns a value from the CUBEADCS_Result_t enumeration:
 *      CubeLibOk if the telemetry was decoded without error
 *      PointerIsNull if the input parameter, returnVal, was NULL
 ******************************************************************************/
CUBEADCS_Result_t COMMON_ExtractUploadBlockCompleteTlm(uint8_t* rxBuffer, COMMON_UploadBlockComplete_t* returnVal);

/***************************************************************************//**
 * Send a Advance File List Read Pointer command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 ******************************************************************************/
uint16_t COMMON_FormatAdvanceFileListPtrCmd(uint8_t* tcBuffer);

/***************************************************************************//**
 * Send a Advance Log Pointer command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 ******************************************************************************/
uint16_t COMMON_FormatAdvanceLogPtrCmd(uint8_t* tcBuffer);

/***************************************************************************//**
 * Send a Cache enabled state command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @param[in] enabled
 *   Enabled state
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 ******************************************************************************/
uint16_t COMMON_FormatCacheCmd(uint8_t* tcBuffer, Boolean enabled);

/***************************************************************************//**
 * Send a Initiate Download Burst command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @param[in] messageLength
 *   Message Length
 * @param[in] ignoreHoleMap
 *   Ignore Hole Map
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 ******************************************************************************/
uint16_t COMMON_FormatDownloadBurstCmd(uint8_t* tcBuffer, U8 messageLength, Boolean ignoreHoleMap);

/***************************************************************************//**
 * Send a Erase File command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @param[in] fileType
 *   File Type
 * @param[in] fileCtr
 *   File Counter
 * @param[in] eraseAll
 *   Erase All
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 *      TcInvalidParam if the input parameter, fileType, was not a valid COMMON_FileType_t enumeration
 ******************************************************************************/
uint16_t COMMON_FormatEraseFileCmd(uint8_t* tcBuffer, COMMON_FileType_t fileType, U8 fileCtr, Boolean eraseAll);

/***************************************************************************//**
 * Send a File Upload Packet command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @param[in] packetNo
 *   Packet Number
 * @param[in] fileBytes
 *   File Bytes
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 ******************************************************************************/
uint16_t COMMON_FormatFileUploadCmd(uint8_t* tcBuffer, U16 packetNo, U8* fileBytes);

/***************************************************************************//**
 * Send a Finalize Upload Block command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @param[in] destination
 *   Destination
 * @param[in] offset
 *   Offset into file
 * @param[in] blockLen
 *   Length of block 
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 *      TcInvalidParam if the input parameter, destination, was not a valid COMMON_FileUploadDestination_t enumeration
 ******************************************************************************/
uint16_t COMMON_FormatFinalizeUploadBlockCmd(uint8_t* tcBuffer, COMMON_FileUploadDestination_t destination, U32 offset, U16 blockLen);

/***************************************************************************//**
 * Send a Format SD card command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @param[in] formatMagic
 *   Magic number to prevent against accidental format. Has to be set to 90(0x5A)
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 ******************************************************************************/
uint16_t COMMON_FormatFormatSdCmd(uint8_t* tcBuffer, U8 formatMagic);

/***************************************************************************//**
 * Send a Hole Map 1 command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @param[in] holeMap
 *   Hole Map
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 ******************************************************************************/
uint16_t COMMON_FormatHoleMap1Cmd(uint8_t* tcBuffer, U8* holeMap);

/***************************************************************************//**
 * Send a Hole Map 2 command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @param[in] holeMap
 *   Hole Map
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 ******************************************************************************/
uint16_t COMMON_FormatHoleMap2Cmd(uint8_t* tcBuffer, U8* holeMap);

/***************************************************************************//**
 * Send a Hole Map 3 command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @param[in] holeMap
 *   Hole Map
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 ******************************************************************************/
uint16_t COMMON_FormatHoleMap3Cmd(uint8_t* tcBuffer, U8* holeMap);

/***************************************************************************//**
 * Send a Hole Map 4 command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @param[in] holeMap
 *   Hole Map
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 ******************************************************************************/
uint16_t COMMON_FormatHoleMap4Cmd(uint8_t* tcBuffer, U8* holeMap);

/***************************************************************************//**
 * Send a Hole Map 5 command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @param[in] holeMap
 *   Hole Map
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 ******************************************************************************/
uint16_t COMMON_FormatHoleMap5Cmd(uint8_t* tcBuffer, U8* holeMap);

/***************************************************************************//**
 * Send a Hole Map 6 command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @param[in] holeMap
 *   Hole Map
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 ******************************************************************************/
uint16_t COMMON_FormatHoleMap6Cmd(uint8_t* tcBuffer, U8* holeMap);

/***************************************************************************//**
 * Send a Hole Map 7 command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @param[in] holeMap
 *   Hole Map
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 ******************************************************************************/
uint16_t COMMON_FormatHoleMap7Cmd(uint8_t* tcBuffer, U8* holeMap);

/***************************************************************************//**
 * Send a Hole Map 8 command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @param[in] holeMap
 *   Hole Map
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 ******************************************************************************/
uint16_t COMMON_FormatHoleMap8Cmd(uint8_t* tcBuffer, U8* holeMap);

/***************************************************************************//**
 * Send a Initiate File Upload command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @param[in] destination
 *   Destination
 * @param[in] blockSize
 *   Block Size
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 *      TcInvalidParam if the input parameter, destination, was not a valid COMMON_FileUploadDestination_t enumeration
 ******************************************************************************/
uint16_t COMMON_FormatInitiateFileUploadCmd(uint8_t* tcBuffer, COMMON_FileUploadDestination_t destination, U8 blockSize);

/***************************************************************************//**
 * Send a Load File Download Block command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @param[in] fileType
 *   File Type
 * @param[in] counter
 *   Counter
 * @param[in] offset
 *   Offset
 * @param[in] length
 *   Block Length
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 *      TcInvalidParam if the input parameter, fileType, was not a valid COMMON_FileType_t enumeration
 ******************************************************************************/
uint16_t COMMON_FormatLoadDownloadBlockCmd(uint8_t* tcBuffer, COMMON_FileType_t fileType, U8 counter, U32 offset, U16 length);

/***************************************************************************//**
 * Send a Reset command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @param[in] magic
 *   Magic number to make sure it is a valid reset command. Should equal 0x5A
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 ******************************************************************************/
uint16_t COMMON_FormatResetCmd(uint8_t* tcBuffer, U8 magic);

/***************************************************************************//**
 * Send a Reset Boot Registers command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 ******************************************************************************/
uint16_t COMMON_FormatResetBootRegistersCmd(uint8_t* tcBuffer);

/***************************************************************************//**
 * Send a Reset File List Read Pointer command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 ******************************************************************************/
uint16_t COMMON_FormatResetFileListPtrCmd(uint8_t* tcBuffer);

/***************************************************************************//**
 * Send a Reset Log Pointer command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 ******************************************************************************/
uint16_t COMMON_FormatResetLogPtrCmd(uint8_t* tcBuffer);

/***************************************************************************//**
 * Send a Reset Upload Block command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 ******************************************************************************/
uint16_t COMMON_FormatResetUploadBlockCmd(uint8_t* tcBuffer);

/***************************************************************************//**
 * Send a SRAM Scrub Parameters command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @param[in] scrubSize
 *   Scrub Size
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 ******************************************************************************/
uint16_t COMMON_FormatSramScrubSettingsCmd(uint8_t* tcBuffer, U16 scrubSize);

/***************************************************************************//**
 * Send a Current Unix Time command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @param[in] time
 *   Time in s since 01/01/1970, 00:00
 *   (in [s] units)
 * @param[in] milliSec
 *   Current millisecond count
 *   (in [ms] units)
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 ******************************************************************************/
uint16_t COMMON_FormatUnixTimeCmd(uint8_t* tcBuffer, U32 time, U16 milliSec);

/***************************************************************************//**
 * Send a Unix Time Save to Flash command to the CubeComputer4 Commmon
 *
 * @param[in] nodeid
 *   identifier of the node on the communications bus
 * @param[in] saveNow
 *   Save current Unix time to flash memory
 * @param[in] saveOnUpdate
 *   Save Unix time to flash memory whenever there is a command to update the Unix time
 * @param[in] savePeriodic
 *   Save Unix time to flash memory periodically
 * @param[in] reserved
 *   
 * @param[in] period
 *   Interval at which to save Unix time to flash memory
 *   (in [s] units)
 * @return
 *   Returns a value from the uint16_t enumeration:
 *      CubeLibOk if the command was sent without error
 *      One of the I2C enumeration values in case of I2C communications error
 ******************************************************************************/
uint16_t COMMON_FormatUnixTimeSaveCmd(uint8_t* tcBuffer, Boolean saveNow, Boolean saveOnUpdate, Boolean savePeriodic, U8 period);


void print_array(uint8_t* data, uint16_t size);
void mfcc_adcs_tc_send(uint32_t tc_id, uint8_t *adcs_data, uint16_t tc_len);
void health_metric_print(uint8_t hm_id, uint8_t hm_buffer_cnt, uint8_t *hm_data);
#endif  // define __CUBECOMPUTER4COMMON2_H
