CO_OD_storage.h
Go to the documentation of this file.
#ifndef CO_OD_STORAGE_H
#define CO_OD_STORAGE_H
#include "301/CO_driver.h"
#include "301/CO_SDOserver.h"
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
CO_SDO_abortCode_t CO_ODF_1010(CO_ODF_arg_t *ODF_arg);
CO_SDO_abortCode_t CO_ODF_1011(CO_ODF_arg_t *ODF_arg);
int CO_OD_storage_saveSecure(
uint8_t *odAddress,
uint32_t odSize,
char *filename);
int CO_OD_storage_restoreSecure(char *filename);
typedef struct {
uint8_t *odAddress;
uint32_t odSize;
char *filename;
FILE *fp;
uint32_t lastSavedUs;
} CO_OD_storage_t;
CO_ReturnError_t CO_OD_storage_init(
CO_OD_storage_t *odStor,
uint8_t *odAddress,
uint32_t odSize,
char *filename);
CO_ReturnError_t CO_OD_storage_autoSave(
CO_OD_storage_t *odStor,
uint32_t timer1usDiff,
uint32_t delay_us);
void CO_OD_storage_autoSaveClose(CO_OD_storage_t *odStor);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* CO_OD_STORAGE_H */
uint32_t
unsigned long int uint32_t
UNSIGNED32 in CANopen (0007h), 32-bit unsigned integer.
Definition: CO_driver.h:155
CO_driver.h
Interface between CAN hardware and CANopenNode.
CO_OD_storage_restoreSecure
int CO_OD_storage_restoreSecure(char *filename)
Remove OD storage file.
Definition: CO_OD_storage.c:181
CO_OD_storage_autoSave
CO_ReturnError_t CO_OD_storage_autoSave(CO_OD_storage_t *odStor, uint32_t timer1usDiff, uint32_t delay_us)
Automatically save memory block if differs from file.
Definition: CO_OD_storage.c:292
CO_OD_storage_t
Object Dictionary storage object.
Definition: CO_OD_storage.h:105
CO_ODF_1010
CO_SDO_abortCode_t CO_ODF_1010(CO_ODF_arg_t *ODF_arg)
Callback for use inside CO_OD_configure() function for OD object 1010.
Definition: CO_OD_storage.c:42
CO_ReturnError_t
CO_ReturnError_t
Return values of some CANopen functions.
Definition: CO_driver.h:488
CO_OD_storage_t::odAddress
uint8_t * odAddress
From CO_OD_storage_init()
Definition: CO_OD_storage.h:106
CO_OD_storage_saveSecure
int CO_OD_storage_saveSecure(uint8_t *odAddress, uint32_t odSize, char *filename)
Save memory block to a file.
Definition: CO_OD_storage.c:102
CO_OD_storage_autoSaveClose
void CO_OD_storage_autoSaveClose(CO_OD_storage_t *odStor)
Closes file opened by CO_OD_storage_autoSave.
Definition: CO_OD_storage.c:369
CO_SDOserver.h
CANopen Service Data Object - server protocol.
CO_OD_storage_init
CO_ReturnError_t CO_OD_storage_init(CO_OD_storage_t *odStor, uint8_t *odAddress, uint32_t odSize, char *filename)
Initialize OD storage object and load data from file.
Definition: CO_OD_storage.c:224
CO_ODF_1011
CO_SDO_abortCode_t CO_ODF_1011(CO_ODF_arg_t *ODF_arg)
Callback for use inside CO_OD_configure() function for OD object 1011.
Definition: CO_OD_storage.c:72
CO_SDO_abortCode_t
CO_SDO_abortCode_t
SDO abort codes.
Definition: CO_SDOserver.h:333
CO_OD_storage_t::fp
FILE * fp
If CO_OD_storage_autoSave() is used, file stays opened and fp is stored here.
Definition: CO_OD_storage.h:110
CO_OD_storage_t::lastSavedUs
uint32_t lastSavedUs
used with CO_OD_storage_autoSave.
Definition: CO_OD_storage.h:111
CO_OD_storage_t::odSize
uint32_t odSize
From CO_OD_storage_init()
Definition: CO_OD_storage.h:107
CO_OD_storage_t::filename
char * filename
From CO_OD_storage_init()
Definition: CO_OD_storage.h:108
uint8_t
unsigned char uint8_t
UNSIGNED8 in CANopen (0005h), 8-bit unsigned integer.
Definition: CO_driver.h:151