|
void | ComMgrEventBus (uint8_t ubNetV, CpState_ts *ptsBusStateV) |
|
uint8_t | ComMgrGetVersionMajor (void) |
|
uint8_t | ComMgrGetVersionMinor (void) |
|
const char * | ComMgrGetVersionString (uint8_t ubTypeV) |
|
const char * | ComMgrGetConfiguration (void) |
|
ComStatus_tv | ComMgrInit (uint8_t ubCanIfV, uint8_t ubNetV, uint8_t ubBaudSelV, uint8_t ubNodeIdV, uint32_t ulModeV) |
|
ComStatus_tv | ComMgrProcess (uint8_t ubNetV) |
|
ComStatus_tv | ComMgrUserInit (uint8_t ubNetV) |
|
void | ComMgrNetTimerEvent (uint8_t ubNetV) |
|
ComStatus_tv | ComMgrNodeAdd (uint8_t ubNetV, uint8_t ubNodeIdV, ComNode_ts *ptsNodeV) |
|
ComStatus_tv | ComMgrNodeDelete (uint8_t ubNetV, uint8_t ubNodeIdV) |
|
ComStatus_tv | ComMgrRelease (uint8_t ubNetV) |
|
ComStatus_tv | ComMgrSetErrorRegister (uint8_t ubNetV, uint8_t ubSetErrorV, uint8_t ubResetErrorV) |
|
ComStatus_tv | ComMgrStart (uint8_t ubNetV) |
|
ComStatus_tv | ComMgrStop (uint8_t ubNetV) |
|
void | ComMgrTimerEvent (void) |
|
This module holds all functions for the initialisation and control of the CANopen Master.
The CANopen Master is initialised with ComMgrInit(). This routine will setup the CAN controller and initialise all necessary services. Afterwards the stack can be started by calling the ComMgrStart(), which will issue a boot-up message for the CANopen Master.
In summary three steps are necessary to start the CANopen Master:
The following example depicts this process:
◆ ComMgrEventBus()
void ComMgrEventBus |
( |
uint8_t |
ubNetV, |
|
|
CpState_ts * |
ptsBusStateV |
|
) |
| |
- Parameters
-
[in] | ubNetV | - CANopen Network channel |
[in] | ptsBusStateV | - pointer to CpState_ts value of bus |
This function is called by the stack on a bus state change. The implementation on this function is application specific.
◆ ComMgrGetConfiguration()
const char* ComMgrGetConfiguration |
( |
void |
| ) |
|
- Returns
- Pointer to a Null terminated character string
This function returns a configuration string of the CANopen FD Master.
◆ ComMgrGetVersionMajor()
uint8_t ComMgrGetVersionMajor |
( |
void |
| ) |
|
This function returns the major version of the CANopen FD Master Library.
◆ ComMgrGetVersionMinor()
uint8_t ComMgrGetVersionMinor |
( |
void |
| ) |
|
This function returns the minor version of the CANopen FD Master Library.
◆ ComMgrGetVersionString()
const char* ComMgrGetVersionString |
( |
uint8_t |
ubTypeV | ) |
|
- Parameters
-
[in] | ubTypeV | - Information type |
- Returns
- Pointer to a Null terminated character string
This function returns a version string of the CANopen FD Master Library. The parameter ubTypeV defines the requested information, possible values are defined by the enumeration ComVersion_e.
◆ ComMgrInit()
ComStatus_tv ComMgrInit |
( |
uint8_t |
ubCanIfV, |
|
|
uint8_t |
ubNetV, |
|
|
uint8_t |
ubBaudSelV, |
|
|
uint8_t |
ubNodeIdV, |
|
|
uint32_t |
ulModeV |
|
) |
| |
- Parameters
-
[in] | ubCanIfV | - CAN interface index |
[in] | ubNetV | - CANopen Network channel |
[in] | ubBitrateSelV | - Bit-rate selection |
[in] | ubNodeIdV | - Node-ID value |
[in] | ulModeV | - Initial mode |
- Returns
- eCOM_ERR_NONE on success, negative ComErr_e value on failure
- See also
- ComMgrRelease()
This function must be called before any other function of the CANopen Master stack. It is responsible for the initialisation of all services (NMT, SYNC, SDO, PDO, etc).
The function assigns the logical CANopen network number ubNetV to the CAN interface given by ubCanIfV
. The value for ubNetV can be taken from the ComNet_e enumeration. The maximum value is given by the symbol #COM_NET_MAX.
The initial mode parameter ulModeV defines the startup behaviour. Valid values are defined in the enumeration ComMode_e.
◆ ComMgrNetTimerEvent()
void ComMgrNetTimerEvent |
( |
uint8_t |
ubNetV | ) |
|
Execute Timer-based Services.
- Parameters
-
ubNetV | - CANopen Network channel |
- See also
- ComMgrTimerEvent()
This routine must be called by a timer resource of the target system. It is responsible to call services that depend on a timer (e.g. Heartbeat). The period of the timer is supplied to the CANopen FD Master library using the ComTmrSetPeriod() function. The function calls the services for the CANopen network defined by ubNetV. Execution of timer-based services for all CANopen networks is possible via ComMgrTimerEvent().
Example
void MyTimerInterrupt(void)
{
}
◆ ComMgrNodeAdd()
ComStatus_tv ComMgrNodeAdd |
( |
uint8_t |
ubNetV, |
|
|
uint8_t |
ubNodeIdV, |
|
|
ComNode_ts * |
ptsNodeV |
|
) |
| |
- Parameters
-
ubNetV | - CANopen Network channel |
ubNodeIdV | - Node-ID value |
ptsNodeV | - Pointer to CANopen node |
- Returns
- Value of enumeration ComErr_e
- See also
- ComMgrNodeDelete()
This function adds a new CANopen node (device) to the CANopen Master on address ubNodeIdV. The CANopen node structure shall be intitialised using ComNodeSetDefault() in advance.
◆ ComMgrNodeDelete()
ComStatus_tv ComMgrNodeDelete |
( |
uint8_t |
ubNetV, |
|
|
uint8_t |
ubNodeIdV |
|
) |
| |
Remove CANopen device.
- Parameters
-
ubNetV | - CANopen Network channel |
ubNodeIdV | - Node-ID value |
- Returns
- Value of enumeration ComErr_e
- See also
- ComMgrNodeAdd()
This function removes a CANopen node (device) from the CANopen Master on address ubNodeIdV.
◆ ComMgrProcess()
ComStatus_tv ComMgrProcess |
( |
uint8_t |
ubNetV | ) |
|
- Parameters
-
[in] | ubNetV | - CANopen Network channel |
- Returns
- Value of enumeration ComErr_e
This function is responsible for processing of CAN messages on the supplied network channel ubNetV.
◆ ComMgrRelease()
ComStatus_tv ComMgrRelease |
( |
uint8_t |
ubNetV | ) |
|
- Parameters
-
[in] | ubNetV | - CANopen Network channel |
- Returns
- Value of enumeration ComErr_e
- See also
- ComMgrInit()
This function performs a shutdown of the CANopen FD Master.
◆ ComMgrSetErrorRegister()
ComStatus_tv ComMgrSetErrorRegister |
( |
uint8_t |
ubNetV, |
|
|
uint8_t |
ubSetErrorV, |
|
|
uint8_t |
ubResetErrorV |
|
) |
| |
- Parameters
-
[in] | ubNetV | - CANopen Network channel |
[in] | ubSetErrorV | - Set new new error state |
[in] | ubResetErrorV | - Clear error state |
- Returns
- Value of enumeration ComErr_e
This function sets and clears bit-masked error states of the error register.
◆ ComMgrStart()
ComStatus_tv ComMgrStart |
( |
uint8_t |
ubNetV | ) |
|
- Parameters
-
[in] | ubNetV | - CANopen Network channel |
- Returns
- Value of enumeration ComErr_e
- See also
- ComMgrStop()
◆ ComMgrStop()
ComStatus_tv ComMgrStop |
( |
uint8_t |
ubNetV | ) |
|
- Parameters
-
[in] | ubNetV | - CANopen Network channel |
- Returns
- Value of enumeration ComErr_e
- See also
- ComMgrStart()
◆ ComMgrTimerEvent()
void ComMgrTimerEvent |
( |
void |
| ) |
|
Execute Timer-based Services.
- See also
- ComMgrNetTimerEvent()
This routine must be called by a timer resource of the target system. It is responsible to call services that depend on a timer (e.g. Heartbeat). The period of the timer is defined via the ComTmrSetPeriod() value.
Example
void MyTimerHandler(void)
{
}
◆ ComMgrUserInit()
ComStatus_tv ComMgrUserInit |
( |
uint8_t |
ubNetV | ) |
|
- Parameters
-
[in] | ubNetV | - CANopen Network channel |
- Returns
- eCOM_ERR_NONE on success, negative ComErr_e value on failure
This function is called by ComMgrInit() during the initialisation phase. It is responsible for setting internal values of the Master. The behaviour of this function is application specific.