Emergency producer/consumer
CANopen_301 » Driver » Stack configuration

## Macros

#define | CO_CONFIG_EM (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)
| Configuration of Emergency. More...
#define | CO_CONFIG_EM_ERR_STATUS_BITS_COUNT (10*8)
| Maximum number of CO_EM_errorStatusBits_t. More...
#define | CO_CONFIG_EM_BUFFER_SIZE 16
| Size of the internal buffer, where emergencies are stored after error indication with CO_error() function. More...
#define | CO_CONFIG_ERR_CONDITION_GENERIC (em->errorStatusBits[5] != 0)
| Condition for calculating CANopen Error register, "generic" error bit. More...
#define | CO_CONFIG_ERR_CONDITION_CURRENT
| Condition for calculating CANopen Error register, "current" error bit. More...
#define | CO_CONFIG_ERR_CONDITION_VOLTAGE
| Condition for calculating CANopen Error register, "voltage" error bit. More...
#define | CO_CONFIG_ERR_CONDITION_TEMPERATURE
| Condition for calculating CANopen Error register, "temperature" error bit. More...
#define | CO_CONFIG_ERR_CONDITION_COMMUNICATION (em->errorStatusBits[2] || em->errorStatusBits[3])
| Condition for calculating CANopen Error register, "communication" error bit. More...
#define | CO_CONFIG_ERR_CONDITION_DEV_PROFILE
| Condition for calculating CANopen Error register, "device profile" error bit. More...
#define | CO_CONFIG_ERR_CONDITION_MANUFACTURER (em->errorStatusBits[8] || em->errorStatusBits[9])
| Condition for calculating CANopen Error register, "manufacturer" error bit. More...

## Detailed Description

## Macro Definition Documentation

## CO_CONFIG_EM

#define CO_CONFIG_EM (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)

Configuration of Emergency.

Possible flags, can be ORed:

- CO_CONFIG_EM_PRODUCER - Enable emergency producer.
- CO_CONFIG_EM_PROD_CONFIGURABLE - Emergency producer COB-ID is configurable, OD object 0x1014. If not configurable, then 0x1014 is read-only, COB_ID is set to CO_CAN_ID_EMERGENCY + nodeId and write is not verified.
- CO_CONFIG_EM_PROD_INHIBIT - Enable inhibit timer on emergency producer, OD object 0x1015.
- CO_CONFIG_EM_HISTORY - Enable error history, OD object 0x1003, "Pre-defined error field"
- CO_CONFIG_EM_CONSUMER - Enable simple emergency consumer with callback.
- CO_CONFIG_EM_STATUS_BITS - Access CO_EM_errorStatusBits_t from OD.
- CO_CONFIG_FLAG_CALLBACK_PRE - Enable custom callback after preprocessing emergency condition by CO_errorReport() or CO_errorReset() call. Callback is configured by CO_EM_initCallbackPre().
- CO_CONFIG_FLAG_TIMERNEXT - Enable calculation of timerNext_us variable inside CO_EM_process().

## CO_CONFIG_EM_ERR_STATUS_BITS_COUNT

#define CO_CONFIG_EM_ERR_STATUS_BITS_COUNT (10*8)

Maximum number of CO_EM_errorStatusBits_t.

Stack uses 6*8 = 48 CO_EM_errorStatusBits_t, others are free to use by manufacturer. Allowable value range is from 48 to 256 bits in steps of 8. Default is 80.

## CO_CONFIG_EM_BUFFER_SIZE

#define CO_CONFIG_EM_BUFFER_SIZE 16

Size of the internal buffer, where emergencies are stored after error indication with CO_error() function.

Each emergency has to be post- processed by the CO_EM_process() function. In case of overflow, error is indicated but emergency message is not sent.

The same buffer is also used for OD object 0x1003, "Pre-defined error field".

Each buffer element consumes 8 bytes. Valid values are 1 to 254.

## CO_CONFIG_ERR_CONDITION_GENERIC

#define CO_CONFIG_ERR_CONDITION_GENERIC (em->errorStatusBits[5] != 0)

Condition for calculating CANopen Error register, "generic" error bit.

Condition must observe suitable CO_EM_errorStatusBits_t and use corresponding member of errorStatusBits array from CO_EM_t to calculate the condition. See also CO_errorRegister_t.

Warning
  Size of CO_CONFIG_EM_ERR_STATUS_BITS_COUNT must be large enough. (CO_CONFIG_EM_ERR_STATUS_BITS_COUNT/8) must be larger than index of array member in em->errorStatusBits[index].

em->errorStatusBits[5] should be included in the condition, because they are used by the stack.

## CO_CONFIG_ERR_CONDITION_CURRENT

#define CO_CONFIG_ERR_CONDITION_CURRENT

Condition for calculating CANopen Error register, "current" error bit.

See CO_CONFIG_ERR_CONDITION_GENERIC for description. Macro is not defined by default, so no error is verified.

## CO_CONFIG_ERR_CONDITION_VOLTAGE

#define CO_CONFIG_ERR_CONDITION_VOLTAGE

Condition for calculating CANopen Error register, "voltage" error bit.

See CO_CONFIG_ERR_CONDITION_GENERIC for description. Macro is not defined by default, so no error is verified.

## CO_CONFIG_ERR_CONDITION_TEMPERATURE

#define CO_CONFIG_ERR_CONDITION_TEMPERATURE

Condition for calculating CANopen Error register, "temperature" error bit.

See CO_CONFIG_ERR_CONDITION_GENERIC for description. Macro is not defined by default, so no error is verified.

## CO_CONFIG_ERR_CONDITION_COMMUNICATION

#define CO_CONFIG_ERR_CONDITION_COMMUNICATION (em->errorStatusBits[2] || em->errorStatusBits[3])

Condition for calculating CANopen Error register, "communication" error bit.

See CO_CONFIG_ERR_CONDITION_GENERIC for description.

em->errorStatusBits[2] and em->errorStatusBits[3] must be included in the condition, because they are used by the stack.

## CO_CONFIG_ERR_CONDITION_DEV_PROFILE

#define CO_CONFIG_ERR_CONDITION_DEV_PROFILE

Condition for calculating CANopen Error register, "device profile" error bit.

See CO_CONFIG_ERR_CONDITION_GENERIC for description. Macro is not defined by default, so no error is verified.

## CO_CONFIG_ERR_CONDITION_MANUFACTURER

#define CO_CONFIG_ERR_CONDITION_MANUFACTURER (em->errorStatusBits[8] || em->errorStatusBits[9])

Condition for calculating CANopen Error register, "manufacturer" error bit.

See CO_CONFIG_ERR_CONDITION_GENERIC for description.

em->errorStatusBits[8] and em->errorStatusBits[8] are pre-defined, but can be changed.