Index: firmware/App/Controllers/Switches.c =================================================================== diff -u -r901c8ee0edeef9c09ff74f8f5866aa0277ef8f33 -r73c7fed62a1ca2e4c3cc020a0d5f012c5128e592 --- firmware/App/Controllers/Switches.c (.../Switches.c) (revision 901c8ee0edeef9c09ff74f8f5866aa0277ef8f33) +++ firmware/App/Controllers/Switches.c (.../Switches.c) (revision 73c7fed62a1ca2e4c3cc020a0d5f012c5128e592) @@ -13,9 +13,6 @@ // ********** private definitions ********** #define SWITCHES_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the switches data is published on the CAN bus. -#define FLUID_DOOR_SWITCH_BIT_MASK 0x08 ///< Fluid door switch bit mask. -#define DIALYSATE_CAP_SWITCH_BIT_MASK 0x10 ///< Dialysate cap switch bit mask. -#define CONCENTRATE_CAP_SWITCH_BIT_MASK 0x1A ///< Concentrate cap switch bit mask. #define SWITCHES_FPGA_STATUS_CHECK_INTERVAL ( MS_PER_SECOND / ( 5 * TASK_GENERAL_INTERVAL ) ) ///< Switches FPGA status check interval. // ********** private data ********** @@ -56,20 +53,18 @@ /*********************************************************************//** * @brief * The execSwitches function executes the switches executive. - * @details Inputs: switchStatus - * @details Outputs: switchStatus + * @details Inputs: switchesFPGAStatusCheckCounter + * @details Outputs: switchStatus, switchesFPGAStatusCheckCounter * @return none *************************************************************************/ void execSwitches( void ) { if ( ++switchesFPGAStatusCheckCounter > SWITCHES_FPGA_STATUS_CHECK_INTERVAL ) { - U08 fpgaRegister = getFPGAGPIOCount(); + switchStatus[ CONCENTRATE_CAP ].data = (U32)( getFPGAGFluidDoorStatus() != 0 ? OPEN : CLOSED); // TODO change the logic orientation? + switchStatus[ DIALYSATE_CAP ].data = (U32)( getFPGADialysateCapStatus() != 0 ? OPEN : CLOSED); + switchStatus[ FLUID_DOOR ].data = (U32)( getFPGAConcentrateCapStatus() != 0 ? OPEN : CLOSED); - switchStatus[ CONCENTRATE_CAP ].data = (U32)( fpgaRegister & CONCENTRATE_CAP_SWITCH_BIT_MASK > 0 ? OPEN : CLOSED); - switchStatus[ DIALYSATE_CAP ].data = (U32)( fpgaRegister & DIALYSATE_CAP_SWITCH_BIT_MASK > 0 ? OPEN : CLOSED); - switchStatus[ FLUID_DOOR ].data = (U32)( fpgaRegister & FLUID_DOOR_SWITCH_BIT_MASK > 0 ? OPEN : CLOSED); - switchesFPGAStatusCheckCounter = 0; } @@ -146,7 +141,11 @@ return result; } +/************************************************************************* + * TEST SUPPORT FUNCTIONS + *************************************************************************/ + /*********************************************************************//** * @brief * The testSetSwitchesDataPublishIntervalOverride function overrides @@ -221,11 +220,7 @@ return result; } -/************************************************************************* - * TEST SUPPORT FUNCTIONS - *************************************************************************/ - /*********************************************************************//** * @brief * The testResetSwitchesStatusOverride function resets the override