From e9b7a6ef8fc575e0ee4f55ae16169d1917be9dea Mon Sep 17 00:00:00 2001 From: cbdev Date: Thu, 24 Aug 2023 00:58:23 +0200 Subject: Initial commit --- libtwn3.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 libtwn3.h (limited to 'libtwn3.h') diff --git a/libtwn3.h b/libtwn3.h new file mode 100644 index 0000000..63e9b93 --- /dev/null +++ b/libtwn3.h @@ -0,0 +1,25 @@ +#include +#include +#include + +/* Open a device port */ +int twn3_open(char* device); + +/* Low-level command API */ +#define TX_FLAG_BINARY 1 + +#define RX_FLAG_BINARY 1 +#define RX_FLAG_UNTIL_TIMEOUT 2 + +ssize_t twn3_send_command(int fd, uint8_t flags, uint8_t* data, size_t len); +ssize_t twn3_receive_response(int fd, uint8_t flags, uint8_t* response, size_t max_length); +ssize_t twn3_sync_command(int fd, uint8_t flags, uint8_t* cmd, size_t cmd_len, uint8_t* response, size_t max_length); + +/* Synchronous API */ +/* These calls will return data directly, at the cost of blocking execution */ +int twn3_sync_read_version(int fd, uint8_t flags, char* version, size_t max_length); +int twn3_sync_read_eeprom(int fd, uint8_t flags, uint8_t reg, uint8_t* data); +int twn3_sync_write_eeprom(int fd, uint8_t flags, uint8_t reg, uint8_t data); +int twn3_sync_storekey(int fd, uint8_t flags, uint8_t keyid, uint8_t key[6]); +int twn3_sync_antenna(int fd, uint8_t flags, uint8_t enable); + -- cgit v1.2.3