|
CANOPEN_CLIENT Driver 0.1.0
API reference
|
Pure builders and decoders for every frame the client sends or reads. More...
Functions | |
| constexpr bool | canopen_client::IsNodeId (uint8_t node) noexcept |
| Whether a node identifier is in 1 to 127. | |
| constexpr uint16_t | canopen_client::SdoRequestId (uint8_t node) noexcept |
The identifier of the SDO request frames to node. | |
| constexpr uint16_t | canopen_client::SdoResponseId (uint8_t node) noexcept |
The identifier of the SDO reply frames from node. | |
| constexpr uint16_t | canopen_client::HeartbeatId (uint8_t node) noexcept |
The identifier of the heartbeat and node-guarding frames of node. | |
| constexpr uint16_t | canopen_client::EmcyId (uint8_t node) noexcept |
The identifier of the emergency frames of node. | |
| constexpr bool | canopen_client::IsNmtCommand (uint8_t command) noexcept |
| Whether a command byte is one of the five NMT commands. | |
| constexpr bool | canopen_client::DecodeNmtState (uint8_t raw, NmtState &state) noexcept |
| Decode the state byte of a heartbeat (bit 7 already cleared). | |
| constexpr Result< CanFrame > | canopen_client::MakeNmtFrame (NmtCommand command, uint8_t node) noexcept |
| The NMT command frame: identifier 0x000, two data bytes. | |
| constexpr Result< CanFrame > | canopen_client::MakeSyncFrame (uint8_t counter) noexcept |
| The SYNC frame: identifier 0x080, no data, or one counter byte. | |
| constexpr Result< CanFrame > | canopen_client::MakeGuardRequest (uint8_t node) noexcept |
| The node-guarding request: a remote frame on 0x700 + node. | |
| constexpr Result< CanFrame > | canopen_client::MakePdoFrame (uint16_t cob_id, std::span< const uint8_t > data) noexcept |
| A PDO frame: a valid identifier and 0 to 8 data bytes. | |
| constexpr Result< CanFrame > | canopen_client::MakeSdoUploadRequest (uint8_t node, uint16_t index, uint8_t sub) noexcept |
| The initiate-upload request (read an object): command byte 0x40. | |
| constexpr Result< CanFrame > | canopen_client::MakeSdoExpeditedDownload (uint8_t node, uint16_t index, uint8_t sub, std::span< const uint8_t > data) noexcept |
| The expedited initiate-download request (write 1 to 4 bytes): command byte 0x23 | (4 - size) << 2. | |
| constexpr Result< CanFrame > | canopen_client::MakeSdoSegmentedDownload (uint8_t node, uint16_t index, uint8_t sub, uint32_t size) noexcept |
The segmented initiate-download request announcing size bytes: command byte 0x21. | |
| constexpr Result< CanFrame > | canopen_client::MakeSdoDownloadSegment (uint8_t node, bool toggle, std::span< const uint8_t > data, bool last) noexcept |
| One download segment: command byte toggle << 4 | (7 - length) << 1 | last. | |
| constexpr Result< CanFrame > | canopen_client::MakeSdoUploadSegmentRequest (uint8_t node, bool toggle) noexcept |
| The request for the next upload segment: command byte 0x60 | toggle << 4. | |
| constexpr Result< CanFrame > | canopen_client::MakeSdoAbort (uint8_t node, uint16_t index, uint8_t sub, uint32_t code) noexcept |
| The abort frame the client sends to end a transfer: command byte 0x80. | |
| constexpr Result< SdoReply > | canopen_client::ParseSdoReply (const CanFrame &frame, bool strict) noexcept |
| Decode a frame from an SDO server (identifier 0x580 + node). | |
| constexpr Result< HeartbeatInfo > | canopen_client::ParseHeartbeat (const CanFrame &frame) noexcept |
| Decode a heartbeat, boot-up or node-guarding reply: identifier 0x701 to 0x77F, one byte. | |
| constexpr Result< EmcyEvent > | canopen_client::ParseEmcy (const CanFrame &frame) noexcept |
| Decode an emergency message: identifier 0x081 to 0x0FF, eight bytes (error code, error register, five manufacturer bytes). The timestamp is left 0 for the caller. | |
| constexpr Result< uint16_t > | canopen_client::PdoCommunicationIndex (PdoKind kind, uint16_t number) noexcept |
| The index of the communication parameter record of a PDO. | |
| constexpr Result< uint16_t > | canopen_client::PdoMappingIndex (PdoKind kind, uint16_t number) noexcept |
| The index of the mapping parameter record of a PDO. | |
| constexpr uint32_t | canopen_client::EncodePdoMapEntry (const PdoMapEntry &entry) noexcept |
| The 32-bit mapping record: index << 16 | sub-index << 8 | length in bits. | |
| constexpr PdoMapEntry | canopen_client::DecodePdoMapEntry (uint32_t record) noexcept |
| Split a 32-bit mapping record into its object and length. | |
| constexpr Error | canopen_client::ValidatePdoConfig (const PdoConfig &config) noexcept |
Check a PDO configuration: identifier range, a transmission type that is not reserved (241 to 251), 0 to kMaxPdoEntries entries, each of 1 to 64 bits at a non-zero index, and at most 64 bits in all. | |
| constexpr uint32_t | canopen_client::PdoBitLength (const PdoConfig &config) noexcept |
| The bits the entries of a PDO occupy in all. | |
| constexpr Result< uint64_t > | canopen_client::ExtractBits (std::span< const uint8_t > data, uint32_t offset, uint32_t bits) noexcept |
Read bits bits starting at bit offset of a PDO payload (Intel bit order: bit 0 is the least significant bit of byte 0). | |
| constexpr Result< void > | canopen_client::InsertBits (std::span< uint8_t > data, uint32_t offset, uint32_t bits, uint64_t value) noexcept |
Write the low bits bits of value at bit offset of a PDO payload; the other bits are unchanged. | |
| constexpr DriveState | canopen_client::DecodeStatusword (uint16_t statusword) noexcept |
| Decode the drive state from a statusword (object 0x6041): the masks 0x4F and 0x6F of the state machine, matched exactly. | |
| constexpr bool | canopen_client::EnableStepControlword (DriveState state, uint16_t &word) noexcept |
| The controlword that moves a drive one step toward Operation enabled. | |
Pure builders and decoders for every frame the client sends or reads.
|
constexprnoexcept |
Decode the state byte of a heartbeat (bit 7 already cleared).
| raw | The state, 0, 4, 5 or 127. | |
| [out] | state | The state; unchanged when raw is not a state. |
raw is a defined state.
|
constexprnoexcept |
Split a 32-bit mapping record into its object and length.
| record | The record. |
|
constexprnoexcept |
Decode the drive state from a statusword (object 0x6041): the masks 0x4F and 0x6F of the state machine, matched exactly.
| statusword | The statusword. |
DriveState::Unknown for a bit pattern that is none of them.
|
constexprnoexcept |
The identifier of the emergency frames of node.
| node | The node, 1 to 127 (not checked here). |
|
constexprnoexcept |
The controlword that moves a drive one step toward Operation enabled.
| state | The drive's present state. | |
| [out] | word | The controlword; unchanged when no write helps. |
word is to be written: Switch on disabled (shutdown), Ready to switch on (switch on), Switched on (enable operation), Quick stop active (disable voltage). false for the states that only wait (Not ready to switch on, Fault reaction active) or end the walk (Operation enabled, Fault, Unknown).
|
constexprnoexcept |
The 32-bit mapping record: index << 16 | sub-index << 8 | length in bits.
| entry | The mapped object. |
|
constexprnoexcept |
Read bits bits starting at bit offset of a PDO payload (Intel bit order: bit 0 is the least significant bit of byte 0).
| data | The payload. |
| offset | The first bit. |
| bits | The width, 1 to 64. |
InvalidArgument when the field is empty, wider than 64 bits or ends past the payload.
|
constexprnoexcept |
The identifier of the heartbeat and node-guarding frames of node.
| node | The node, 1 to 127 (not checked here). |
|
constexprnoexcept |
Write the low bits bits of value at bit offset of a PDO payload; the other bits are unchanged.
| data | The payload. |
| offset | The first bit. |
| bits | The width, 1 to 64. |
| value | The value; higher bits are ignored. |
Ok, or InvalidArgument when the field does not fit in the payload.
|
constexprnoexcept |
Whether a command byte is one of the five NMT commands.
| command | The byte. |
command is a defined NmtCommand.
|
constexprnoexcept |
Whether a node identifier is in 1 to 127.
| node | The node identifier. |
The node-guarding request: a remote frame on 0x700 + node.
| node | The node, 1 to 127. |
InvalidArgument.
|
constexprnoexcept |
The NMT command frame: identifier 0x000, two data bytes.
| command | The command. |
| node | The target, 1 to 127, or 0 for every node. |
InvalidArgument (node above 127 or a value that is not a command).
|
constexprnoexcept |
A PDO frame: a valid identifier and 0 to 8 data bytes.
| cob_id | The identifier, kPdoCobIdMin to kPdoCobIdMax. |
| data | The payload, at most 8 bytes. |
InvalidArgument.
|
constexprnoexcept |
The abort frame the client sends to end a transfer: command byte 0x80.
| node | The server, 1 to 127. |
| index | The object index of the transfer. |
| sub | The sub-index of the transfer. |
| code | The abort code. |
InvalidArgument.
|
constexprnoexcept |
One download segment: command byte toggle << 4 | (7 - length) << 1 | last.
| node | The server, 1 to 127. |
| toggle | The toggle bit, starting at 0 and alternating. |
| data | 1 to 7 bytes. |
| last | true for the final segment. |
InvalidArgument.
|
constexprnoexcept |
The expedited initiate-download request (write 1 to 4 bytes): command byte 0x23 | (4 - size) << 2.
| node | The server, 1 to 127. |
| index | The object index. |
| sub | The sub-index. |
| data | 1 to 4 bytes. |
InvalidArgument.
|
constexprnoexcept |
The segmented initiate-download request announcing size bytes: command byte 0x21.
| node | The server, 1 to 127. |
| index | The object index. |
| sub | The sub-index. |
| size | The number of bytes that follow, at least 1. |
InvalidArgument.
|
constexprnoexcept |
The initiate-upload request (read an object): command byte 0x40.
| node | The server, 1 to 127. |
| index | The object index. |
| sub | The sub-index. |
InvalidArgument.
|
constexprnoexcept |
The request for the next upload segment: command byte 0x60 | toggle << 4.
| node | The server, 1 to 127. |
| toggle | The toggle bit, starting at 0 and alternating. |
InvalidArgument. The SYNC frame: identifier 0x080, no data, or one counter byte.
| counter | 0 for a SYNC without data; 1 to 240 for the counter byte; else InvalidArgument. |
Decode an emergency message: identifier 0x081 to 0x0FF, eight bytes (error code, error register, five manufacturer bytes). The timestamp is left 0 for the caller.
| frame | The frame. |
InvalidFrame.
|
constexprnoexcept |
Decode a heartbeat, boot-up or node-guarding reply: identifier 0x701 to 0x77F, one byte.
| frame | The frame. |
InvalidFrame (remote frame, identifier outside the range, length other than 1, or a state that is not 0, 4, 5 or 127).
|
constexprnoexcept |
Decode a frame from an SDO server (identifier 0x580 + node).
The identifier is the caller's to check; this reads the payload. Block-transfer command specifiers (5 and 6) and the reserved 7 are not replies to a request this client sends and are InvalidFrame.
| frame | The frame. |
| strict | true to require 8 data bytes in every SDO frame; false to accept a frame as short as its content needs (4 bytes for an initiate reply, 1 for a segment reply). |
InvalidFrame (remote frame, too short, or an unusable command specifier).
|
constexprnoexcept |
The bits the entries of a PDO occupy in all.
| config | The configuration (not validated). |
entry_count entries.
|
constexprnoexcept |
The index of the communication parameter record of a PDO.
| kind | Receive (0x1400 + n - 1) or transmit (0x1800 + n - 1). |
| number | The PDO number, 1 to 512. |
InvalidArgument.
|
constexprnoexcept |
The index of the mapping parameter record of a PDO.
| kind | Receive (0x1600 + n - 1) or transmit (0x1A00 + n - 1). |
| number | The PDO number, 1 to 512. |
InvalidArgument.
|
constexprnoexcept |
The identifier of the SDO request frames to node.
| node | The node, 1 to 127 (not checked here). |
|
constexprnoexcept |
The identifier of the SDO reply frames from node.
| node | The node, 1 to 127 (not checked here). |
Check a PDO configuration: identifier range, a transmission type that is not reserved (241 to 251), 0 to kMaxPdoEntries entries, each of 1 to 64 bits at a non-zero index, and at most 64 bits in all.
| config | The configuration. |
Ok or InvalidArgument.