1
0
Fork 0
Commit graph

32 commits

Author SHA1 Message Date
Janez
d9c16ae763
Merge pull request #183 from DISTORTEC/even-moar-callbacks
Add CO_TIME_initCallbackPre(), convert {T,R}PDO_CALLS_EXTENSION to config options
2020-05-12 17:30:59 +02:00
Freddie Chopin
0048cb52c7
Fix pointer bug in CO_OD_getFlagsPointer() (#181)
Function did not check whether the object had any flags assigned. It
makes no difference for objects with no subindexes, because then the
function will return NULL anyway. But is subIndex argument is not zero,
then the function calculates addresses of flags as offsets from NULL.
For example, for an object with no flags assigned, when subIndex == 5,
the function would return 5 as the address instead of the expected NULL.
2020-05-12 17:24:06 +02:00
Freddie Chopin
b4b0fe069f Convert {T,R}PDO_CALLS_EXTENSION to CO_CONFIG_{T,R}PDO_CALLS_EXTENSION
User can now enable extension callbacks in RPDO/TPDO handling paths
simply by configuration flags instead of modifying sources or by passing
the defines directly to the compiler.
2020-05-06 18:22:50 +02:00
Freddie Chopin
9b8a296fb7 Add CO_TIME_initCallbackPre() for received TIME messages
This optional mechanism allows to immediatelly wake the thread that
processes TIME, without waiting for its next tick.
2020-05-06 18:08:45 +02:00
Freddie Chopin
495f827d37 Fix minor typo/edit mistakes in CHANGELOG.md and CO_config.h 2020-05-06 18:00:28 +02:00
Freddie Chopin
aa6075b3c8
Add CO_..._initCallbackPre() for RPDO and SYNC (#178)
* Merge two parts of CO_PDO_receive() into single common code

* Add CO_RPDO_initCallbackPre() for received RPDO messages

This optional mechanism allows to immediatelly wake the thread that
processes RPDO, without waiting for its next tick.

* Add CO_SYNC_initCallbackPre() for received SYNC messages

This optional mechanism allows to immediatelly wake the thread that
processes SYNC, without waiting for its next tick.
2020-05-05 13:23:26 +02:00
Freddie Chopin
4c3011d34a
Replace all memcpy/memset-like functions with standard <string.h> functions (#175)
* Use standard memcpy() instead of CO_memcpy()

* Remove CO_memcpy()

* Use standard memset() instead of CO_memset()

* Remove CO_memset()

* Move helper functions from CO_SDOserver.c to header and make them inline

* Implement CO_getUint16() with memcpy()

* Implement CO_getUint32() with memcpy()

* Implement CO_setUint16() with memcpy()

* Implement CO_setUint32() with memcpy()

* Define memcpy() as CO_memcpySwapX() for little-endian systems

* Fix several writes past the buffer due to hardcoded sizes

Use more "generic" sizes (via sizeof()) instead of hardcoded number in
all calls to memset() to avoid 1-byte errors which result in writes past
the buffer, for example:

memset(&LSSslave->TXbuff->data[5], 0, 4);
in CO_LSSslave_serviceInquire()

memset(&LSSmaster->TXbuff->data[6], 0, 3);
in CO_LSSmaster_switchStateSelectInitiate()

* Use "generic" size in calls to memcpy() where possible

* Remove CO_bytes_t

This type was used only for CO_{get,set}Uint{16,32}().
2020-05-04 11:22:32 +02:00
Janez
5a2a1e85cf Update configuration macros. SDO state machine preview. 2020-04-29 13:12:07 +02:00
Janez
5bb2d16323 fix SDO block download process continuity after sequence breaks
This is the same as pull request #171, but applied to split-driver branch.
Original author: Oleg <ev.mipt@gmail.com>

Now additional state CO_SDO_ST_DOWNLOAD_BL_SUB_RESP_2 is used to send response without resetting SDO sequence.
Refactoring timeout halding logic in sub-block transfer.
Also add missed unsigned indicators for several constants.

issue #170
2020-04-07 09:41:00 +02:00
Janez
43f86073ee Minor corrections in documentation. 2020-04-03 11:43:14 +02:00
Janez
ffd5027cb2 Make SYNC optional in TPDO and RPDO. 2020-03-20 18:47:16 +01:00
Janez
6e28914ca9 Make calculation of timerNext_us optional. 2020-03-20 16:44:37 +01:00
Janez
3fd799f919 Heartbeat is send immediately after NMT state changes. 2020-03-19 18:59:58 +01:00
Janez
c88194e813 Add Stack configuration macros to most of CANopenNode objects.
Add CO_NMT_initCallbackPre()
2020-03-19 18:07:23 +01:00
Janez
d9c44c69d1 Change non-descriptive CO_***_initCallback() into CO_***_initCallbackPre().
Change CO_NMT_initCallback() into CO_NMT_initCallbackChange().
Change type of NMT->operatingState from uint8_t into enum CO_NMT_internalState_t.
2020-03-18 23:19:29 +01:00
Janez
b8e821d0dd Add CO_NMT_UNKNOWN state for Heartbeat consumer. 2020-03-18 21:46:34 +01:00
Janez
794c0f903a Added file CO_config.h for stack configuration. Added CO_HBconsumer_initCallback() 2020-03-18 21:06:15 +01:00
Janez
0b2476ec95 Fix timeout and "timerNext_us" in SDO server and client. 2020-03-18 10:12:53 +01:00
Janez
18bc8d4313 HBconsumer: add CO_HBconsumer_initCallbackNmtChanged(), callbaks optional
- Make HBconsumer callbacks optional via CO_CONFIG_HB_CONS_CALLBACKS
  definition.
- Add additional callback CO_HBconsumer_initCallbackNmtChanged()
2020-03-13 16:05:27 +01:00
Janez
1ce3732e60 SocketCAN: change CO_DRIVER_MULTI_INTERFACE and CO_DRIVER_ERROR_REPORTING
- Replace macro USE_EMERGENCY_OBJECT with CO_DRIVER_USE_EMERGENCY 1
- Now define sets macro to 0 or 1. It is easier to set custom value.
2020-03-12 16:20:40 +01:00
Janez
2f204a0c71 Verify return value from CO_CANrxBufferInit() and CO_CANtxBufferInit(). 2020-03-12 12:18:05 +01:00
Janez
1624b7443d Ignore sync message in Emergency receive function CO_EM_receive(). 2020-03-12 10:42:19 +01:00
Janez
fb2274fc9f socketCAN driver, CO_CANrxBufferInit(): remove check COB ID already used.
If two or more CANrx buffers have the same _ident_, then buffer with
lowest _index_ has precedence and other CANrx buffers will be ignored.
2020-03-11 17:48:48 +01:00
Janez
42f2554f2f Add emergency receive callback also for own emergency messages. 2020-03-11 17:44:33 +01:00
Janez
02e2cc5860 Stack configuration added do CO_driver.h
Change macro CO_USE_LEDS -> CO_CONFIG_NMT_LEDS 1
Change macro CO_SDO_BUFFER_SIZE -> CO_CONFIG_SDO_BUFFER_SIZE
2020-03-07 16:26:52 +01:00
Janez
3fc79b807e Remove pFunctSignal from mainline processing functions. Use timerNext_us.
Interface to CO_SDOclientDownloadInitiate and CO_SDOclientUploadInitiate
changed (added optional *timerNext_us argument). Little corrections in
documentation for CO_SDOclient.h
2020-03-07 13:32:14 +01:00
Janez
78487ba89f Clarify EM, SDOserver, SDOclient and LSSmaster callback functions.
callback functions called also from SDO_blockTransferInProgress.
Clarify timerNext_us parameter to CO_process() function.
2020-02-27 16:43:27 +01:00
Janez
8fb48173c6 Add CO_CANopenInitCallback() into CANopen.h/.c.
Change CO_*_initCallback() functions - add 'void *object' argument.
2020-02-27 13:09:48 +01:00
Janez
2fa91d2c69 Fixed:
BUG in CO_HBconsumer.c #168
Misleading Comments in CO_SDO.h #169
2020-02-24 09:42:20 +01:00
Janez
e55674bf6f Documentation updated, ChangeLog deviceSupport and gettingStarted added.
CANopen.h fixed.
2020-02-15 16:35:39 +01:00
Janez
ae48e57c33 CANopen.h/.c revision.
- example/main.c updated to microsecond time base.
- NMT master moved from CANopen.h/.c into 301/CO_NMT_Heartbeat.h/.c.
- CANopen.h/.c files revised, changes in interface, compare example/main.c.
- Removed CO_init() from CANopen.h/.c. Use separate functions instead.
- CO_USE_GLOBALS and global definitions removed from CANopen.c.
- CO_USE_OWN_CRC16 removed from CANopen.c. Use CO_driver_target.h.
2020-02-06 00:15:54 +01:00
Janez
62ffc7c9f5 Drivers removed from stack, directory structure rearranged.
- Change log added to README.
- Doxygen documentation updated.
2020-02-05 10:52:56 +01:00