Index: firmware/App/Services/FPGA.c =================================================================== diff -u -r7611b3a8e323b688441c88f56aa114d292efd4e1 -r8466e63f95f65a3ffb18c3af85ac99328e41167b --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision 7611b3a8e323b688441c88f56aa114d292efd4e1) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 8466e63f95f65a3ffb18c3af85ac99328e41167b) @@ -23,6 +23,7 @@ #include "Comm.h" #include "Compatible.h" #include "FPGA.h" +#include "PersistentAlarm.h" #include "SystemCommMessages.h" #include "Utilities.h" @@ -110,6 +111,9 @@ #define FPGA_BACKUP_ALARM_AUDIO_CONVERT 0.4 ///< Converts backup (piezo) alarm audio ADC volts to amps. +#define FRONT_DOOR_SWITCH_MASK 0x0010 ///< Front door switch bit mask. Bit 4 of the GPIO register. +#define PUMP_TRACK_SWITCH_MASK 0x0020 ///< Pump track switch bit mask. Bit 5 of the GPIO register. + // FPGA Sensors Record #pragma pack(push,1) /// Record structure for FPGA header read. @@ -321,6 +325,7 @@ static void startDMAReceiptOfReadResp( void ); static void consumeUnexpectedData( void ); +static void monitorFPGAPowerStatus( void ); /*********************************************************************//** * @brief @@ -557,6 +562,9 @@ // Reset comm flags after processing incoming responses resetFPGACommFlags(); + + // Monitor the power status + monitorFPGAPowerStatus(); } /*********************************************************************//** @@ -940,6 +948,18 @@ /*********************************************************************//** * @brief + * The monitorFPGAPowerStatus function monitors the status of the FPGA power source. + * @details Inputs: none + * @details Outputs: none + * @return none + *************************************************************************/ +static void monitorFPGAPowerStatus( void ) +{ + // TOD fill up. Figure out the status of the power source from FPGA from NOE and Kai. +} + +/*********************************************************************//** + * @brief * The setupDMAForWriteCmd function sets the byte count for the next DMA * write command to the FPGA. * @details Inputs: none @@ -1858,6 +1878,18 @@ /*********************************************************************//** * @brief + * The getFPGATimerCount function gets the latest FPGA timer millisecond count. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return last FPGA timer count + *************************************************************************/ +U16 getFPGATimerCount( void ) +{ + return fpgaSensorReadings.fpgaTimerCount_ms; +} + +/*********************************************************************//** + * @brief * The getFPGAAccelAxes function gets the accelerometer axis readings. * Axis readings are in ADC counts. 0.004 g per LSB. * @details Inputs: fpgaSensorReadings @@ -2395,6 +2427,32 @@ return fpgaSensorReadings.VBACurrent; } +/*********************************************************************//** + * @brief + * The getFPGAFrontDoorStatus function returns the FPGA front door status + * bit. + * @details Inputs: none + * @details Outputs: fpgaSensorReadings + * @return front door FPGA status bit + *************************************************************************/ +U16 getFPGAFrontDoorStatus( void ) +{ + return ( fpgaSensorReadings.fpgaGPIO & FRONT_DOOR_SWITCH_MASK ); +} + +/*********************************************************************//** + * @brief + * The getFPGAPumpTrackSwitchStatus function returns the FPGA pump track + * switch status bit. + * @details Inputs: none + * @details Outputs: fpgaSensorReadings + * @return pump track switch FPGA status bit + *************************************************************************/ +U16 getFPGAPumpTrackSwitchStatus( void ) +{ + return ( fpgaSensorReadings.fpgaGPIO & PUMP_TRACK_SWITCH_MASK ); +} + #ifdef DEBUG_ENABLED /*********************************************************************//** * @brief