ihsm-strain-gage-controller-fw/include/proto_usb.h
2023-06-06 14:19:06 +02:00

37 lines
855 B
C

#ifndef __PROTO_USB_H__
#define __PROTO_USB_H__
enum usbp_pkt_type {
USBP_GET_STATUS = 0,
USBP_GET_MEASUREMENTS = 1,
USBP_SET_MOTOR = 2,
};
struct __attribute__((__packed__)) usbp_status_pkt {
uint8_t packet_type;
uint64_t sys_time_us;
uint8_t has_lcd;
uint8_t has_adc;
uint8_t board_config;
uint8_t bus_addr;
ErrorCode last_uart_error;
uint64_t last_uart_error_timestamp;
uint64_t last_uart_rx;
uint64_t last_uart_tx;
ErrorCode last_bus_error;
uint64_t last_bus_error_timestamp;
};
struct __attribute__((__packed__)) usbp_measurement_pkt {
uint8_t packet_type;
uint8_t num_channels;
size_t num_samples[2];
int32_t measurements[2][2][15];
};
struct __attribute__((__packed__)) usbp_motor_pkt {
uint8_t packet_type;
int32_t speed_rpm;
};
#endif /* __PROTO_USB_H__ */