CANopen Master Documentation
Version 6.06.04
|
The LED module supports two types of LEDs: a Module LED and a Network LED. The Module LED displays the state of the hardware, e.g. power supply, driver stage, etc. The Network LED displays the state of the CAN connection and the CANopen NMT state. Both LEDs should be bi-color LEDs. If not, the patterns for the blinking code may need to be adopted.
In the implementation, each LED gets two patterns - one for the red LED and one for the green LED (bi-color LED). Both patterns have a length of 32 bit. With a given default pattern shift rate of 50 ms (defined by the symbol COM_LED_PERIOD) the total pattern length can be 1,6 seconds.
Please note that this implementation is not fully compliant to DR-303-3.
The LED functionality is only compiled when the symbol COM_LED_SUPPORT (see com_conf.h) is set to a value greater 0.
The Network LED is autonomously run by the CANopen stack, i.e. no function has to be called by the user application. The following functions must be adopted to the target hardware for Network LED support:
The Module LED must be driven by the user application, i.e. you have to call the ComLedModuleStatus() function somewhere. The following functions must be adopted to the target hardware for Module LED support:
Macros | |
#define | COM_LED_PERIOD 50000 |
Enumerations | |
enum | ComLedMod_e { eCOM_LED_MOD_OK = 0 , eCOM_LED_MOD_FAIL_BAUD , eCOM_LED_MOD_FAIL_ADDR , eCOM_LED_MOD_RECOVER , eCOM_LED_MOD_APP1 , eCOM_LED_MOD_APP2 } |
enum | ComLedNet_e { eCOM_LED_NET_STOPPED = 0 , eCOM_LED_NET_PREOPERATIONAL , eCOM_LED_NET_OPERATIONAL , eCOM_LED_NET_INIT } |
enum | ComLedErr_e { } |
Functions | |
void | ComLedModRed (uint8_t ubNetV, bool_t btSwitchOnV) |
void | ComLedModGreen (uint8_t ubNetV, bool_t btSwitchOnV) |
void | ComLedNetRed (uint8_t ubNetV, bool_t btSwitchOnV) |
void | ComLedNetGreen (uint8_t ubNetV, bool_t btSwitchOnV) |
ComStatus_tv | ComLedModuleStatus (uint8_t ubNetV, uint8_t ubStatusV) |
ComStatus_tv | ComLedNetworkError (uint8_t ubNetV, uint8_t ubErrorV) |
ComStatus_tv | ComLedNetworkStatus (uint8_t ubNetV, uint8_t ubStatusV) |
#define COM_LED_PERIOD 50000 |
LED on/off period.
This value defines the shortest on/off period for LED blinking in microseconds.
enum ComLedErr_e |
Network LED - error states.
This enumeration defines the CAN error states for the red network LED. The definitions are used by the function ComLedNetworkError().
Enumerator | |
---|---|
eCOM_LED_ERR_BUS_WARN | CAN Bus is warn error active |
eCOM_LED_ERR_BUS_PASSIVE | CAN Bus is error passive |
eCOM_LED_ERR_BUS_OFF | CAN is Bus-Off |
eCOM_LED_ERR_RESERVED | reserved blinkcode |
enum ComLedMod_e |
Module LED states.
This enumeration defines all states for the module LED. The optional module LED displays the state of the hardware, not the network (i.e. CAN) state.
enum ComLedNet_e |
Network LED - NMT states.
This enumeration defines the NMT states for the green network LED. The definitions are used by the function ComLedNetworkStatus().
void ComLedModGreen | ( | uint8_t | ubNetV, |
bool_t | btSwitchOnV | ||
) |
Drive green Module LED.
ubNetV | - CANopen Network channel |
btSwitchOnV | - state of the LED |
According to the parameter btSwitchOnV the function switches the green Module LED on or off.
This function must be adopted to the target hardware.
void ComLedModRed | ( | uint8_t | ubNetV, |
bool_t | btSwitchOnV | ||
) |
Drive Red Module LED.
ubNetV | - CANopen Network channel |
btSwitchOnV | - state of the LED |
According to the parameter btSwitchOnV the function switches the red Module LED on or off.
This function must be adopted to the target hardware.
ComStatus_tv ComLedModuleStatus | ( | uint8_t | ubNetV, |
uint8_t | ubStatusV | ||
) |
Module Status LED.
ubNetV | - CANopen Network channel |
ubStatusV | - Module Status |
This function sets the pattern for the Module Status LED. Valid values for the parameter ubStatusV are given in the enumeration ComLedMod_e.
void ComLedNetGreen | ( | uint8_t | ubNetV, |
bool_t | btSwitchOnV | ||
) |
Drive green Network LED.
ubNetV | - CANopen Network channel |
btSwitchOnV | - state of the LED |
According to the parameter btSwitchOnV the function switches the green Network LED on or off.
This function must be adopted to the target hardware.
void ComLedNetRed | ( | uint8_t | ubNetV, |
bool_t | btSwitchOnV | ||
) |
Drive red Network LED.
ubNetV | - CANopen Network channel |
btSwitchOnV | - state of the LED |
According to the parameter btSwitchOnV the function switches the red Network LED on or off.
This function must be adopted to the target hardware.
ComStatus_tv ComLedNetworkError | ( | uint8_t | ubNetV, |
uint8_t | ubErrorV | ||
) |
Network Error LED.
ubNetV | - CANopen Network channel |
ubErrorV |
This function sets the network error value. Valid values for the parameter ubErrorV are given in the enumeration ComLedErr_e.
ComStatus_tv ComLedNetworkStatus | ( | uint8_t | ubNetV, |
uint8_t | ubStatusV | ||
) |
Network Status LED.
ubNetV | - CANopen Network channel |
ubStatusV |
This function sets the network status value. Valid values for the parameter ubStatusV are given in the enumeration ComLedNet_e.