void in8R8_to_switch(uint8_t switch_id, uint8_t card_id, uint8_t card_channel){ if(IN8R8[card_id].IsValid()){ // on verifie d'abord que la com avec la carte est ok if (SWITCH[switch_id].update(IN8R8[card_id].inputIsSet(card_channel))) // si l'update renvoi une valeur >0 alors c'est qu'il y a eu un chgt switch_status(&SWITCH[switch_id], T_TRIG); //TRIG } }
/** * Check the status of the discrete card * @return 0 if card is off, 1 if card is on, -1 if not-switchable. */ int status_secondary(void) { switch (switch_status()) { case SWITCH_ON: return 1; case SWITCH_OFF: return 0; case SWITCH_UNAVAIL: default: return -1; } }
/********************************************************************* * @fn AT_ZCL_ONOFF_SWITCH_update * * @brief updata the Device Temperature Configuration Cluster every second * * @param none * * @return none * ************************************************************/ static void AT_ZCL_ONOFF_SWITCH_update(void){ uint8 sw = switch_status(); if(AT_ZCL_ONOFF_SWITCH_action != sw){ AT_ZCL_ONOFF_SWITCH_action=sw; afAddrType_t dstAddr; dstAddr.addrMode = afAddrNotPresent; if(AT_ZCL_ONOFF_SWITCH_action==ON_OFF_SWITCH_ACTIONS_0 ){ zclGeneral_SendOnOff_CmdOff(AT_ZCL_ONOFF_SWITCH_ENDPOINT,&dstAddr,1,1); }else{ zclGeneral_SendOnOff_CmdOn(AT_ZCL_ONOFF_SWITCH_ENDPOINT,&dstAddr,1,1); } } if(AT_ZCL_ONOFF_SWITCH_action==ON_OFF_SWITCH_ACTIONS_0) HalLedSet( HAL_LED_1, HAL_LED_MODE_OFF ); else HalLedSet( HAL_LED_1, HAL_LED_MODE_ON ); }
void in16_to_switch(uint8_t switch_id, uint8_t card_id, uint8_t card_channel){ if (SWITCH[switch_id].update(IN16[card_id].inputIsSet(card_channel))) // si l'update renvoi une valeur >0 alors c'est qu'il y a eu un chgt switch_status(&SWITCH[switch_id], T_TRIG); //TRIG }