GFC
CANopen_304

## Files

file | CO_GFC.c
| CANopen Global fail-safe command protocol.
file | CO_GFC.h
| CANopen Global fail-safe command protocol.

## Data Structures

struct | CO_GFC_t
| GFC object. More...

## Functions

CO_ReturnError_t | CO_GFC_init (CO_GFC_t *GFC, uint8_t *valid, CO_CANmodule_t *GFC_CANdevRx, uint16_t GFC_rxIdx, uint16_t CANidRxGFC, CO_CANmodule_t *GFC_CANdevTx, uint16_t GFC_txIdx, uint16_t CANidTxGFC)
| Initialize GFC object. More...
void | CO_GFC_initCallbackEnterSafeState (CO_GFC_t *GFC, void *object, void(*pFunctSignalSafe)(void *object))
| Initialize GFC callback function. More...
CO_ReturnError_t | CO_GFCsend (CO_GFC_t *GFC)
| Send GFC message. More...

## Detailed Description

Global fail-safe command protocol.

Very simple consumer/producer protocol. A net can have multiple GFC producer and multiple GFC consumer. On a safety-relevant the producer can send a GFC message (ID 0, DLC 0). The consumer can use this message to start the transition to a safe state. The GFC is optional for the security protocol and is not monitored (timed).

## Function Documentation

## CO_GFC_init()

CO_ReturnError_t CO_GFC_init | ( | CO_GFC_t * | GFC,
|  | uint8_t * | valid,
|  | CO_CANmodule_t * | GFC_CANdevRx,
|  | uint16_t | GFC_rxIdx,
|  | uint16_t | CANidRxGFC,
|  | CO_CANmodule_t * | GFC_CANdevTx,
|  | uint16_t | GFC_txIdx,
|  | uint16_t | CANidTxGFC
| ) |  |

Initialize GFC object.

Function must be called in the communication reset section.

Parameters

  GFC | This object will be initialized.
  valid | pointer to the valid flag in OD (0x1300)
  GFC_CANdevRx | CAN device used for SRDO reception.
  GFC_rxIdx | Index of receive buffer in the above CAN device.
  CANidRxGFC | GFC CAN ID for reception
  GFC_CANdevTx | AN device used for SRDO transmission.
  GFC_txIdx | Index of transmit buffer in the above CAN device.
  CANidTxGFC | GFC CAN ID for transmission

Returns
  CO_ReturnError_t: CO_ERROR_NO or CO_ERROR_ILLEGAL_ARGUMENT.

## CO_GFC_initCallbackEnterSafeState()

void CO_GFC_initCallbackEnterSafeState | ( | CO_GFC_t * | GFC,
|  | void * | object,
|  | void(*)(void *object) | pFunctSignalSafe
| ) |  |

Initialize GFC callback function.

Function initializes optional callback function, that is called when GFC is received. Callback is called from receive function (interrupt).

Parameters

  GFC | This object.
  object | Pointer to object, which will be passed to pFunctSignalSafe(). Can be NULL
  pFunctSignalSafe | Pointer to the callback function. Not called if NULL.

## CO_GFCsend()

CO_ReturnError_t CO_GFCsend | ( | CO_GFC_t * | GFC | ) |

Send GFC message.

It should be called by application, for example after a safety-relevant change.

Parameters

  GFC | GFC object.

Returns
  Same as CO_CANsend().