Files
@ f4e15fde3799
Branch filter:
Location: HydroBot/hydrobot-sharedlibs/inc/protocol.h - annotation
f4e15fde3799
1.4 KiB
text/plain
Moved can interface into shared libs
844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 844fbc8c2409 | #ifndef _PROTOCOL_H
#define _PROTOCOL_H
#include <stdbool.h>
#include "config.h"
#include "can.h"
typedef struct {
bool command;
uint8_t id;
uint16_t key;
uint8_t sensor;
union {
float float_data;
uint8_t byte_data[4];
} data;
} protocol_message_t;
typedef enum {
ESTOP = 0x00,
SILENCE_BUS = 0x01,
SET_OUTPUT = 0X10,
GET_DATA = 0x11,
CONFIG = 0x12,
CALIBRATE = 0x13,
} protocol_command_t;
typedef enum {
NONE = 0x0000,
DIGITAL_INPUT = 0x0001,
FREQ_INPUT = 0x0002,
ANALOG_INPUT = 0x0003,
DIGITAL_OUTPUT = 0x0004,
FREQ_OUTPUT = 0x0005,
ANALOG_OUTPUT = 0x0006,
AIR_TEMP = 0x0007,
AIR_HUMIDITY = 0x0008,
AIR_PRESSURE = 0x0009,
AMBIENT_LIGHT = 0x000A,
WATER_TEMP = 0x000B,
WATER_LEVEL = 0x000C,
WATER_CONDUCTIVITY = 0x000D,
WATER_PH = 0x000E,
CAN_ID = 0x0100,
DATA_RATE = 0x0101,
GPIO = 0x0102,
LED_BRIGHTNESS = 0x0103,
} protocol_data_key_t;
bool protocol_receive_message(CanRxMsgTypeDef* can_message);
bool protocol_send_message(protocol_message_t* message);
bool protocol_process_message(protocol_message_t* message);
__weak bool protocol_estop(bool value);
__weak bool protocol_set_output(protocol_message_t* message);
__weak bool protocol_get_data(protocol_message_t* message);
__weak bool protocol_config(protocol_message_t* message);
#endif //_PROTOCOL_H
|