Merge branch 'master' of https://github.com/CANopenNode/CANopenNode
This commit is contained in:
commit
3460e01e1c
6 changed files with 34 additions and 11 deletions
|
|
@ -332,6 +332,7 @@ void CO_HBconsumer_process(
|
|||
|
||||
if (monitoredNode->HBstate == CO_HBconsumer_UNCONFIGURED) {
|
||||
/* continue, if node is not monitored */
|
||||
monitoredNode++;
|
||||
continue;
|
||||
}
|
||||
/* Verify if received message is heartbeat or bootup */
|
||||
|
|
|
|||
|
|
@ -889,7 +889,7 @@ uint8_t CO_TPDOisCOS(CO_TPDO_t *TPDO){
|
|||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int16_t CO_TPDOsend(CO_TPDO_t *TPDO){
|
||||
CO_ReturnError_t CO_TPDOsend(CO_TPDO_t *TPDO){
|
||||
int16_t i;
|
||||
uint8_t* pPDOdataByte;
|
||||
uint8_t** ppODdataByte;
|
||||
|
|
|
|||
|
|
@ -396,7 +396,7 @@ uint8_t CO_TPDOisCOS(CO_TPDO_t *TPDO);
|
|||
*
|
||||
* @return Same as CO_CANsend().
|
||||
*/
|
||||
int16_t CO_TPDOsend(CO_TPDO_t *TPDO);
|
||||
CO_ReturnError_t CO_TPDOsend(CO_TPDO_t *TPDO);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -346,6 +346,14 @@ void CO_SYNC_initCallbackPre(
|
|||
}
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
CO_ReturnError_t CO_SYNCsend(CO_SYNC_t *SYNC){
|
||||
if(++SYNC->counter > SYNC->counterOverflowValue) SYNC->counter = 1;
|
||||
SYNC->timer = 0;
|
||||
SYNC->CANrxToggle = SYNC->CANrxToggle ? false : true;
|
||||
SYNC->CANtxBuff->data[0] = SYNC->counter;
|
||||
return CO_CANsend(SYNC->CANdevTx, SYNC->CANtxBuff);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
CO_SYNC_status_t CO_SYNC_process(
|
||||
|
|
@ -374,12 +382,8 @@ CO_SYNC_status_t CO_SYNC_process(
|
|||
/* SYNC producer */
|
||||
if(SYNC->isProducer && SYNC->periodTime){
|
||||
if(SYNC->timer >= SYNC->periodTime){
|
||||
if(++SYNC->counter > SYNC->counterOverflowValue) SYNC->counter = 1;
|
||||
SYNC->timer = 0;
|
||||
ret = CO_SYNC_RECEIVED;
|
||||
SYNC->CANrxToggle = SYNC->CANrxToggle ? false : true;
|
||||
SYNC->CANtxBuff->data[0] = SYNC->counter;
|
||||
CO_CANsend(SYNC->CANdevTx, SYNC->CANtxBuff);
|
||||
CO_SYNCsend(SYNC);
|
||||
}
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_FLAG_TIMERNEXT
|
||||
/* Calculate when next SYNC needs to be sent */
|
||||
|
|
@ -409,10 +413,13 @@ CO_SYNC_status_t CO_SYNC_process(
|
|||
}
|
||||
|
||||
/* Verify timeout of SYNC */
|
||||
if(SYNC->periodTime && *SYNC->operatingState == CO_NMT_OPERATIONAL) {
|
||||
if(SYNC->periodTime && (*SYNC->operatingState == CO_NMT_OPERATIONAL || *SYNC->operatingState == CO_NMT_PRE_OPERATIONAL)){
|
||||
if(SYNC->timer > SYNC->periodTimeoutTime) {
|
||||
CO_errorReport(SYNC->em, CO_EM_SYNC_TIME_OUT, CO_EMC_COMMUNICATION, SYNC->timer);
|
||||
}
|
||||
else {
|
||||
CO_errorReset(SYNC->em, CO_EM_SYNC_TIME_OUT, CO_EMC_COMMUNICATION);
|
||||
}
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_FLAG_TIMERNEXT
|
||||
else if(timerNext_us != NULL) {
|
||||
uint32_t diff = SYNC->periodTimeoutTime - SYNC->timer;
|
||||
|
|
|
|||
|
|
@ -178,6 +178,21 @@ void CO_SYNC_initCallbackPre(
|
|||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Send SYNC message.
|
||||
*
|
||||
* This function prepares and sends a SYNC object. The application should only
|
||||
* call this if direct control of SYNC transmission is needed, otherwise use
|
||||
* CO_SYNC_process().
|
||||
*
|
||||
*
|
||||
* @param TPDO TPDO object.
|
||||
*
|
||||
* @return Same as CO_CANsend().
|
||||
*/
|
||||
CO_ReturnError_t CO_SYNCsend(CO_SYNC_t *SYNC);
|
||||
|
||||
|
||||
/**
|
||||
* Process SYNC communication.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -48,12 +48,12 @@ Zephyr RTOS
|
|||
* CANopenNode integration with Zephyr RTOS
|
||||
* https://github.com/zephyrproject-rtos/zephyr/tree/master/subsys/canbus/canopen
|
||||
* Example integration: https://docs.zephyrproject.org/latest/samples/subsys/canbus/canopen/README.html
|
||||
* CANopenNode version:
|
||||
* CANopenNode version: v1.3
|
||||
* Status: stable
|
||||
* Features: OD storage, LED indicators, SDO server demo for Zephyr RTOS
|
||||
* Features: OD storage, LED indicators, Program Download, SDO server demo for Zephyr RTOS
|
||||
* Development tools: Zephyr SDK
|
||||
* Demo hardware: Any development board with CAN interface and Zephyr support (see https://docs.zephyrproject.org/latest/boards/index.html)
|
||||
* Information updated 2020-01-21
|
||||
* Information updated 2020-09-28
|
||||
|
||||
|
||||
Mbed-os RTOS + STM32 (F091RC, L496ZG)
|
||||
|
|
|
|||
Loading…
Reference in a new issue