CANopen Bootloader Documentation
Version 4.10.00
Loading...
Searching...
No Matches
cbl_led.h File Reference

Detailed Description

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 CBL_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 CBL_LED_SUPPORT (see cbl_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 CblLedModuleStatus() function somewhere. The following functions must be adopted to the target hardware for Module LED support:

+ Include dependency graph for cbl_led.h:

Enumerations

enum  CblLedMod_e {
  eCblLedMod_OK = 0 ,
  eCblLedMod_FAIL_BAUD ,
  eCblLedMod_FAIL_ADDR ,
  eCblLedMod_RECOVER ,
  eCblLedMod_APP1 ,
  eCblLedMod_APP2
}
 
enum  CblLedNet_e {
  eCblLedNet_STOPPED = 0 ,
  eCblLedNet_PREOPERATIONAL ,
  eCblLedNet_OPERATIONAL ,
  eCblLedNet_INIT
}
 
enum  CblLedErr_e {
  eCblLedErr_NONE = 0 ,
  eCblLedErr_BUS_WARN ,
  eCblLedErr_BUS_PASSIVE ,
  eCblLedErr_BUS_OFF ,
  eCblLedErr_RESERVED
}
 

Functions

void CblLedModGreen (bool_t btSwitchOnV)
 
void CblLedModRed (bool_t btSwitchOnV)
 
void CblLedModuleStatus (uint8_t ubStatusV)
 
void CblLedNetGreen (bool_t btSwitchOnV)
 
void CblLedNetRed (bool_t btSwitchOnV)
 

Enumeration Type Documentation

◆ CblLedErr_e

Network LED - error states.

This enumeration defines the CAN error states for the red network LED. The definitions are used by the function CblLedNetworkError().

Enumerator
eCblLedErr_NONE 

No CAN error

eCblLedErr_BUS_WARN 

CAN Bus is warn error active

eCblLedErr_BUS_PASSIVE 

CAN Bus is error passive

eCblLedErr_BUS_OFF 

CAN is Bus-Off

eCblLedErr_RESERVED 

reserved blinkcode

◆ CblLedMod_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.

Enumerator
eCblLedMod_OK 

Module state is OK

eCblLedMod_FAIL_BAUD 

Hardware failure on baudrate setting

eCblLedMod_FAIL_ADDR 

Hardware failure on address setting

eCblLedMod_RECOVER 

Error occured that can be recovered

eCblLedMod_APP1 

Application / hardware error 1

eCblLedMod_APP2 

Application / hardware error 2

◆ CblLedNet_e

Network LED - NMT states.

This enumeration defines the NMT states for the green network LED. The definitions are used by the function CblLedNetworkStatus().

Enumerator
eCblLedNet_STOPPED 

Module is in Stopped State

eCblLedNet_PREOPERATIONAL 

Module is in Pre-Operational State

eCblLedNet_OPERATIONAL 

Module is in Operational State

eCblLedNet_INIT 

Module is in Initialization State

Function Documentation

◆ CblLedModGreen()

void CblLedModGreen ( bool_t  btSwitchOnV)
Parameters
[in]btSwitchOnVstate of green module LED
Note
Adopt this function to the application if required. The function implementation is located in the file cbl_user.c. The function is called by the protocol stack only if the symbol CBL_LED_SUPPORT is set to 2.

Depending on the parameter btSwitchOnV the function switches the green module LED on or off.

  • btSwitchOnV = 0: LED is switched off
  • btSwitchOnV = 1: LED is switched on

◆ CblLedModRed()

void CblLedModRed ( bool_t  btSwitchOnV)
Parameters
[in]btSwitchOnVstate of red module LED
Note
Adopt this function to the application if required. The function implementation is located in the file cbl_user.c. The function is called by the protocol stack only if the symbol CBL_LED_SUPPORT is set to 2.

Depending on the parameter btSwitchOnV the function switches the red module LED on or off.

  • btSwitchOnV = 0: LED is switched off
  • btSwitchOnV = 1: LED is switched on

◆ CblLedModuleStatus()

void CblLedModuleStatus ( uint8_t  ubStatusV)
Parameters
[in]ubStatusVModule Status
Note
The function is only available if the symbol CBL_LED_SUPPORT is set to 2.

This function sets the pattern for the Module Status LED. Valid values for the parameter ubStatusV are given in the enumeration CblLedMod_e.

◆ CblLedNetGreen()

void CblLedNetGreen ( bool_t  btSwitchOnV)
Parameters
[in]btSwitchOnVstate of green network LED
Note
Adopt this function to the application if required. The function implementation is located in the file cbl_user.c. The function is called by the protocol stack only if the symbol CBL_LED_SUPPORT is set to 1 or 2.

Depending on the parameter btSwitchOnV the function switches the green network LED on or off.

  • btSwitchOnV = 0: LED is switched off
  • btSwitchOnV = 1: LED is switched on

◆ CblLedNetRed()

void CblLedNetRed ( bool_t  btSwitchOnV)
Parameters
[in]btSwitchOnVstate of red network LED
Note
Adopt this function to the application if required. The function implementation is located in the file cbl_user.c. The function is called by the protocol stack only if the symbol CBL_LED_SUPPORT is set to 1 or 2.

Depending on the parameter btSwitchOnV the function switches the red network LED on or off.

  • btSwitchOnV = 0: LED is switched off
  • btSwitchOnV = 1: LED is switched on