Split out include/tabby.h into chunks that can be used by both host and AVR code, for reasons
This commit is contained in:
parent
ff398ec275
commit
7ace126e02
6 changed files with 60 additions and 38 deletions
|
@ -1,27 +1,8 @@
|
||||||
#ifndef _TABBY_H
|
#ifndef _TABBY_H
|
||||||
#define _TABBY_H
|
#define _TABBY_H
|
||||||
|
|
||||||
typedef enum tabby_command {
|
#include <tabby/clock.h>
|
||||||
TABBY_COMMAND_SEND = 0x01,
|
#include <tabby/command.h>
|
||||||
TABBY_COMMAND_CLOCK_MODE = 0x02,
|
#include <tabby/packet.h>
|
||||||
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;
|
|
||||||
|
|
||||||
#endif /* _TABBY_H */
|
#endif /* _TABBY_H */
|
||||||
|
|
16
include/tabby/clock.h
Normal file
16
include/tabby/clock.h
Normal file
|
@ -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 */
|
10
include/tabby/command.h
Normal file
10
include/tabby/command.h
Normal file
|
@ -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 */
|
22
include/tabby/link.h
Normal file
22
include/tabby/link.h
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#ifndef _TABBY_LINK_H
|
||||||
|
#define _TABBY_LINK_H
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <tabby/clock.h>
|
||||||
|
|
||||||
|
#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 */
|
9
include/tabby/packet.h
Normal file
9
include/tabby/packet.h
Normal file
|
@ -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 */
|
|
@ -1,16 +0,0 @@
|
||||||
#ifndef _TABBY_SERIAL_H
|
|
||||||
#define _TABBY_SERIAL_H
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#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 */
|
|
Loading…
Add table
Reference in a new issue