From 7ace126e02025a18bc1333afbd10ac634d0c05cb Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Wed, 25 May 2016 20:42:39 -0500 Subject: [PATCH] Split out include/tabby.h into chunks that can be used by both host and AVR code, for reasons --- include/tabby.h | 25 +++---------------------- include/tabby/clock.h | 16 ++++++++++++++++ include/tabby/command.h | 10 ++++++++++ include/tabby/link.h | 22 ++++++++++++++++++++++ include/tabby/packet.h | 9 +++++++++ include/tabby/serial.h | 16 ---------------- 6 files changed, 60 insertions(+), 38 deletions(-) create mode 100644 include/tabby/clock.h create mode 100644 include/tabby/command.h create mode 100644 include/tabby/link.h create mode 100644 include/tabby/packet.h delete mode 100644 include/tabby/serial.h diff --git a/include/tabby.h b/include/tabby.h index ed702b8..d035ad1 100644 --- a/include/tabby.h +++ b/include/tabby.h @@ -1,27 +1,8 @@ #ifndef _TABBY_H #define _TABBY_H -typedef enum tabby_command { - TABBY_COMMAND_SEND = 0x01, - TABBY_COMMAND_CLOCK_MODE = 0x02, - TABBY_COMMAND_CLOCK_SPEED = 0x03 -}; - -typedef enum tabby_clock_mode { - TABBY_CLOCK_MODE_INTERNAL = 0x01, - TABBY_CLOCK_MODE_EXTERNAL = 0x02 -}; - -typedef enum tabby_clock_speed { - TABBY_CLOCK_SPEED_8192HZ = 0x01, - TABBY_CLOCK_SPEED_16384HZ = 0x02, - TABBY_CLOCK_SPEED_262144HZ = 0x20, - TABBY_CLOCK_SPEED_524288HZ = 0x40 -}; - -typedef struct _tabby_packet { - uint16_t type, - value; -} tabby_packet; +#include +#include +#include #endif /* _TABBY_H */ diff --git a/include/tabby/clock.h b/include/tabby/clock.h new file mode 100644 index 0000000..4da840f --- /dev/null +++ b/include/tabby/clock.h @@ -0,0 +1,16 @@ +#ifndef _TABBY_CLOCK_H +#define _TABBY_CLOCK_H + +typedef enum tabby_clock_mode { + TABBY_CLOCK_SOURCE_INTERNAL = 0x01, + TABBY_CLOCK_SOURCE_EXTERNAL = 0x02 +}; + +typedef enum tabby_clock_speed { + TABBY_CLOCK_SPEED_8192HZ = 0x01, + TABBY_CLOCK_SPEED_16384HZ = 0x02, + TABBY_CLOCK_SPEED_262144HZ = 0x20, + TABBY_CLOCK_SPEED_524288HZ = 0x40 +}; + +#endif /* _TABBY_CLOCK_H */ diff --git a/include/tabby/command.h b/include/tabby/command.h new file mode 100644 index 0000000..cf46f13 --- /dev/null +++ b/include/tabby/command.h @@ -0,0 +1,10 @@ +#ifndef _TABBY_COMMAND_H +#define _TABBY_COMMAND_H + +typedef enum tabby_command { + TABBY_COMMAND_SEND = 0x01, + TABBY_COMMAND_CLOCK_MODE = 0x02, + TABBY_COMMAND_CLOCK_SPEED = 0x03 +}; + +#endif /* _TABBY_COMMAND_H */ diff --git a/include/tabby/link.h b/include/tabby/link.h new file mode 100644 index 0000000..57f8952 --- /dev/null +++ b/include/tabby/link.h @@ -0,0 +1,22 @@ +#ifndef _TABBY_LINK_H +#define _TABBY_LINK_H + +#include + +#include + +#define TABBY_LINK_BAUD 115200 + +int tabby_link_open(const char *dev); + +void tabby_link_close(int fd); + +int tabby_link_send(int fd, char *buf, size_t len); + +ssize_t tabby_link_recv(int fd, char *buf, size_t len); + +int tabby_link_set_clock_source(int fd, tabby_clock_source source); + +int tabby_link_set_clock_speed(int fd, tabby_clock_speed speed); + +#endif /* _TABBY_LINK_H */ diff --git a/include/tabby/packet.h b/include/tabby/packet.h new file mode 100644 index 0000000..dc9420a --- /dev/null +++ b/include/tabby/packet.h @@ -0,0 +1,9 @@ +#ifndef _TABBY_PACKET_H +#define _TABBY_PACKET_H + +typedef struct _tabby_packet { + uint16_t type, + value; +} tabby_packet; + +#endif /* _TABBY_PACKET_H */ diff --git a/include/tabby/serial.h b/include/tabby/serial.h deleted file mode 100644 index ffa07d4..0000000 --- a/include/tabby/serial.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _TABBY_SERIAL_H -#define _TABBY_SERIAL_H - -#include - -#define TABBY_SERIAL_BAUD 115200 - -int tabby_serial_open(const char *dev); - -void tabby_serial_close(int fd); - -int tabby_serial_send(int fd, char *buf, size_t len); - -ssize_t tabby_serial_recv(int fd, char *buf, size_t len); - -#endif /* _TABBY_SERIAL_H */