49 #if !LELY_NO_CO_RPDO && !LELY_NO_CO_MPDO
66 operator()(
co_nmt_t* nmt)
const noexcept {
73 void OnCsInd(
co_nmt_t* nmt, uint8_t cs) noexcept;
74 void OnHbInd(
co_nmt_t* nmt, uint8_t
id,
int state,
int reason) noexcept;
75 void OnStInd(
co_nmt_t* nmt, uint8_t
id, uint8_t st) noexcept;
78 void OnRpdoInd(
co_rpdo_t* pdo, uint32_t ac,
const void* ptr,
80 void OnRpdoErr(
co_rpdo_t* pdo, uint16_t eec, uint8_t er) noexcept;
84 void OnTpdoInd(
co_tpdo_t* pdo, uint32_t ac,
const void* ptr,
89 void OnSyncInd(
co_nmt_t* nmt, uint8_t cnt) noexcept;
90 void OnSyncErr(
co_sync_t* sync, uint16_t eec, uint8_t er) noexcept;
94 void OnTimeInd(
co_time_t* time,
const timespec* tp) noexcept;
98 void OnEmcyInd(
co_emcy_t* emcy, uint8_t
id, uint16_t ec, uint8_t er,
99 uint8_t msef[5]) noexcept;
103 void OnRateInd(
co_lss_t*, uint16_t rate,
int delay) noexcept;
104 int OnStoreInd(
co_lss_t*, uint8_t
id, uint16_t rate) noexcept;
108 void RpdoRtr(
int num) noexcept;
116 ::std::unique_ptr<co_nmt_t, NmtDeleter> nmt;
119 ::std::function<void(uint8_t,
bool)> on_heartbeat;
120 ::std::function<void(uint8_t,
NmtState)> on_state;
122 ::std::function<void(
int, ::std::error_code,
const void*, ::std::size_t)>
124 ::std::function<void(
int, uint16_t, uint8_t)> on_rpdo_error;
127 ::std::function<void(
int, ::std::error_code,
const void*, ::std::size_t)>
131 ::std::function<void(uint8_t,
const time_point&)> on_sync;
132 ::std::function<void(uint16_t, uint8_t)> on_sync_error;
135 ::std::function<void(const ::std::chrono::system_clock::time_point&)> on_time;
138 ::std::function<void(uint8_t, uint16_t, uint8_t, uint8_t[5])> on_emcy;
141 ::std::function<void(
int, ::std::chrono::milliseconds)> on_switch_bitrate;
146 const ::std::string& dcf_txt, const ::std::string& dcf_bin,
148 : io::CanNet(exec, timer, chan, 0, 0),
149 Device(dcf_txt, dcf_bin, id, this),
150 tpdo_event_mutex(*this),
156 Node::~Node() =
default;
175 wait.
value = util::to_timespec(t);
187 auto value = util::to_timespec(t);
189 if (!f) util::throw_errc(
"AsyncWait");
192 int errc = f.get().
error();
193 if (errc) util::throw_errc(
"AsyncWait", errc);
214 ::std::chrono::milliseconds delay) {
226 [
this, &ctrl, bitrate,
247 ::std::lock_guard<util::BasicLockable>
lock(*
this);
253 ::std::lock_guard<util::BasicLockable>
lock(*
this);
259 ::std::lock_guard<util::BasicLockable>
lock(*
this);
266 util::throw_errc(
"Reset");
271 ::std::error_code& ec) {
272 ::std::lock_guard<util::BasicLockable>
lock(*
this);
284 ::std::error_code ec;
291 ::std::lock_guard<util::BasicLockable>
lock(*
this);
292 impl_->on_command = on_command;
297 ::std::lock_guard<util::BasicLockable>
lock(*
this);
298 impl_->on_heartbeat = on_heartbeat;
303 ::std::lock_guard<util::BasicLockable>
lock(*
this);
304 impl_->on_state = on_state;
309 ::std::function<
void(
int, ::std::error_code,
const void*, ::std::size_t)>
314 ::std::lock_guard<util::BasicLockable>
lock(*
this);
315 impl_->on_rpdo = on_rpdo;
324 ::std::lock_guard<util::BasicLockable>
lock(*
this);
325 impl_->on_rpdo_error = on_rpdo_error;
331 ::std::function<
void(
int, ::std::error_code,
const void*, ::std::size_t)>
336 ::std::lock_guard<util::BasicLockable>
lock(*
this);
337 impl_->on_tpdo = on_tpdo;
342 Node::OnSync(::std::function<
void(uint8_t,
const time_point&)> on_sync) {
346 ::std::lock_guard<util::BasicLockable>
lock(*
this);
347 impl_->on_sync = on_sync;
356 ::std::lock_guard<util::BasicLockable>
lock(*
this);
357 impl_->on_sync_error = on_sync_error;
363 ::std::function<
void(const ::std::chrono::system_clock::time_point&)>
368 ::std::lock_guard<util::BasicLockable>
lock(*
this);
369 impl_->on_time = on_time;
375 ::std::function<
void(uint8_t, uint16_t, uint8_t, uint8_t[5])> on_emcy) {
379 ::std::lock_guard<util::BasicLockable>
lock(*
this);
380 impl_->on_emcy = on_emcy;
386 ::std::function<
void(
int, ::std::chrono::milliseconds)> on_switch_bitrate) {
388 (void)on_switch_bitrate;
390 ::std::lock_guard<util::BasicLockable>
lock(*
this);
391 impl_->on_switch_bitrate = on_switch_bitrate;
421 assert(new_state != old_state);
424 if (new_state == io::CanState::PASSIVE) {
427 }
else if (old_state == io::CanState::BUSOFF) {
435 return impl_->nmt.get();
439 Node::Error(uint16_t eec, uint8_t er,
const uint8_t msef[5]) noexcept {
451 for (num = 1; num <= 512; num++) impl_->RpdoRtr(num);
466 typename ::std::enable_if<is_canopen_basic<T>::value &&
sizeof(T) <= 4,
468 Node::DamMpdoEvent(
int num, uint8_t
id, uint16_t idx, uint8_t subidx, T value) {
478 uint8_t buf[4] = {0};
479 co_val_write(canopen_traits<T>::index, &value, buf, buf + 4);
485 #ifndef DOXYGEN_SHOULD_SKIP_THIS
488 template void Node::DamMpdoEvent<bool>(
int, uint8_t, uint16_t, uint8_t,
bool);
491 template void Node::DamMpdoEvent<int8_t>(
int, uint8_t, uint16_t, uint8_t,
495 template void Node::DamMpdoEvent<int16_t>(
int, uint8_t, uint16_t, uint8_t,
499 template void Node::DamMpdoEvent<int32_t>(
int, uint8_t, uint16_t, uint8_t,
503 template void Node::DamMpdoEvent<uint8_t>(
int, uint8_t, uint16_t, uint8_t,
507 template void Node::DamMpdoEvent<uint16_t>(
int, uint8_t, uint16_t, uint8_t,
511 template void Node::DamMpdoEvent<uint32_t>(
int, uint8_t, uint16_t, uint8_t,
515 template void Node::DamMpdoEvent<float>(
int, uint8_t, uint16_t, uint8_t,
float);
540 if (impl_->on_can_state) {
541 auto f = impl_->on_can_state;
542 util::UnlockGuard<util::BasicLockable>
unlock(*
this);
543 f(new_state, old_state);
550 if (impl_->on_can_error) {
551 auto f = impl_->on_can_error;
552 util::UnlockGuard<util::BasicLockable>
unlock(*
this);
558 Node::OnStore(uint8_t,
int) {
559 util::throw_error_code(
"OnStore", ::std::errc::operation_not_supported);
566 [](
co_nmt_t*
nmt, uint8_t cs,
void* data) noexcept {
567 static_cast<Impl_*>(data)->OnCsInd(nmt, cs);
573 [](
co_nmt_t*
nmt, uint8_t
id,
int state,
int reason,
574 void* data) noexcept {
575 static_cast<Impl_*>(data)->OnHbInd(nmt, id, state, reason);
581 [](
co_nmt_t*
nmt, uint8_t
id, uint8_t st,
void* data) noexcept {
582 static_cast<Impl_*>(data)->OnStInd(nmt, id, st);
589 [](
co_nmt_t*
nmt, uint8_t cnt,
void* data) noexcept {
590 static_cast<Impl_*>(data)->OnSyncInd(nmt, cnt);
597 Node::Impl_::OnCsInd(
co_nmt_t* nmt, uint8_t cs) noexcept {
606 [](
co_lss_t* lss, uint16_t rate,
int delay,
void* data) noexcept {
607 static_cast<Impl_*
>(data)->OnRateInd(lss, rate, delay);
613 [](
co_lss_t* lss, uint8_t
id, uint16_t rate,
void* data) noexcept {
614 return static_cast<Impl_*
>(data)->OnStoreInd(lss,
id, rate);
627 [](
co_sync_t* sync, uint16_t eec, uint8_t er,
void* data) noexcept {
628 static_cast<Impl_*
>(data)->OnSyncErr(sync, eec, er);
639 [](
co_time_t* time,
const timespec* tp,
void* data) noexcept {
640 static_cast<Impl_*
>(data)->OnTimeInd(time, tp);
651 [](
co_emcy_t* emcy, uint8_t
id, uint16_t eec, uint8_t er,
652 uint8_t msef[5],
void* data) noexcept {
653 static_cast<Impl_*
>(data)->OnEmcyInd(emcy,
id, eec, er, msef);
662 for (
int i = 1; i <= 512; i++) {
667 [](
co_rpdo_t* pdo, uint32_t ac,
const void* ptr,
size_t n,
668 void* data) noexcept {
669 static_cast<Impl_*
>(data)->OnRpdoInd(pdo, ac, ptr, n);
675 [](
co_rpdo_t* pdo, uint16_t eec, uint8_t er,
void* data) noexcept {
676 static_cast<Impl_*
>(data)->OnRpdoErr(pdo, eec, er);
683 for (
int i = 1; i <= 512; i++) {
688 [](
co_tpdo_t* pdo, uint32_t ac,
const void* ptr,
size_t n,
689 void* data) noexcept {
690 static_cast<Impl_*
>(data)->OnTpdoInd(pdo, ac, ptr, n);
700 self->UpdateRpdoMapping();
703 self->UpdateTpdoMapping();
711 util::UnlockGuard<util::BasicLockable> unlock(*
self);
717 Node::Impl_::OnHbInd(
co_nmt_t* nmt, uint8_t
id,
int state,
718 int reason) noexcept {
725 self->OnHeartbeat(
id, occurred);
728 auto f = on_heartbeat;
729 util::UnlockGuard<util::BasicLockable> unlock(*
self);
735 Node::Impl_::OnStInd(
co_nmt_t* nmt, uint8_t
id, uint8_t st) noexcept {
741 self->OnState(
id,
static_cast<NmtState>(st));
745 util::UnlockGuard<util::BasicLockable> unlock(*
self);
753 Node::Impl_::OnRpdoInd(
co_rpdo_t* pdo, uint32_t ac,
const void* ptr,
762 auto buf =
static_cast<const uint8_t*
>(ptr);
764 self->RpdoWrite(buf[0],
ldle_u16(buf + 1), buf[3]);
769 self->OnRpdo(num,
static_cast<SdoErrc>(ac), ptr, n);
773 util::UnlockGuard<util::BasicLockable> unlock(*
self);
774 f(num,
static_cast<SdoErrc>(ac), ptr, n);
779 Node::Impl_::OnRpdoErr(
co_rpdo_t* pdo, uint16_t eec, uint8_t er) noexcept {
781 self->OnRpdoError(num, eec, er);
784 auto f = on_rpdo_error;
785 util::UnlockGuard<util::BasicLockable> unlock(*
self);
794 Node::Impl_::OnTpdoInd(
co_tpdo_t* pdo, uint32_t ac,
const void* ptr,
797 self->OnTpdo(num,
static_cast<SdoErrc>(ac), ptr, n);
801 util::UnlockGuard<util::BasicLockable> unlock(*
self);
802 f(num,
static_cast<SdoErrc>(ac), ptr, n);
810 Node::Impl_::OnSyncInd(
co_nmt_t*, uint8_t cnt) noexcept {
811 auto t =
self->GetClock().gettime();
812 self->OnSync(cnt, t);
816 util::UnlockGuard<util::BasicLockable> unlock(*
self);
822 Node::Impl_::OnSyncErr(
co_sync_t*, uint16_t eec, uint8_t er) noexcept {
823 self->OnSyncError(eec, er);
826 auto f = on_sync_error;
827 util::UnlockGuard<util::BasicLockable> unlock(*
self);
836 Node::Impl_::OnTimeInd(
co_time_t*,
const timespec* tp) noexcept {
838 ::std::chrono::system_clock::time_point abs_time(util::from_timespec(*tp));
839 self->OnTime(abs_time);
843 util::UnlockGuard<util::BasicLockable> unlock(*
self);
851 Node::Impl_::OnEmcyInd(
co_emcy_t*, uint8_t
id, uint16_t ec, uint8_t er,
852 uint8_t msef[5]) noexcept {
853 self->OnEmcy(
id, ec, er, msef);
857 util::UnlockGuard<util::BasicLockable> unlock(*
self);
866 Node::Impl_::OnRateInd(
co_lss_t*, uint16_t rate,
int delay) noexcept {
867 self->OnSwitchBitrate(rate * 1000, ::std::chrono::milliseconds(delay));
869 if (on_switch_bitrate) {
870 auto f = on_switch_bitrate;
871 util::UnlockGuard<util::BasicLockable> unlock(*
self);
872 f(rate * 1000, ::std::chrono::milliseconds(delay));
877 Node::Impl_::OnStoreInd(
co_lss_t*, uint8_t
id, uint16_t rate) noexcept {
879 self->OnStore(
id, rate * 1000);
890 Node::Impl_::RpdoRtr(
int num) noexcept {
#define CAN_MAX_LEN
The maximum number of bytes in the payload of a CAN format frame.
The CANopen device description.
__co_dev * dev() const noexcept
Returns a pointer to the internal CANopen device from <lely/co/dev.hpp>.
uint8_t id() const noexcept
Returns the node-ID.
void lock() override
Blocks until a lock can be obtained for the current execution agent (thread, process,...
void unlock() override
Releases the lock held by the execution agent. Throws no exceptions.
The base class for CANopen nodes.
ev::Future< void, ::std::exception_ptr > AsyncWait(ev_exec_t *exec, const time_point &t, io_tqueue_wait **pwait=nullptr)
Submits an asynchronous wait operation and creates a future which becomes ready once the wait operati...
void Reset()
(Re)starts the node.
void OnSyncError(::std::function< void(uint16_t, uint8_t)> on_sync_error)
Registers the function to be invoked when the data length of a received SYNC message does not match.
void OnSync(::std::function< void(uint8_t, const time_point &)> on_sync)
Registers the function to be invoked when a SYNC message is sent/received.
void OnState(::std::function< void(uint8_t, NmtState)> on_state)
Registers the function to be invoked when an NMT state change or boot-up event is detected for a remo...
void ConfigHeartbeat(uint8_t id, const ::std::chrono::milliseconds &ms, ::std::error_code &ec)
Configures heartbeat consumption for the specified node by updating CANopen object 1016 (Consumer hea...
void SetTime()
Updates the CAN network time.
void OnCanError(::std::function< void(io::CanError)> on_can_error)
Registers the function to be invoked when an error is detected on the CAN bus.
void OnCommand(::std::function< void(NmtCommand)> on_command)
Registers the function to be invoked when an NMT command is received from the master.
void OnSwitchBitrate(::std::function< void(int, ::std::chrono::milliseconds)> on_switch_bitrate)
Registers the function to be invoked when the LSS master activates the bit rate of all CANopen device...
Node(ev_exec_t *exec, io::TimerBase &timer, io::CanChannelBase &chan, const ::std::string &dcf_txt, const ::std::string &dcf_bin="", uint8_t id=0xff)
Creates a new CANopen node.
__co_nmt * nmt() const noexcept
Returns a pointer to the internal CANopen NMT master/slave service from <lely/co/nmt....
io::ContextBase GetContext() const noexcept
Returns the underlying I/O context with which this context is registered.
void TpdoEvent(int num=0) noexcept
Triggers the transmission of an acyclic or event-driven PDO.
void OnHeartbeat(::std::function< void(uint8_t, bool)> on_heartbeat)
Registers the function to be invoked when a heartbeat timeout event occurs or is resolved.
ev::Future< void, ::std::exception_ptr > AsyncSwitchBitrate(io::CanControllerBase &ctrl, int bitrate, ::std::chrono::milliseconds delay)
Stops the specified CAN controller and submits asynchronous operations to wait for the delay period,...
__can_net * net() const noexcept
Returns a pointer to the internal CAN network interface from <lely/can/net.h>.
ev::Executor GetExecutor() const noexcept
Returns the executor used to process I/O and CANopen events.
void OnTime(::std::function< void(const ::std::chrono::system_clock::time_point &)> on_time)
Registers the function to be invoked when a TIME message is received.
void OnRpdo(::std::function< void(int, ::std::error_code, const void *, ::std::size_t)> on_rpdo)
Registers the function to be invoked when a Receive-PDO is processed.
void OnRpdoError(::std::function< void(int, uint16_t, uint8_t)> on_rpdo_error)
Registers the function to be invoked when a Receive-PDO length mismatch or timeout error occurs.
void OnTpdo(::std::function< void(int, ::std::error_code, const void *, ::std::size_t)> on_tpdo)
Registers the function to be invoked after a Transmit-PDO is sent or an error occurs.
io::Clock GetClock() const noexcept
Returns the clock used by the timer.
bool AbortWait(io_tqueue_wait &wait) noexcept
Aborts the specified wait operation if it is pending.
void OnEmcy(::std::function< void(uint8_t, uint16_t, uint8_t, uint8_t[5])> on_emcy)
Registers the function to be invoked when an EMCY message is received.
void OnCanState(::std::function< void(io::CanState, io::CanState)> on_can_state)
Registers the function to be invoked when a CAN bus state change is detected.
void SubmitWait(const time_point &t, io_tqueue_wait &wait)
Submits a wait operation.
void RpdoRtr(int num=0) noexcept
Requests the transmission of a PDO by sending a CAN frame with the RTR (Remote Transmission Request) ...
bool CancelWait(io_tqueue_wait &wait) noexcept
Cancels the specified wait operation if it is pending.
The type of exception thrown when an SDO abort code is received.
The type of objects thrown as exceptions to report a system error with an associated error code.
An abstract task executor. This class is a wrapper around #ev_exec_t*.
A reference to an abstract CAN channel.
A reference to an abstract CAN controller.
void stop(::std::error_code &ec) noexcept
void set_bitrate(int nominal, int data, ::std::error_code &ec) noexcept
void restart(::std::error_code &ec) noexcept
Clock get_clock() const noexcept
void unlock() final
Releases the lock held by the execution agent. Throws no exceptions.
void lock() final
Blocks until a lock can be obtained for the current execution agent (thread, process,...
void set_time()
Updates the CAN network time.
virtual void on_can_error(CanError error) noexcept
The function invoked when an error is detected on the CAN bus.
ev::Executor get_executor() const noexcept
virtual void on_can_state(CanState new_state, CanState old_state) noexcept
The function invoked when a CAN bus state change is detected.
ContextBase get_ctx() const noexcept
An abstract clock. This class is a wrapper around #io_clock_t*.
A refence to an I/O context. This class is a wrapper around #io_ctx_t*.
A reference to an abstract timer.
This header file is part of the CANopen library; it contains the device description declarations.
co_unsigned8_t co_dev_get_id(const co_dev_t *dev)
Returns the node-ID of a CANopen device.
This header file is part of the CANopen library; it contains the time stamp (TIME) object declaration...
void co_time_set_ind(co_time_t *time, co_time_ind_t *ind, void *data)
Sets the indication function invoked when a CANopen time stamp is received.
This is the internal header file of the C++ CANopen application library.
This header file is part of the CANopen library; it contains the emergency (EMCY) object declarations...
void co_emcy_set_ind(co_emcy_t *emcy, co_emcy_ind_t *ind, void *data)
Sets the indication function invoked when a CANopen EMCY message is received.
This header file is part of the utilities library; it contains the byte order (endianness) function d...
uint_least16_t ldle_u16(const uint_least8_t src[2])
Loads a 16-bit unsigned integer in little-endian byte order.
CanError
The error flags of a CAN bus, which are not mutually exclusive.
CanState
The states of a CAN node, depending on the TX/RX error count.
int get_errc(void)
Returns the last (thread-specific) native error code set by a system call or library function.
void set_errc(int errc)
Sets the current (thread-specific) native error code to errc.
const struct ev_exec_vtbl *const ev_exec_t
An abstract task executor.
This header file is part of the CANopen library; it contains the Layer Setting Services (LSS) and pro...
void co_lss_set_store_ind(co_lss_t *lss, co_lss_store_ind_t *ind, void *data)
Sets the indication function invoked when an LSS 'store configuration' request is received.
void co_lss_set_rate_ind(co_lss_t *lss, co_lss_rate_ind_t *ind, void *data)
Sets the indication function invoked when an LSS 'activate bit timing' request is received.
SdoErrc
The SDO abort codes.
NmtCommand
The NMT command specifiers.
This header file is part of the CANopen library; it contains the network management (NMT) declaration...
co_tpdo_t * co_nmt_get_tpdo(const co_nmt_t *nmt, co_unsigned16_t n)
Returns a pointer to a Transmit-PDO service.
void co_nmt_destroy(co_nmt_t *nmt)
Destroys a CANopen NMT master/slave service.
void co_nmt_set_sync_ind(co_nmt_t *nmt, co_nmt_sync_ind_t *ind, void *data)
Sets the indication function invoked by co_nmt_on_sync() after all PDOs have been transmitted/process...
co_nmt_t * co_nmt_create(can_net_t *net, co_dev_t *dev)
Creates a new CANopen NMT master/slave service.
int co_nmt_cs_ind(co_nmt_t *nmt, co_unsigned8_t cs)
Processes an NMT command from the master or the application.
#define CO_NMT_CS_START
The NMT command specifier 'start'.
co_dev_t * co_nmt_get_dev(const co_nmt_t *nmt)
Returns a pointer to the CANopen device of an NMT master/slave service.
void co_nmt_on_st(co_nmt_t *nmt, co_unsigned8_t id, co_unsigned8_t st)
Implements the default behavior when a state change is detected by the node guarding or heartbeat pro...
void co_nmt_set_hb_ind(co_nmt_t *nmt, co_nmt_hb_ind_t *ind, void *data)
Sets the indication function invoked when a heartbeat event occurs.
#define CO_NMT_CS_ENTER_PREOP
The NMT command specifier 'enter pre-operational'.
#define CO_NMT_CS_RESET_NODE
The NMT command specifier 'reset node'.
void co_nmt_on_tpdo_event(co_nmt_t *nmt, co_unsigned16_t n)
Implements the default behavior when an event is indicated for an event-driven (asynchronous) Transmi...
co_rpdo_t * co_nmt_get_rpdo(const co_nmt_t *nmt, co_unsigned16_t n)
Returns a pointer to a Receive-PDO service.
void co_nmt_on_tpdo_event_lock(co_nmt_t *nmt)
Postpones the transmission of PDOs triggered by co_nmt_on_tpdo_event() until a matching call to co_nm...
void co_nmt_on_err(co_nmt_t *nmt, co_unsigned16_t eec, co_unsigned8_t er, const co_unsigned8_t msef[5])
Implements the default error handling behavior by generating an EMCY message with co_emcy_push() and ...
void co_nmt_on_tpdo_event_unlock(co_nmt_t *nmt)
Undoes the effect of a single call to co_nmt_on_tpdo_event_lock() and possibly triggers the transmiss...
void co_nmt_on_hb(co_nmt_t *nmt, co_unsigned8_t id, int state, int reason)
Implements the default behavior when a heartbeat event occurs (see sections 7.2.8....
@ CO_NMT_EC_TIMEOUT
An NMT error control timeout event.
co_sync_t * co_nmt_get_sync(const co_nmt_t *nmt)
Returns a pointer to the SYNC producer/consumer service.
co_emcy_t * co_nmt_get_emcy(const co_nmt_t *nmt)
Returns a pointer to the EMCY producer/consumer service.
co_unsigned32_t co_dev_cfg_hb(co_dev_t *dev, co_unsigned8_t id, co_unsigned16_t ms)
Configures heartbeat consumption for the specified node by updating CANopen object 1016 (Consumer hea...
co_lss_t * co_nmt_get_lss(const co_nmt_t *nmt)
Returns a pointer to the LSS master/slave service.
void co_nmt_set_cs_ind(co_nmt_t *nmt, co_nmt_cs_ind_t *ind, void *data)
Sets the indication function invoked when an NMT command is received.
@ CO_NMT_EC_OCCURRED
An NMT error control event occurred.
void co_nmt_set_st_ind(co_nmt_t *nmt, co_nmt_st_ind_t *ind, void *data)
Sets the indication function invoked when a state change is detected.
#define CO_NMT_CS_RESET_COMM
The NMT command specifier 'reset communication'.
co_time_t * co_nmt_get_time(const co_nmt_t *nmt)
Returns a pointer to the TIME producer/consumer service.
This header file is part of the C++ CANopen application library; it contains the CANopen node declara...
#define CO_PDO_MAP_SAM_MPDO
The value of sub-index 0 of the PDO mapping parameter record indicating a a source address mode multi...
This header file is part of the CANopen library; it contains the Receive-PDO declarations.
int co_rpdo_rtr(co_rpdo_t *pdo)
Requests the transmission of a PDO.
void co_rpdo_set_err(co_rpdo_t *pdo, co_rpdo_err_t *err, void *data)
Sets the error handling function of a Receive-PDO service.
const struct co_pdo_map_par * co_rpdo_get_map_par(const co_rpdo_t *pdo)
Returns a pointer to the PDO mapping parameter record of a Receive-PDO.
co_unsigned16_t co_rpdo_get_num(const co_rpdo_t *pdo)
Returns the PDO number of a Receive-PDO.
void co_rpdo_set_ind(co_rpdo_t *pdo, co_rpdo_ind_t *ind, void *data)
Sets the indication function invoked when a Receive-PDO error occurs.
A CANopen EMCY producer/consumer service.
A CANopen LSS master/slave service.
A CANopen NMT master/slave service.
A CANopen SYNC producer/consumer service.
A CANopen TIME producer/consumer service.
A wait operation suitable for use with a timer queue.
struct timespec value
The absolute expiration time.
The internal implementation of the CANopen node.
This header file is part of the CANopen library; it contains the synchronization (SYNC) object declar...
void co_sync_set_err(co_sync_t *sync, co_sync_err_t *err, void *data)
Sets the error handling function of a SYNC consumer service.
This header file is part of the CANopen library; it contains the Transmit-PDO declarations.
int co_dam_mpdo_event(co_tpdo_t *pdo, co_unsigned8_t id, co_unsigned16_t idx, co_unsigned8_t subidx, const co_unsigned8_t data[4])
Triggers the transmission of a DAM-MPDO.
void co_tpdo_set_ind(co_tpdo_t *pdo, co_tpdo_ind_t *ind, void *data)
Sets the indication function invoked when a Transmit-PDO is sent or an error occurs.
co_unsigned16_t co_tpdo_get_num(const co_tpdo_t *pdo)
Returns the PDO number of a Transmit-PDO.
size_t io_tqueue_abort_wait(io_tqueue_t *tq, struct io_tqueue_wait *wait)
Aborts the specified timer queue wait operation if it is pending.
size_t io_tqueue_cancel_wait(io_tqueue_t *tq, struct io_tqueue_wait *wait)
Cancels the specified timer queue wait operation if it is pending.
ev_future_t * io_tqueue_async_wait(io_tqueue_t *tq, ev_exec_t *exec, const struct timespec *value, struct io_tqueue_wait **pwait)
Submits an asynchronous wait operation to a timer queue and creates a future which becomes ready once...
void io_tqueue_submit_wait(io_tqueue_t *tq, struct io_tqueue_wait *wait)
Submits a wait operation to a timer queue.
This header file is part of the CANopen library; it contains the CANopen value declarations.
size_t co_val_write(co_unsigned16_t type, const void *val, uint_least8_t *begin, uint_least8_t *end)
Writes a value of the specified data type to a memory buffer.