diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-05-17 21:21:00 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-05-17 21:21:00 +0200 |
commit | 365dcc18fbd98645585cdbe009f537ecdaa90c1a (patch) | |
tree | 078c14da20867e177d658ae4cc517b81ab9ad1aa /robot/sercomm.h | |
parent | f00fca5f6f9751b16d868f52bda908c7b4704457 (diff) |
WIP sercomm implementation
- moved some module-specific constants to their respective header files
- changed .clang-tidy to ignore global private global constants
(starting with `_`)
- suppressed some GCC warnings in bin.c and all pololu library warnings
- added function signatures for sercomm protocol data generators
- added endianness check in setup.c
Diffstat (limited to 'robot/sercomm.h')
-rw-r--r-- | robot/sercomm.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/robot/sercomm.h b/robot/sercomm.h index 58c79b9..1533a4c 100644 --- a/robot/sercomm.h +++ b/robot/sercomm.h @@ -1,5 +1,27 @@ #pragma once +#include "bin.h" + +#define W2_CMD_RX (0) +#define W2_CMD_TX (1) + +enum w2_e_serial_commands { + W2_E_CMD_PING = 0x00, + W2_E_CMD_EXPT = 0x02, + W2_E_CMD_MODE = 0x04, + W2_E_CMD_SPED = 0x06, + W2_E_CMD_DIRC = 0x08, + W2_E_CMD_CORD = 0x0a, + W2_E_CMD_BOMD = 0x0c, + W2_E_CMD_SRES = 0x0e, + W2_E_CMD_MCFG = 0x10, + W2_E_CMD_SENS = 0x12, + W2_E_CMD_INFO = 0x14, + W2_E_CMD_DISP = 0x16, + W2_E_CMD_PLAY = 0x18, + W2_E_CMD_CLED = 0x1a, +}; + /** * serial pc-robot communication module * @@ -7,3 +29,29 @@ * - sends all data in the message buffer */ void w2_sercomm_main(); + +void w2_sercomm_append_msg(w2_s_bin data); + +w2_s_bin w2_sercomm_rx_generic(); +w2_s_bin w2_sercomm_tx_generic(); + +w2_s_bin w2_sercomm_rx_ping(); +w2_s_bin w2_sercomm_tx_ping(); +w2_s_bin w2_sercomm_tx_expt(); +w2_s_bin w2_sercomm_rx_mode(); +w2_s_bin w2_sercomm_tx_mode(); +w2_s_bin w2_sercomm_rx_sped(); +w2_s_bin w2_sercomm_rx_dirc(); +w2_s_bin w2_sercomm_rx_cord(); +w2_s_bin w2_sercomm_tx_cord(); +w2_s_bin w2_sercomm_rx_bomd(); +w2_s_bin w2_sercomm_tx_bomd(); +w2_s_bin w2_sercomm_rx_sres(); +w2_s_bin w2_sercomm_rx_mcfg(); +w2_s_bin w2_sercomm_rx_sens(); +w2_s_bin w2_sercomm_tx_sens(); +w2_s_bin w2_sercomm_rx_info(); +w2_s_bin w2_sercomm_tx_info(); +w2_s_bin w2_sercomm_rx_disp(); +w2_s_bin w2_sercomm_rx_play(); +w2_s_bin w2_sercomm_rx_cled(); |