CANopen Slave Documentation
Version 6.16.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 COS_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 COS_LED_SUPPORT (see cos_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 CosLedModuleStatus() function somewhere. The following functions must be adopted to the target hardware for Module LED support:
Enumerations | |
enum | CosLedMod_e { eCosLedMod_OK = 0 , eCosLedMod_FAIL_BAUD , eCosLedMod_FAIL_ADDR , eCosLedMod_RECOVER , eCosLedMod_APP1 , eCosLedMod_APP2 } |
enum | CosLedNet_e { eCosLedNet_STOPPED = 0 , eCosLedNet_PREOPERATIONAL , eCosLedNet_OPERATIONAL , eCosLedNet_INIT } |
enum | CosLedErr_e { } |
Functions | |
void | CosLedModRed (bool_t btSwitchOnV) |
void | CosLedModGreen (bool_t btSwitchOnV) |
void | CosLedNetRed (bool_t btSwitchOnV) |
void | CosLedNetGreen (bool_t btSwitchOnV) |
void | CosLedModuleStatus (uint8_t ubStatusV) |
void | CosLedNetworkError (uint8_t ubErrorV) |
void | CosLedNetworkPattern (void) |
void | CosLedNetworkStatus (uint8_t ubStatusV) |
enum CosLedErr_e |
Network LED - error states.
This enumeration defines the CAN error states for the red network LED. The definitions are used by the function CosLedNetworkError().
Enumerator | |
---|---|
eCosLedErr_BUS_WARN | CAN Bus is warn error active |
eCosLedErr_BUS_PASSIVE | CAN Bus is error passive |
eCosLedErr_BUS_OFF | CAN is Bus-Off |
eCosLedErr_RESERVED | reserved blinkcode |
enum CosLedMod_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 CosLedNet_e |
Network LED - NMT states.
This enumeration defines the NMT states for the green network LED. The definitions are used by the function CosLedNetworkStatus().
void CosLedModGreen | ( | bool_t | btSwitchOnV | ) |
Drive green Module LED.
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 CosLedModRed | ( | bool_t | btSwitchOnV | ) |
Drive Red Module LED.
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.
void CosLedModuleStatus | ( | uint8_t | ubStatusV | ) |
Module Status LED.
ubStatusV | - Module Status |
This function sets the pattern for the Module Status LED. Valid values for the parameter ubStatusV are given in the enumeration CosLedMod_e.
void CosLedNetGreen | ( | bool_t | btSwitchOnV | ) |
Drive green Network LED.
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 CosLedNetRed | ( | bool_t | btSwitchOnV | ) |
Drive red Network LED.
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.
void CosLedNetworkError | ( | uint8_t | ubErrorV | ) |
Network Error LED.
ubErrorV | - Error condition |
This function sets the network error value. Valid values for the parameter ubErrorV are given in the enumeration CosLedErr_e.
void CosLedNetworkPattern | ( | void | ) |
Update Network Status LED pattern.
This function sets the pattern for the Network Status LED.
void CosLedNetworkStatus | ( | uint8_t | ubStatusV | ) |
Network Status LED.
ubStatusV | - CAN status |
This function sets the network status value. Valid values for the parameter ubStatusV are given in the enumeration CosLedNet_e.