|
CANOPEN_CLIENT Driver 0.1.0
API reference
|
A CANopen client on one CAN bus. More...
#include <canopen_client.hpp>
Public Member Functions | |
| Client (Port &port, const Config &config={}) noexcept | |
| Bind the driver to a port and store the configuration. No I/O, cannot fail. | |
| Client (const Client &)=delete | |
| One driver object per bus. | |
| Client & | operator= (const Client &)=delete |
| One driver object per bus. | |
| Result< void > | EnsureInitialized () noexcept |
| Start the client, once: the only way to initialise the driver. | |
| bool | IsInitialized () const noexcept |
| Result< void > | Deinitialize () noexcept |
| Mark the driver uninitialised and forget what it received. No bus traffic: nodes are left in the state they are in (send the NMT command you want first). | |
| Result< void > | SetConfig (const Config &config) noexcept |
| Replace the configuration. | |
| const Config & | GetConfig () const &noexcept |
| void | GetConfig () const &&=delete |
| Not on a temporary driver: the reference would dangle (handbook KB-CPP20-044). | |
| Result< void > | SendNmt (NmtCommand command, uint8_t node) noexcept |
| Send an NMT command. Never refused for a state reason: Stop and every other command go out whatever the driver believes about the node or a transfer in flight. A reset command also restarts the guarding toggle of the node (or of every node). | |
| Result< void > | SendSync (uint8_t counter=0) noexcept |
Send one SYNC frame, with a counter byte when counter is not 0. | |
| Result< void > | SendRpdo (uint16_t cob_id, std::span< const uint8_t > data) noexcept |
| Send a PDO the node consumes (an RPDO from the node's side). | |
| Result< void > | SdoDownloadUnconfirmed (uint8_t node, uint16_t index, uint8_t sub, std::span< const uint8_t > data) noexcept |
Write 1 to 4 bytes to an object with an expedited SDO download and do not wait for the reply: the transmit-only mode's write. The node's answer, including an abort, is not read, so a failed write is not noticed. Use SdoDownload() when the port can receive. | |
| Result< void > | SendRawFrame (const CanFrame &frame) noexcept |
Diagnostic: send one frame exactly as given. A single Send(): no retry, no routing, and none of the driver's state (node table, toggle bits, node states) is touched. It bypasses the safety and state guards: any frame goes out, an NMT command or a controlword included, and the node table does not learn of it. Stop and disable with SendNmt(), DriveDisable() and DriveQuickStop(). | |
| Result< CanFrame > | ReadRawFrame (uint32_t timeout_us) noexcept |
Diagnostic: take the next frame from the port as it is. One Receive(): no retry, no routing, no validation beyond the port's framing; the node table, the EMCY queue and the TPDO samples do not see the frame. The frame is also kept for GetLastRawFrame(). | |
| Result< CanFrame > | ReadRawSdo (uint8_t node, uint16_t index, uint8_t sub) noexcept |
Diagnostic: one SDO initiate-upload request and the first frame the node's SDO server (identifier 0x580 + node) answers with, returned as received. One request, no retry, no segment follow-up, no toggle, size or multiplexer check, no node-state gate and no abort on a timeout. The receive queue is drained first (routed as usual), so the frame returned arrived after the request. Other frames that arrive meanwhile are routed as usual. Use it to see what a node really sends; use SdoUpload() to read an object. | |
| Result< CanFrame > | WriteRawSdo (uint8_t node, uint16_t index, uint8_t sub, std::span< const uint8_t > data) noexcept |
Diagnostic: one expedited SDO download request of 1 to 4 bytes and the first frame the node's SDO server answers with, returned as received (a download response or an abort). The same rules as ReadRawSdo(). | |
| const CanFrame & | GetLastRawFrame () const &noexcept |
| void | GetLastRawFrame () const &&=delete |
| Not on a temporary driver: the reference would dangle (handbook KB-CPP20-044). | |
| Result< FrameClass > | Poll (uint32_t timeout_us) noexcept |
Wait up to timeout_us for one frame and route it: heartbeat to the node table, EMCY to the queue, a subscribed TPDO to its sample, SYNC counted. A frame nobody asked for (including an SDO reply with no request in flight) is dropped and counted. | |
| Result< void > | MonitorNode (uint8_t node, uint32_t timeout_us) noexcept |
| Watch a node's heartbeat. Registering again changes the timeout and keeps what was received. | |
| Result< void > | UnmonitorNode (uint8_t node) noexcept |
| Stop watching a node. | |
| Result< NodeStatus > | GetNodeStatus (uint8_t node) noexcept |
What the consumer knows about a watched node; alive is judged now. The age is a 32-bit microsecond difference, so a heartbeat older than 71.6 minutes can look fresh: call this or Poll() at least hourly. | |
| Result< void > | ClearBootUp (uint8_t node) noexcept |
Forget that a boot-up message was seen from a node (NodeStatus::bootup_seen), so the next one (the node reset on its own) can be told from the first. The flag is otherwise set once and cleared only by an NMT reset this driver sends. | |
| Result< NmtState > | GuardNode (uint8_t node) noexcept |
| One node-guarding exchange: a remote frame on 0x700 + node, then the reply, whose toggle bit must alternate (the first reply after a reset has it clear). A reply with the wrong toggle fails and resynchronises the expected bit to the one after it. | |
| bool | PopEmcy (EmcyEvent &event) noexcept |
| Take the oldest queued emergency message. | |
| const Stats & | GetStats () const &noexcept |
| void | GetStats () const &&=delete |
| Not on a temporary driver: the reference would dangle (handbook KB-CPP20-044). | |
| Result< void > | SubscribeTpdo (uint16_t cob_id, uint8_t dlc) noexcept |
Hold the latest frame of a TPDO identifier for ReadTpdo(). | |
| Result< void > | UnsubscribeTpdo (uint16_t cob_id) noexcept |
| Stop holding a TPDO identifier. | |
| Result< PdoSample > | ReadTpdo (uint16_t cob_id) const noexcept |
| The latest frame received on a subscribed identifier. | |
| Result< std::size_t > | SdoUpload (uint8_t node, uint16_t index, uint8_t sub, std::span< uint8_t > out) noexcept |
| Read an object: expedited when the node answers so, otherwise segmented. A reply that is not the answer to this request (another object, another command, a wrong toggle bit, the wrong length) never counts; see the Contract page. | |
| Result< void > | SdoDownload (uint8_t node, uint16_t index, uint8_t sub, std::span< const uint8_t > data) noexcept |
| Write an object: expedited for 1 to 4 bytes, segmented for more. | |
| Result< uint8_t > | SdoReadU8 (uint8_t node, uint16_t index, uint8_t sub) noexcept |
| Read an unsigned 8-bit object. | |
| Result< uint16_t > | SdoReadU16 (uint8_t node, uint16_t index, uint8_t sub) noexcept |
| Read an unsigned 16-bit object. | |
| Result< uint32_t > | SdoReadU32 (uint8_t node, uint16_t index, uint8_t sub) noexcept |
| Read an unsigned 32-bit object. | |
| Result< void > | SdoWriteU8 (uint8_t node, uint16_t index, uint8_t sub, uint8_t value) noexcept |
| Write an unsigned 8-bit object (expedited, one byte). | |
| Result< void > | SdoWriteU16 (uint8_t node, uint16_t index, uint8_t sub, uint16_t value) noexcept |
| Write an unsigned 16-bit object (expedited, two bytes). | |
| Result< void > | SdoWriteU32 (uint8_t node, uint16_t index, uint8_t sub, uint32_t value) noexcept |
| Write an unsigned 32-bit object (expedited, four bytes). | |
| const SdoAbortInfo & | GetLastAbort () const &noexcept |
| The last SDO abort, sent by a node or by this driver. No I/O. | |
| void | GetLastAbort () const &&=delete |
| Not on a temporary driver: the reference would dangle (handbook KB-CPP20-044). | |
| Result< uint32_t > | ReadDeviceType (uint8_t node) noexcept |
| Read the device type (object 0x1000). | |
| Result< uint8_t > | ReadErrorRegister (uint8_t node) noexcept |
| Read the error register (object 0x1001). | |
| Result< void > | WriteHeartbeatProducerTime (uint8_t node, uint16_t period_ms) noexcept |
| Set the node's heartbeat producer time (object 0x1017). | |
| Result< void > | StoreParameters (uint8_t node, uint8_t group) noexcept |
| Store parameters to non-volatile memory (object 0x1010, signature "save"). | |
| Result< void > | RestoreDefaults (uint8_t node, uint8_t group) noexcept |
| Restore default parameters (object 0x1011, signature "load"); they apply after the next reset of the node. | |
| Result< void > | ConfigureSync (uint32_t period_us, uint8_t counter_overflow) noexcept |
Set the SYNC period ServiceSync() keeps. | |
| Result< bool > | ServiceSync () noexcept |
Send a SYNC when the period has elapsed since the last one (the first call after ConfigureSync() sends at once). Call it at least as often as the period; a late call sends one SYNC and starts the next period from now, it never sends a burst to catch up. | |
| Result< void > | ConfigurePdo (uint8_t node, PdoKind kind, uint16_t number, const PdoConfig &config) noexcept |
Configure a PDO of a node over SDO, in the order the profile prescribes: invalidate the COB-ID, write the transmission type (and for a TPDO the inhibit time and event timer when not 0), clear the mapping count, write each entry, write the count, then write the COB-ID valid (when config.enabled). A failure leaves the PDO invalid, never half-configured and valid. | |
| Result< void > | DisablePdo (uint8_t node, PdoKind kind, uint16_t number) noexcept |
| Invalidate a PDO (set bit 31 of its COB-ID, keeping the identifier). | |
| Result< PdoConfig > | ReadPdoConfig (uint8_t node, PdoKind kind, uint16_t number) noexcept |
| Read a PDO's identifier, validity, transmission type and mapping back. | |
| Result< uint16_t > | ReadStatusword (uint8_t node, const DriveObjects &objects={}) noexcept |
| Read the statusword. | |
| Result< DriveState > | ReadDriveState (uint8_t node, const DriveObjects &objects={}) noexcept |
| Read the statusword and decode the drive state. | |
| Result< void > | DriveEnable (uint8_t node, const DriveObjects &objects={}) noexcept |
Walk the drive to Operation enabled: shutdown, switch on, enable operation, reading the statusword after each controlword and pausing Config::drive_poll_interval_us. Each state gets one controlword, so a slow drive's transition is never restarted. From Quick stop active it first disables voltage. It does not clear a fault. | |
| Result< void > | DriveDisable (uint8_t node, const DriveObjects &objects={}) noexcept |
Disable voltage (controlword 0x0000), from any state. Never refused: it ignores the node's heartbeat state and any earlier failure, including a Receive() error (the receive queue is dropped and the request is sent anyway), and is attempted Config::safety_attempts times until the node acknowledges it. A port that cannot send, or a node that never answers, still ends in an error: the attempts are bounded. | |
| Result< void > | DriveQuickStop (uint8_t node, const DriveObjects &objects={}) noexcept |
Quick stop (controlword 0x0002). Never refused, retried like DriveDisable(). | |
| Result< void > | DriveResetFault (uint8_t node, const DriveObjects &objects={}) noexcept |
Reset a fault: wait out Fault reaction active, then give controlword bit 7 a rising edge and wait for the drive to leave Fault. A drive that is not in a fault state is left as it is; one whose statusword is no state is DriveFault. Both waits together take at most Config::drive_timeout_us. On success the controlword is 0x0000 again (bit 7 low). | |
| Result< void > | SetDriveMode (uint8_t node, OperationMode mode, const DriveObjects &objects={}, Verify verify=Verify::None) noexcept |
| Select the mode of operation. | |
| Result< OperationMode > | ReadDriveMode (uint8_t node, const DriveObjects &objects={}) noexcept |
| Read the mode of operation display. | |
A CANopen client on one CAN bus.
Lifecycle: construct with the configuration (no I/O), then EnsureInitialized(), the one way to start, use, optionally Deinitialize(). Every call that touches the bus returns Error::NotInitialized until EnsureInitialized() has succeeded; no call starts it as a side effect.
Two kinds of port. A CanPort (hooks EnsureInitialized and Send) gives the transmit-only mode: SendNmt(), SendSync(), SendRpdo() and SdoDownloadUnconfirmed(). A CanRxPort adds Receive and NowUs and gives everything else; the calls that need a reply are constrained on it and do not exist on a transmit-only port.
One request is in flight at a time. The class is not thread-safe: call it from one task, or serialise the calls.
Optional hook: void Log(LogLevel, const char* message) noexcept.
| Port | Your class derived from CanInterface<Port>. |
|
inlineexplicitnoexcept |
Bind the driver to a port and store the configuration. No I/O, cannot fail.
| port | The port; it must outlive the driver. |
| config | The timeouts and options, checked by EnsureInitialized() before any I/O. |
|
noexcept |
Forget that a boot-up message was seen from a node (NodeStatus::bootup_seen), so the next one (the node reset on its own) can be told from the first. The flag is otherwise set once and cleared only by an NMT reset this driver sends.
| node | A node registered with MonitorNode(). |
Ok, NotInitialized or InvalidArgument (not watched).
|
noexcept |
Configure a PDO of a node over SDO, in the order the profile prescribes: invalidate the COB-ID, write the transmission type (and for a TPDO the inhibit time and event timer when not 0), clear the mapping count, write each entry, write the count, then write the COB-ID valid (when config.enabled). A failure leaves the PDO invalid, never half-configured and valid.
| node | The server, 1 to 127. |
| kind | Receive (RPDO) or transmit (TPDO) from the node's side. |
| number | The PDO number, 1 to 512. |
| config | The parameters; it must pass ValidatePdoConfig() and map at least one entry. |
Ok, InvalidArgument (nothing is sent) or the errors of SdoWriteU32().
|
noexcept |
Set the SYNC period ServiceSync() keeps.
| period_us | The period, 100 us to 60 s, or 0 to stop. |
| counter_overflow | 0 for no counter byte, or 2 to 240: the counter counts 1 up to it, then wraps to 1. |
Ok, NotInitialized or InvalidArgument.
|
noexcept |
Mark the driver uninitialised and forget what it received. No bus traffic: nodes are left in the state they are in (send the NMT command you want first).
Ok.
|
noexcept |
Invalidate a PDO (set bit 31 of its COB-ID, keeping the identifier).
| node | The server, 1 to 127. |
| kind | Receive or transmit. |
| number | The PDO number, 1 to 512. |
Ok or the errors of SdoReadU32() and SdoWriteU32().
|
noexcept |
Disable voltage (controlword 0x0000), from any state. Never refused: it ignores the node's heartbeat state and any earlier failure, including a Receive() error (the receive queue is dropped and the request is sent anyway), and is attempted Config::safety_attempts times until the node acknowledges it. A port that cannot send, or a node that never answers, still ends in an error: the attempts are bounded.
| node | The server, 1 to 127. |
| objects | The drive's object indices. |
Ok, NotInitialized, InvalidArgument, or the error of the last attempt (Bus when the port's Receive() failed, after the frame was sent).
|
noexcept |
Walk the drive to Operation enabled: shutdown, switch on, enable operation, reading the statusword after each controlword and pausing Config::drive_poll_interval_us. Each state gets one controlword, so a slow drive's transition is never restarted. From Quick stop active it first disables voltage. It does not clear a fault.
| node | The server, 1 to 127. |
| objects | The drive's object indices. |
Ok, DriveFault (Fault, or a statusword that is no state), Timeout (Config::drive_timeout_us passed without reaching it: the last controlword written may still take effect, so follow a Timeout with DriveDisable() if the drive must not run) or the SDO errors.
|
noexcept |
Quick stop (controlword 0x0002). Never refused, retried like DriveDisable().
| node | The server, 1 to 127. |
| objects | The drive's object indices. |
DriveDisable().
|
noexcept |
Reset a fault: wait out Fault reaction active, then give controlword bit 7 a rising edge and wait for the drive to leave Fault. A drive that is not in a fault state is left as it is; one whose statusword is no state is DriveFault. Both waits together take at most Config::drive_timeout_us. On success the controlword is 0x0000 again (bit 7 low).
| node | The server, 1 to 127. |
| objects | The drive's object indices. |
Ok, DriveFault (the fault persists), Timeout or the SDO errors.
|
noexcept |
Start the client, once: the only way to initialise the driver.
The first call checks the configuration, starts the port and clears the node table, the PDO subscriptions, the EMCY queue and the counters. After it succeeds, later calls return Ok at once with no I/O. After it fails, the driver stays uninitialised.
Ok, InvalidArgument (the stored configuration fails Validate(); the port is not touched) or Bus (the port could not start).
|
inlinenoexcept |
|
inlinenoexcept |
The last SDO abort, sent by a node or by this driver. No I/O.
code is 0 when no transfer has aborted since EnsureInitialized().
|
inlinenoexcept |
ReadRawFrame(), ReadRawSdo() or WriteRawSdo() returned (no I/O); all zero before the first.
|
noexcept |
What the consumer knows about a watched node; alive is judged now. The age is a 32-bit microsecond difference, so a heartbeat older than 71.6 minutes can look fresh: call this or Poll() at least hourly.
| node | The node. |
NotInitialized or InvalidArgument (not watched).
|
inlinenoexcept |
|
noexcept |
One node-guarding exchange: a remote frame on 0x700 + node, then the reply, whose toggle bit must alternate (the first reply after a reset has it clear). A reply with the wrong toggle fails and resynchronises the expected bit to the one after it.
| node | A node registered with MonitorNode(). |
NotInitialized, InvalidArgument, Timeout (no reply within Config::guard_timeout_us), Protocol (toggle not alternated) or Bus.
|
inlinenoexcept |
EnsureInitialized(). No I/O.
|
noexcept |
Watch a node's heartbeat. Registering again changes the timeout and keeps what was received.
| node | The node, 1 to 127. |
| timeout_us | How old the last heartbeat may be for alive, 1 ms to 60 s. |
Ok, NotInitialized, InvalidArgument, or BufferTooSmall (the table, of kMonitorCapacity nodes, is full).
|
noexcept |
Wait up to timeout_us for one frame and route it: heartbeat to the node table, EMCY to the queue, a subscribed TPDO to its sample, SYNC counted. A frame nobody asked for (including an SDO reply with no request in flight) is dropped and counted.
| timeout_us | How long to wait; 0 polls once. |
FrameClass::None when none arrived), NotInitialized or Bus.
|
noexcept |
Take the oldest queued emergency message.
| [out] | event | The message; unchanged when the queue is empty. |
|
noexcept |
Read the device type (object 0x1000).
| node | The server, 1 to 127. |
SdoReadU32().
|
noexcept |
Read the mode of operation display.
| node | The server, 1 to 127. |
| objects | The drive's object indices. |
SdoReadU8().
|
noexcept |
Read the statusword and decode the drive state.
| node | The server, 1 to 127. |
| objects | The drive's object indices. |
Unknown for a pattern that is none), or the errors of ReadStatusword().
|
noexcept |
Read the error register (object 0x1001).
| node | The server, 1 to 127. |
SdoReadU8().
|
noexcept |
Read a PDO's identifier, validity, transmission type and mapping back.
| node | The server, 1 to 127. |
| kind | Receive or transmit. |
| number | The PDO number, 1 to 512. |
Unsupported for a 29-bit identifier, BufferTooSmall for a mapping with more than kMaxPdoEntries entries, or the SDO errors.
|
noexcept |
Diagnostic: take the next frame from the port as it is. One Receive(): no retry, no routing, no validation beyond the port's framing; the node table, the EMCY queue and the TPDO samples do not see the frame. The frame is also kept for GetLastRawFrame().
| timeout_us | How long to wait; 0 polls once. |
NotInitialized, Timeout or Bus.
|
noexcept |
Diagnostic: one SDO initiate-upload request and the first frame the node's SDO server (identifier 0x580 + node) answers with, returned as received. One request, no retry, no segment follow-up, no toggle, size or multiplexer check, no node-state gate and no abort on a timeout. The receive queue is drained first (routed as usual), so the frame returned arrived after the request. Other frames that arrive meanwhile are routed as usual. Use it to see what a node really sends; use SdoUpload() to read an object.
| node | The server, 1 to 127. |
| index | The object index. |
| sub | The sub-index. |
NotInitialized, InvalidArgument (nothing is sent), Timeout (Config::sdo_timeout_us) or Bus.
|
noexcept |
Read the statusword.
| node | The server, 1 to 127. |
| objects | The drive's object indices. |
SdoReadU16(); InvalidArgument for an index below 0x1000.
|
noexcept |
The latest frame received on a subscribed identifier.
| cob_id | The identifier. |
sequence 0 means no frame yet), NotInitialized or InvalidArgument.
|
noexcept |
Restore default parameters (object 0x1011, signature "load"); they apply after the next reset of the node.
| node | The server, 1 to 127. |
| group | The sub-index: 1 all, 2 communication, 3 application, 4 manufacturer. |
Ok, InvalidArgument (group not 1 to 4) or the errors of SdoWriteU32().
|
noexcept |
Write an object: expedited for 1 to 4 bytes, segmented for more.
| node | The server, 1 to 127. |
| index | The object index. |
| sub | The sub-index. |
| data | 1 byte or more (at most 2^32 - 1), little-endian. |
Ok, or the errors of SdoUpload() except BufferTooSmall.
|
noexcept |
Write 1 to 4 bytes to an object with an expedited SDO download and do not wait for the reply: the transmit-only mode's write. The node's answer, including an abort, is not read, so a failed write is not noticed. Use SdoDownload() when the port can receive.
| node | The server, 1 to 127. |
| index | The object index. |
| sub | The sub-index. |
| data | 1 to 4 bytes, little-endian. |
Ok, NotInitialized, InvalidArgument or Bus.
|
noexcept |
Read an unsigned 16-bit object.
| node | The server, 1 to 127. |
| index | The object index. |
| sub | The sub-index. |
SdoUpload(); Protocol when the node returns another length than 2.
|
noexcept |
Read an unsigned 32-bit object.
| node | The server, 1 to 127. |
| index | The object index. |
| sub | The sub-index. |
SdoUpload(); Protocol when the node returns another length than 4.
|
noexcept |
Read an unsigned 8-bit object.
| node | The server, 1 to 127. |
| index | The object index. |
| sub | The sub-index. |
SdoUpload(); Protocol when the node returns another length than 1.
|
noexcept |
Read an object: expedited when the node answers so, otherwise segmented. A reply that is not the answer to this request (another object, another command, a wrong toggle bit, the wrong length) never counts; see the Contract page.
The node is refused with NodeState without a frame when its heartbeat says it is Stopped.
| node | The server, 1 to 127. |
| index | The object index. |
| sub | The sub-index. |
| out | Where the data goes. |
NotInitialized, InvalidArgument, NodeState, Bus, Timeout (the driver then sends an SDO abort when Config::abort_on_timeout), SdoAbort (the node aborted: GetLastAbort()), Protocol, or BufferTooSmall (the driver aborts the transfer with 0x05040005; no data is written past out).
|
noexcept |
Write an unsigned 16-bit object (expedited, two bytes).
| node | The server, 1 to 127. |
| index | The object index. |
| sub | The sub-index. |
| value | The value. |
Ok or the errors of SdoDownload().
|
noexcept |
Write an unsigned 32-bit object (expedited, four bytes).
| node | The server, 1 to 127. |
| index | The object index. |
| sub | The sub-index. |
| value | The value. |
Ok or the errors of SdoDownload().
|
noexcept |
Write an unsigned 8-bit object (expedited, one byte).
| node | The server, 1 to 127. |
| index | The object index. |
| sub | The sub-index. |
| value | The value. |
Ok or the errors of SdoDownload().
|
noexcept |
Send an NMT command. Never refused for a state reason: Stop and every other command go out whatever the driver believes about the node or a transfer in flight. A reset command also restarts the guarding toggle of the node (or of every node).
| command | The command. |
| node | The target, 1 to 127, or 0 for every node. |
Ok, NotInitialized, InvalidArgument (node above 127 or a value that is not a command; nothing is sent) or Bus.
|
noexcept |
Diagnostic: send one frame exactly as given. A single Send(): no retry, no routing, and none of the driver's state (node table, toggle bits, node states) is touched. It bypasses the safety and state guards: any frame goes out, an NMT command or a controlword included, and the node table does not learn of it. Stop and disable with SendNmt(), DriveDisable() and DriveQuickStop().
| frame | A frame of the port's classic kind: identifier up to 0x7FF, at most 8 bytes. |
Ok, NotInitialized, InvalidArgument (the frame fails IsValid(); nothing is sent) or Bus.
|
noexcept |
Send a PDO the node consumes (an RPDO from the node's side).
| cob_id | The identifier, kPdoCobIdMin to kPdoCobIdMax. |
| data | 0 to 8 bytes laid out as the node's RPDO mapping says. |
Ok, NotInitialized, InvalidArgument or Bus.
|
noexcept |
Send one SYNC frame, with a counter byte when counter is not 0.
| counter | 0 for a SYNC without data, or 1 to 240. |
Ok, NotInitialized, InvalidArgument or Bus.
|
noexcept |
Send a SYNC when the period has elapsed since the last one (the first call after ConfigureSync() sends at once). Call it at least as often as the period; a late call sends one SYNC and starts the next period from now, it never sends a burst to catch up.
NotInitialized or Bus.
|
noexcept |
Replace the configuration.
| config | The new configuration. |
Ok, or InvalidArgument (it fails Validate(); the old one stays).
|
noexcept |
Select the mode of operation.
| node | The server, 1 to 127. |
| mode | The mode; a manufacturer-specific negative value is a cast of the number. |
| objects | The drive's object indices. |
| verify | Verify::ReadBack reads the mode display until it shows mode, for at most Config::drive_timeout_us (one extra SDO exchange per poll); the default does not. |
Ok, DeviceFault (the display never showed the mode) or the SDO errors.
|
noexcept |
Store parameters to non-volatile memory (object 0x1010, signature "save").
| node | The server, 1 to 127. |
| group | The sub-index: 1 all, 2 communication, 3 application, 4 manufacturer. |
Ok, InvalidArgument (group not 1 to 4) or the errors of SdoWriteU32().
|
noexcept |
Hold the latest frame of a TPDO identifier for ReadTpdo().
| cob_id | The identifier, kPdoCobIdMin to kPdoCobIdMax. |
| dlc | The length every frame on it must have, 1 to 8; others are dropped and counted. |
Ok, NotInitialized, InvalidArgument, or BufferTooSmall (the table, of kPdoSubscriptionCapacity identifiers, is full).
|
noexcept |
Stop watching a node.
| node | The node. |
Ok, NotInitialized or InvalidArgument (not watched).
|
noexcept |
Stop holding a TPDO identifier.
| cob_id | The identifier. |
Ok, NotInitialized or InvalidArgument (not subscribed).
|
noexcept |
Set the node's heartbeat producer time (object 0x1017).
| node | The server, 1 to 127. |
| period_ms | The period in milliseconds; 0 stops the heartbeat. |
Ok or the errors of SdoWriteU16().
|
noexcept |
Diagnostic: one expedited SDO download request of 1 to 4 bytes and the first frame the node's SDO server answers with, returned as received (a download response or an abort). The same rules as ReadRawSdo().
| node | The server, 1 to 127. |
| index | The object index. |
| sub | The sub-index. |
| data | 1 to 4 bytes, little-endian. |
NotInitialized, InvalidArgument, Timeout or Bus.