12#include "canfestival.h"
38 if( d->nodeState != Hibernate ||
39 d->nodeState != BootCheckReset )
42 MSG_WAR(0x3400,
"NMT received. for node : ", (*m).data[1]);
46 if( ( (*m).data[1] == 0 ) || ( (*m).data[1] == *d->bDeviceNodeId ) )
60 case NMT_Enter_Wait_Mode:
64 case NMT_Enter_Patient_Operation:
68 case NMT_Enter_X_Manual:
72 case NMT_Enter_Y_Manual:
76 case NMT_Enter_Stop_Stim:
80 case NMT_Enter_Patient_Manual:
84 case NMT_Enter_Produce_X_Manual:
88 case NMT_Enter_Record_X:
94 if ( ((*m).data[1] == *d->bDeviceNodeId) && (d->nodeState == Waiting))
114 case NMT_Reset_Watchdog:
115 if ( (*m).data[1] == *d->bDeviceNodeId)
120 if(d->NMT_Slave_Node_Reset_Callback != NULL)
121 d->NMT_Slave_Node_Reset_Callback(d);
122 if ((*m).data[1] == *d->bDeviceNodeId)
126 case NMT_Reset_OD_Defaults:
127 if (d->nodeState == Waiting || d->nodeState == Stopped )
131 case NMT_Reset_Module:
132 if (d->nodeState == Waiting || d->nodeState == Stopped )
136 case NMT_Clear_CAN_Errors:
143 CAN_Receive_Messages = 0;
144 CAN_Transmit_Messages = 0;
147 case NMT_Erase_Serial_Eprom:
148 if (d->nodeState == Waiting)
152 case NMT_Do_Save_Cmd:
153 if (d->nodeState == Waiting)
157 case NMT_Do_Restore_Cmd:
158 if (d->nodeState == Waiting)
162 case NMT_Init_NV_Memory:
166 case NMT_Enter_Low_Power:
169 if ( ((*m).data[1] == *d->bDeviceNodeId) && (d->nodeState == Waiting))
178 __disable_fault_irq();
179 HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1);
180 HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN2);
181 HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN3);
182 HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN4);
183 HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN5);
184 __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
185 HAL_PWREx_DisableInternalWakeUpLine();
188 HAL_PWREx_EnablePullUpPullDownConfig();
189 HAL_PWREx_EnableGPIOPullUp(PWR_GPIO_B, PWR_GPIO_BIT_8 | PWR_GPIO_BIT_9);
190 HAL_PWREx_EnterSHUTDOWNMode();
195 case NMT_Reset_Comunication:
196 if ( ((*m).data[1] == *d->bDeviceNodeId) && (d->nodeState == Waiting))
198 UNS8 newNodeId = (*m).data[2];
200 if(d->NMT_Slave_Communications_Reset_Callback != NULL)
201 d->NMT_Slave_Communications_Reset_Callback(d);
204 if(newNodeId != d->lss_transfer.nodeID)
205 d->lss_transfer.nodeID = newNodeId;
208 Status_NodeId = newNodeId;
232 if(*d->bDeviceNodeId==0xFF)
return 0;
235 MSG_WAR(0x3407,
"Send a Boot-Up msg ", 0);
239 UNS16 tmp = NODE_GUARD << 7 | *d->bDeviceNodeId;
242 m.
rtr = NOT_A_REQUEST;
246 return canSend(d->canHandle, &m);
283 if( wdogCoData != NULL )
This file is generated by the NNP Tool – Object Dictionary Editor, as originally developed by CAN Fes...
void sleepTemperature(void)
puts thermometer to sleep
void changeModeIMU(UNS8 mode)
Changes functional mode of ISM330IS accelerometer.
void sleepAccelerometer(void)
puts Accelerometer to sleep
#define UNS8
Unsigned int8 representation in CANFest.
#define UNS16
Unsigned int16 representation in CANFest.
#define MSG_WAR(num, str, val)
Definition of MSG_WAR.
#define NMT_Set_IMU_Mode
Set IMU mode (ISPU, Accelerometer, and Gyroscope)
void RestoreValues(void)
Restores the values of custom OD entries (specified in RestoreList OD index 0x2900) to the OD from EE...
void ResetToODDefault(void)
invoked by nmt_master – writes 0's to size causing bypass of OD restore, then causes reset
void ResetModule(void)
resets module, called by ResetToODDefault()
void SaveValues(void)
Saves the values of custom OD entries (specified in RestoreList OD index 0x2900) to EEPROM from the O...
void EEPROM_erase(UNS8 space)
writes 0xFF to entire EEPROM (6KB).
void EnterProduceXManualFunc(CO_Data *d, Message *m)
Lets application process NMT_Produce_X_Manual.
void EnterPatientOperationFunc(CO_Data *d, Message *m)
Lets application process NMT_Enter_Patient_Operation.
void EnterStopStimFunc(CO_Data *d, Message *m)
Lets application process NMT_Enter_Stop_Stim.
void EnterYManualFunc(CO_Data *d, Message *m)
Lets application process NMT_Enter_Y_Manual.
void EnterPatientManualFunc(CO_Data *d, Message *m)
Lets application process NMT_Enter_Patient_Manual.
void EnterRecordXFunc(CO_Data *d, Message *m)
Lets application process NMT_Enter_Record_X.
void StopNodesFunc(CO_Data *d, Message *m)
Lets application process NMT_Stop_Nodes.
void EnterWaitingFunc(CO_Data *d, Message *m)
Lets application process NMT_Enter_Waiting.
void StartNodesFunc(CO_Data *d, Message *m)
Lets application process NMT_Start_Nodes (unused)
void EnterXManualFunc(CO_Data *d, Message *m)
Lets application process NMT_Enter_X_Manual.
void sleepApplication(void)
This function is called when the module recieves an NMT to enter low power mode.
void setNodeStateToStopped(void)
<BRIEF> setNodeStateToStopped
void processNMTstateChange(CO_Data *d, Message *m)
Manage the reception of a NMT message from the master.
UNS8 slaveSendBootUp(CO_Data *d)
Transmit the boot-Up frame when the slave is moving from initialization state to pre_operational stat...
void StartWatchDog(CO_Data *d, UNS16 timebase)
Starts watchdog on slave.
void StopWatchDog(CO_Data *d)
Stops watchdog on slave.
void PDOInit(CO_Data *d)
Initialize PDO feature.
void PDOStop(CO_Data *d)
Stop PDO feature.
UNS8 setState(CO_Data *d, e_nodeState newState)
Change the state of the node.
void startSYNC(CO_Data *d)
<BRIEF> startSYNC
void stopSYNC(CO_Data *d)
<BRIEF> stopSYNC
: Header for main.c file. This file contains the common defines of the application.
This structure contains all necessary informations to define a CANOpen node.