...
Each LED is controlled by two bits, according to the documentation of the IO Expander CAT9532-D. This function clears and sets the selected bits
...
The function irj45_setLedState
or goal_maLedSet
clears the selected bits from the defined LED offset and, if state == GOAL_TRUE
, enables the LED.
Code Block |
---|
/**< LEDs definition for Arduino adapter board */ #define GOAL_MA_LED_LED1_RED (0) #define GOAL_MA_LED_LED1_GREEN (2) #define GOAL_MA_LED_LED2_RED (4) #define GOAL_MA_LED_LED2_GREEN (6) #define GOAL_MA_LED_ETHERCAT (8) #define GOAL_MA_LED_PROFINET (10) #define GOAL_MA_LED_MODBUS (12) #define GOAL_MA_LED_ETHERNETIP (14) #define GOAL_MA_LED_CANOPEN (16) |
Code Block |
---|
void irj45_setLedState(
uint32_t *pLedStates, /**< pointer where led states are stored */
uint32_t led, /**< the LED to set */
GOAL_BOOL_T state /**< the new state of the LED */
)
{
/* unset two bits of selected LEDs */
*(pLedStates) &= ~(3UL << led);
if (state == GOAL_TRUE) {
*(pLedStates) |= (1UL << led);
}
} |
...