diff options
Diffstat (limited to 'firmware/protocol.h')
-rw-r--r-- | firmware/protocol.h | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/firmware/protocol.h b/firmware/protocol.h new file mode 100644 index 0000000..fce8eda --- /dev/null +++ b/firmware/protocol.h @@ -0,0 +1,94 @@ +/** + * Protocol is under GNU/GPL2! + * Author: Benedikt Sauter sauter@empronix.com, 2007-09-02 + * + * BYTE command + * BYTE parameter + * BYTE length body <x> + * <x> BYTES body + * + * max body length = 60 bytes + */ + +/** + * The first byte in the body of an response packet + * is always a value from the next table. + */ + +#define RSP_OK 0x01 +#define RSP_ERROR 0x02 +#define RSP_UNKOWN_CMD 0x03 +#define RSP_UNKOWN_PIN 0x04 +#define RSP_UNKOWN_PORT 0x05 +#define RSP_WRONG_PIN_CONFIG 0x06 +#define RSP_IMPOSSIBLE_PIN_CONFIG 0x07 +#define RSP_TIMEOUT 0x08 + + +#define CMD_LATENCY_TIMER_SET 0x01 +#define CMD_LATENCY_TIMER_GET 0x02 +#define CMD_GET_HW_ID 0x03 +#define CMD_EXTERNAL_DEVICE 0x06 + +#define CMD_IO_INIT_PORT 0x10 +#define CMD_IO_INIT_PIN 0x11 +#define CMD_IO_PORT_DIRECTION_IN 0x12 +#define CMD_IO_PORT_DIRECTION_OUT 0x13 +#define CMD_IO_PORT_DIRECTION_TRI 0x14 +#define CMD_IO_PIN_DIRECTION_IN 0x15 +#define CMD_IO_PIN_DIRECTION_OUT 0x16 +#define CMD_IO_PIN_DIRECTION_TRI 0x17 +#define CMD_IO_PORT_SET 0x18 +#define CMD_IO_PORT_GET 0x19 +#define CMD_IO_PIN_SET 0x1A +#define CMD_IO_PIN_GET 0x1B + +#define CMD_ADC_INIT_PIN 0x20 +#define CMD_ADC_GET 0x21 +#define CMD_ADC_REF 0x22 + +#define CMD_I2C_INIT 0x30 +#define CMD_I2C_DEINIT 0x31 +#define CMD_I2C_SET_BITRATE 0x32 +#define CMD_I2C_SEND_BYTE 0x34 +#define CMD_I2C_RECV_BYTES 0x35 +#define CMD_I2C_SEND_START 0x36 +#define CMD_I2C_SEND_STOP 0x37 + +#define CMD_SPI_INIT 0x40 +#define CMD_SPI_DEINIT 0x41 +#define CMD_SPI_SPEED 0x42 +#define CMD_SPI_SEND 0x43 +#define CMD_SPI_RECV 0x44 +#define CMD_SPI_SEND_AND_RECV 0x45 + + +#define CMD_PWM_INIT_PIN 0x50 +#define CMD_PWM_DEINIT_PIN 0x51 +#define CMD_PWM_SPEED 0x52 +#define CMD_PWM_VALUE 0x53 + + +#define CMD_UART_INIT 0x60 +#define CMD_UART_DEINIT 0x61 +#define CMD_UART_BAUDRATE 0x62 +#define CMD_UART_STOPBITS 0x63 +#define CMD_UART_DATABITS 0x64 +#define CMD_UART_PARITY 0x65 +#define CMD_UART_RECV 0x67 +#define CMD_UART_SEND 0x68 + + +#define PARAM_ADC_AREF 0x01 +#define PARAM_ADC_AVCC 0x02 +#define PARAM_ADC_INTERNAL 0x03 + + +/* microwire eeprom */ +#define CMD_EXTERNAL_93C46 0x01 + + +#define CMD_93C46_INIT 0x01 +#define CMD_93C46_DEINIT 0x02 +#define CMD_93C46_READ 0x03 +#define CMD_93C46_WRITE 0x04 |