Index: firmware/App/Drivers/GPIO.c =================================================================== diff -u -r9ed40798a5f4779db8a07bb6e256f7de99660108 -rf66ffb2807dae4ad719d41520bc8c3739210bfd0 --- firmware/App/Drivers/GPIO.c (.../GPIO.c) (revision 9ed40798a5f4779db8a07bb6e256f7de99660108) +++ firmware/App/Drivers/GPIO.c (.../GPIO.c) (revision f66ffb2807dae4ad719d41520bc8c3739210bfd0) @@ -31,6 +31,9 @@ #define WD_PET_GIO_PORT_PIN 1U ///< Watchdog pet GPIO pin number. #define WD_EXP_GIO_PORT_PIN 0U ///< Watchdog expired GPIO pin number. +#define GPIO_AC_SWITCH_MASK 0x10U ///< AC switch status bit mask (concentrate cap switch per HDD). +#define GPIO_LEAK_SENSOR_MASK 0x04U ///< Leak sensor status bit mask (per HDD - update if different). + #define GET_WD_EXP() ( PIN_SIGNAL_STATE_T )( gioGetBit( gioPORTB, WD_EXP_GIO_PORT_PIN ) ) ///< Get watchdog expired pin state macro. #define TGL_WD_PET() gioToggleBit( gioPORTB, WD_PET_GIO_PORT_PIN ) ///< Macro to toggle watchdog pet signal state. @@ -95,7 +98,7 @@ * @brief * The getGPIOStatusFromFPGA function returns the latest GPIO status register * value reported by the DD FPGA. - * @details \b Inputs: fpgaSensorReadings.fpgaGPIOStatus + * @details \b Inputs: fpgaSensorReadings.fpgaGPIOStatus (via FpgaDD service) * @details \b Outputs: none * @return GPIO status register value (bit-mapped per HDD definition) *************************************************************************/ @@ -104,4 +107,37 @@ return getFPGAGPIOStatus(); } +/*********************************************************************//** + * @brief + * The getACSwitchStatus function returns the AC switch (concentrate cap + * switch) status from the FPGA GPIO register. + * @details \b Inputs: fpgaSensorReadings.fpgaGPIOStatus (via getGPIOStatusFromFPGA) + * @details \b Outputs: none + * @return TRUE if AC switch is asserted, FALSE otherwise + *************************************************************************/ +BOOL getACSwitchStatus( void ) +{ + U08 gpioStatus = getGPIOStatusFromFPGA(); + BOOL isAsserted = ( ( gpioStatus & GPIO_AC_SWITCH_MASK ) != 0U ) ? TRUE : FALSE; + + return isAsserted; +} + +/*********************************************************************//** + * @brief + * The getLeakSensorStatus function returns the leak sensor status from the + * FPGA GPIO register. Application code should trigger an alarm when + * LEAK_SENSOR_DETECTED is returned (e.g. in a monitor task). + * @details \b Inputs: fpgaSensorReadings.fpgaGPIOStatus (via getGPIOStatusFromFPGA) + * @details \b Outputs: none + * @return LEAK_SENSOR_NOT_DETECTED or LEAK_SENSOR_DETECTED + *************************************************************************/ +LEAK_SENSOR_STATUS_T getLeakSensorStatus( void ) +{ + U08 gpioStatus = getGPIOStatusFromFPGA(); + LEAK_SENSOR_STATUS_T status = ( ( gpioStatus & GPIO_LEAK_SENSOR_MASK ) != 0U ) ? LEAK_SENSOR_DETECTED : LEAK_SENSOR_NOT_DETECTED; + + return status; +} + /**@}*/