|
| void | init () final |
| | Initialize serial communication.
|
| |
| void | update () final |
| | Service the serial connection.
|
| |
| void | send (uint8_t *payload, size_t length) const final |
| | Send a packet of data.
|
| |
| void | sendMsg (AYAB_API_t id, const char *msg) final |
| | send initial msgid followed by null-terminated string
|
| |
| void | send_reqLine (const uint8_t lineNumber, Err_t error=ErrorCode::success) const final |
| | Send reqLine message.
|
| |
| void | send_indState (Carriage_t carriage, uint8_t position, Err_t error=ErrorCode::success) const final |
| | Send indState message.
|
| |
| void | onPacketReceived (const uint8_t *buffer, size_t size) final |
| | Callback for PacketSerial.
|
| |
|
| void | h_reqInit (const uint8_t *buffer, size_t size) |
| | Handle reqInit (request initialization) command.
|
| |
| void | h_reqStart (const uint8_t *buffer, size_t size) |
| | Handle reqStart (start request) command.
|
| |
| void | h_cnfLine (const uint8_t *buffer, size_t size) |
| | Handle cnfLine (configure line) command.
|
| |
| void | h_reqInfo () const |
| | Handle reqInfo (request information) command.
|
| |
| void | h_reqTest () const |
| | Handle reqTest (request hardware test) command.
|
| |
|
void | h_unrecognized () const |
| | Handle unrecognized command.
|
| |
|
void | send_cnfInfo () const |
| | Send cnfInfo message.
|
| |
| void | send_cnfInit (Err_t error) const |
| | Send cnfInit message.
|
| |
| void | send_cnfStart (Err_t error) const |
| | Send cnfStart message.
|
| |
| void | send_cnfTest (Err_t error) const |
| | Send cnfTest message.
|
| |
| uint8_t | CRC8 (const uint8_t *buffer, size_t len) const |
| | Calculate CRC8 of a buffer.
|
| |
|
|
PacketSerial_< SLIP, SLIP::END, MAX_MSG_BUFFER_LEN > | m_packetSerial |
| |
|
uint8_t | lineBuffer [MAX_LINE_BUFFER_LEN] = {0} |
| |
|
uint8_t | msgBuffer [MAX_MSG_BUFFER_LEN] = {0} |
| |
◆ CRC8()
| uint8_t Com::CRC8 |
( |
const uint8_t * |
buffer, |
|
|
size_t |
len |
|
) |
| const |
|
private |
Calculate CRC8 of a buffer.
- Parameters
-
| buffer | A pointer to a data buffer. |
| len | The number of bytes of data in the data buffer. |
Based on https://www.leonardomiliani.com/en/2013/un-semplice-crc8-per-arduino/
CRC-8 - based on the CRC8 formulas by Dallas/Maxim code released under the therms of the GNU GPL 3.0 license
Faster code using a lookup table is available, if needed.
◆ h_cnfLine()
| void Com::h_cnfLine |
( |
const uint8_t * |
buffer, |
|
|
size_t |
size |
|
) |
| |
|
private |
Handle cnfLine (configure line) command.
- Parameters
-
| buffer | A pointer to a data buffer. |
| size | The number of bytes in the data buffer. |
- Todo:
sl: Handle CRC-8 error?
sl: Assert size? Handle error?
References CRC8().
◆ h_reqInfo()
| void Com::h_reqInfo |
( |
| ) |
const |
|
private |
Handle reqInfo (request information) command.
- Parameters
-
| buffer | A pointer to a data buffer. |
| size | The number of bytes in the data buffer. |
References send_cnfInfo().
◆ h_reqInit()
| void Com::h_reqInit |
( |
const uint8_t * |
buffer, |
|
|
size_t |
size |
|
) |
| |
|
private |
Handle reqInit (request initialization) command.
- Parameters
-
| buffer | A pointer to a data buffer. |
| size | The number of bytes in the data buffer. |
References CRC8(), and send_cnfInit().
◆ h_reqStart()
| void Com::h_reqStart |
( |
const uint8_t * |
buffer, |
|
|
size_t |
size |
|
) |
| |
|
private |
Handle reqStart (start request) command.
- Parameters
-
| buffer | A pointer to a data buffer. |
| size | The number of bytes in the data buffer. |
References CRC8(), and send_cnfStart().
◆ h_reqTest()
| void Com::h_reqTest |
( |
| ) |
const |
|
private |
Handle reqTest (request hardware test) command.
- Parameters
-
| buffer | A pointer to a data buffer. |
| size | The number of bytes in the data buffer. |
References send_cnfTest().
◆ init()
◆ onPacketReceived()
| void Com::onPacketReceived |
( |
const uint8_t * |
buffer, |
|
|
size_t |
size |
|
) |
| |
|
finalvirtual |
◆ send()
| void Com::send |
( |
uint8_t * |
payload, |
|
|
size_t |
length |
|
) |
| const |
|
finalvirtual |
◆ send_cnfInit()
| void Com::send_cnfInit |
( |
Err_t |
error | ) |
const |
|
private |
Send cnfInit message.
- Parameters
-
| error | Error code (0 = success, other values = error). |
References send().
◆ send_cnfStart()
| void Com::send_cnfStart |
( |
Err_t |
error | ) |
const |
|
private |
Send cnfStart message.
- Parameters
-
| error | Error code (0 = success, other values = error). |
References send().
◆ send_cnfTest()
| void Com::send_cnfTest |
( |
Err_t |
error | ) |
const |
|
private |
Send cnfTest message.
- Parameters
-
| error | Error code (0 = success, other values = error). |
References send().
◆ send_indState()
| void Com::send_indState |
( |
Carriage_t |
carriage, |
|
|
uint8_t |
position, |
|
|
Err_t |
error = ErrorCode::success |
|
) |
| const |
|
finalvirtual |
Send indState message.
- Parameters
-
| carriage | Type of knitting carriage in use. |
| position | Position of knitting carriage in needles from left hand side. |
| initState | State of readiness (0 = ready, other values = not ready). |
Implements ComInterface.
References send().
◆ send_reqLine()
| void Com::send_reqLine |
( |
const uint8_t |
lineNumber, |
|
|
Err_t |
error = ErrorCode::success |
|
) |
| const |
|
finalvirtual |
Send reqLine message.
- Parameters
-
| lineNumber | The line number requested (0-indexed and modulo 256). |
| error | Error code (0 = success). |
Implements ComInterface.
References send().
◆ sendMsg()
| void Com::sendMsg |
( |
AYAB_API_t |
id, |
|
|
const char * |
msg |
|
) |
| |
|
finalvirtual |
send initial msgid followed by null-terminated string
- Parameters
-
| id | The msgid to be sent. |
| msg | Pointer to a data buffer containing a null-terminated string. |
Implements ComInterface.
References send().
◆ update()
The documentation for this class was generated from the following files: