Serial Wombat 4A and 4B Firmware
protocol.h
Go to the documentation of this file.
1 /*
2 Copyright 2020 Broadwell Consulting Inc.
3 
4 Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21 */
22 
23 #ifndef PROTOCOL_H
24 #define PROTOCOL_H
25 
26 typedef enum
27 {
28  COMMAND_ASCII_ECHO = '!', //33
64  CONFIGURE_CHANNEL_MODE_0 = 200, // 0xC8
91 
92 #define RXBUFFER16(_a) ((uint16_t)Rxbuffer[_a] + (((uint16_t)Rxbuffer[_a+1]) <<8))
93 #define TXBUFFER16(_index, _value) {Txbuffer[_index] = (uint8_t)(_value & 0xFF); Txbuffer[_index + 1] = (uint8_t)(_value >>8);}
94 #define RXBUFFER32(_a) ((uint32_t)Rxbuffer[_a] + (((uint32_t)Rxbuffer[_a+1]) <<8)+ (((uint32_t)Rxbuffer[_a+2]) <<16)+ (((uint32_t)Rxbuffer[_a+3]) <<24))
95 #endif
COMMAND_UART0_TX_7BYTES
@ COMMAND_UART0_TX_7BYTES
Definition: protocol.h:58
COMMAND_ASCII_LINEFEED
@ COMMAND_ASCII_LINEFEED
Definition: protocol.h:29
COMMAND_BINARY_READ_USER_BUFFER
@ COMMAND_BINARY_READ_USER_BUFFER
Definition: protocol.h:40
CONFIGURE_CHANNEL_MODE_t
CONFIGURE_CHANNEL_MODE_t
Definition: protocol.h:26
COMMAND_ASCII_PWM
@ COMMAND_ASCII_PWM
Definition: protocol.h:34
CONFIGURE_CHANNEL_MODE_16
@ CONFIGURE_CHANNEL_MODE_16
Definition: protocol.h:82
COMMAND_UART1_TX_7BYTES
@ COMMAND_UART1_TX_7BYTES
Definition: protocol.h:60
CONFIGURE_CHANNEL_MODE_10
@ CONFIGURE_CHANNEL_MODE_10
Definition: protocol.h:74
COMMAND_BINARY_QUEUE_ADD_BYTES
@ COMMAND_BINARY_QUEUE_ADD_BYTES
Definition: protocol.h:44
COMMAND_ENABLE_2ND_UART
@ COMMAND_ENABLE_2ND_UART
Definition: protocol.h:56
COMMAND_BINARY_TEST_SEQUENCE
@ COMMAND_BINARY_TEST_SEQUENCE
Definition: protocol.h:62
CONFIGURE_CHANNEL_MODE_13
@ CONFIGURE_CHANNEL_MODE_13
Definition: protocol.h:79
CONFIGURE_CHANNEL_MODE_11
@ CONFIGURE_CHANNEL_MODE_11
Definition: protocol.h:77
COMMAND_BINARY_READ_EEPROM
@ COMMAND_BINARY_READ_EEPROM
Definition: protocol.h:52
CONFIGURE_CHANNEL_MODE_SCALED_OUTPUT
@ CONFIGURE_CHANNEL_MODE_SCALED_OUTPUT
Definition: protocol.h:75
COMMAND_BOOTLOAD
@ COMMAND_BOOTLOAD
Definition: protocol.h:30
CONFIGURE_CHANNEL_MODE_3
@ CONFIGURE_CHANNEL_MODE_3
Definition: protocol.h:67
COMMAND_UART1_RX_7BYTES
@ COMMAND_UART1_RX_7BYTES
Definition: protocol.h:61
CONFIGURE_CHANNEL_MODE_9
@ CONFIGURE_CHANNEL_MODE_9
Definition: protocol.h:73
CONFIGURE_CHANNEL_MODE_HW_0
@ CONFIGURE_CHANNEL_MODE_HW_0
Definition: protocol.h:86
COMMAND_BINARY_READ_PIN_BUFFFER
@ COMMAND_BINARY_READ_PIN_BUFFFER
Definition: protocol.h:38
COMMAND_BINARY_SET_PIN_BUFFFER
@ COMMAND_BINARY_SET_PIN_BUFFFER
Definition: protocol.h:39
COMMAND_BINARY_READ_RAM
@ COMMAND_BINARY_READ_RAM
Definition: protocol.h:50
COMMAND_UART0_RX_7BYTES
@ COMMAND_UART0_RX_7BYTES
Definition: protocol.h:59
COMMAND_BINARY_QUEUE_ADD_7BYTES
@ COMMAND_BINARY_QUEUE_ADD_7BYTES
Definition: protocol.h:45
COMMAND_BINARY_WRITE_USER_BUFFER
@ COMMAND_BINARY_WRITE_USER_BUFFER
Definition: protocol.h:41
CONFIGURE_CHANNEL_MODE_DISABLE
@ CONFIGURE_CHANNEL_MODE_DISABLE
Definition: protocol.h:85
CONFIGURE_CHANNEL_MODE_0
@ CONFIGURE_CHANNEL_MODE_0
Definition: protocol.h:64
COMMAND_ASCII_ECHO
@ COMMAND_ASCII_ECHO
Definition: protocol.h:28
COMMAND_ASCII_GET_PUBLIC_DATA
@ COMMAND_ASCII_GET_PUBLIC_DATA
Definition: protocol.h:36
CONFIGURE_CHANNEL_MODE_15
@ CONFIGURE_CHANNEL_MODE_15
Definition: protocol.h:81
COMMAND_ASCII_SET_PUBLIC_DATA
@ COMMAND_ASCII_SET_PUBLIC_DATA
Definition: protocol.h:35
CONFIGURE_CHANNEL_MODE_7
@ CONFIGURE_CHANNEL_MODE_7
Definition: protocol.h:71
CONFIGURE_CHANNEL_MODE_6
@ CONFIGURE_CHANNEL_MODE_6
Definition: protocol.h:70
CONFIGURE_CHANNEL_MODE_17
@ CONFIGURE_CHANNEL_MODE_17
Definition: protocol.h:83
COMMAND_BINARY_QUEUE_READ_BYTES
@ COMMAND_BINARY_QUEUE_READ_BYTES
Definition: protocol.h:46
CONFIGURE_CHANNEL_MODE_12
@ CONFIGURE_CHANNEL_MODE_12
Definition: protocol.h:78
COMMAND_ASCII_RESET
@ COMMAND_ASCII_RESET
Definition: protocol.h:31
COMMAND_ASCII_VERSION
@ COMMAND_ASCII_VERSION
Definition: protocol.h:33
CONFIGURE_CHANNEL_MODE_4
@ CONFIGURE_CHANNEL_MODE_4
Definition: protocol.h:68
COMMAND_BINARY_READ_FLASH
@ COMMAND_BINARY_READ_FLASH
Definition: protocol.h:51
CONFIGURE_CHANNEL_MODE_HW_3
@ CONFIGURE_CHANNEL_MODE_HW_3
Definition: protocol.h:89
CONFIGURE_CHANNEL_MODE_2
@ CONFIGURE_CHANNEL_MODE_2
Definition: protocol.h:66
CONFIGURE_CHANNEL_MODE_1
@ CONFIGURE_CHANNEL_MODE_1
Definition: protocol.h:65
COMMAND_CALIBRATE_ANALOG
@ COMMAND_CALIBRATE_ANALOG
Definition: protocol.h:55
COMMAND_BINARY_QUEUE_INITIALIZE
@ COMMAND_BINARY_QUEUE_INITIALIZE
Definition: protocol.h:43
COMMAND_BINARY_CONFIGURE
@ COMMAND_BINARY_CONFIGURE
Definition: protocol.h:49
CONFIGURE_CHANNEL_MODE_HW_2
@ CONFIGURE_CHANNEL_MODE_HW_2
Definition: protocol.h:88
COMMAND_ASCII_SLEEP
@ COMMAND_ASCII_SLEEP
Definition: protocol.h:32
COMMAND_BINARY_WRITE_RAM
@ COMMAND_BINARY_WRITE_RAM
Definition: protocol.h:53
COMMAND_BINARY_QUEUE_GET_INFO
@ COMMAND_BINARY_QUEUE_GET_INFO
Definition: protocol.h:47
COMMAND_READ_LAST_ERROR_PACKET
@ COMMAND_READ_LAST_ERROR_PACKET
Definition: protocol.h:57
CONFIGURE_CHANNEL_MODE_8
@ CONFIGURE_CHANNEL_MODE_8
Definition: protocol.h:72
CONFIGURE_CHANNEL_MODE_18
@ CONFIGURE_CHANNEL_MODE_18
Definition: protocol.h:84
CONFIGURE_CHANNEL_MODE_14
@ CONFIGURE_CHANNEL_MODE_14
Definition: protocol.h:80
COMMAND_BINARY_WRITE_FLASH
@ COMMAND_BINARY_WRITE_FLASH
Definition: protocol.h:54
COMMAND_BINARY_WRITE_USER_BUFFER_CONTINUE
@ COMMAND_BINARY_WRITE_USER_BUFFER_CONTINUE
Definition: protocol.h:42
CONFIGURE_CHANNEL_MODE_5
@ CONFIGURE_CHANNEL_MODE_5
Definition: protocol.h:69
COMMAND_BINARY_RW_PIN_MEMORY
@ COMMAND_BINARY_RW_PIN_MEMORY
Definition: protocol.h:63
CONFIGURE_CHANNEL_MODE_INPUT_PROCESSING
@ CONFIGURE_CHANNEL_MODE_INPUT_PROCESSING
Definition: protocol.h:76
CONFIGURE_CHANNEL_MODE_HW_1
@ CONFIGURE_CHANNEL_MODE_HW_1
Definition: protocol.h:87
COMMAND_ASCII_SET_PIN
@ COMMAND_ASCII_SET_PIN
Definition: protocol.h:37
COMMAND_BINARY_QUEUE_CLONE
@ COMMAND_BINARY_QUEUE_CLONE
Definition: protocol.h:48