diff --git a/include/tabby.h b/include/tabby.h deleted file mode 100644 index 16f0ed0..0000000 --- a/include/tabby.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _TABBY_H -#define _TABBY_H - -#include -#include - -#endif /* _TABBY_H */ diff --git a/include/tabby/printer.h b/include/tabby/printer.h index fdbea08..e88d687 100644 --- a/include/tabby/printer.h +++ b/include/tabby/printer.h @@ -17,7 +17,7 @@ typedef enum { /* * Data definitions for packets sent from Game Boy to printer */ -typedef struct _tabby_printer_packet_header { +typedef struct _tabby_printer_packet { union { struct { uint8_t preamble[2], @@ -29,15 +29,13 @@ typedef struct _tabby_printer_packet_header { uint8_t data[6]; }; -} tabby_printer_packet_header; +} tabby_printer_packet; /* * Methods for communicating with Game Boy as a printer */ -int tabby_printer_packet_recv(int fd, tabby_printer_packet_header *header, - void *body, - uint16_t *checksum); - -int tabby_printer_response_send(int fd, uint8_t device, uint8_t status); +int tabby_printer_packet_recv(int fd, tabby_printer_packet *header, + void *body, + uint16_t *checksum); #endif /* _TABBY_PRINTER_H */ diff --git a/src/printer.c b/src/printer.c index 5bc8cba..b0658b0 100644 --- a/src/printer.c +++ b/src/printer.c @@ -5,7 +5,7 @@ #define PACKET_RECV_ERROR_THRESHOLD 30 -static uint16_t checksum(tabby_printer_packet_header *header, void *body) { +static uint16_t checksum(tabby_printer_packet *header, void *body) { uint16_t checksum = header->data[2] + header->data[3] + header->data[4] @@ -20,9 +20,9 @@ static uint16_t checksum(tabby_printer_packet_header *header, void *body) { return checksum; } -int tabby_printer_packet_recv(int fd, tabby_printer_packet_header *header, - void *body, - uint16_t *sum) { +int tabby_printer_packet_recv(int fd, tabby_printer_packet *header, + void *body, + uint16_t *sum) { ssize_t len; size_t i = 0, @@ -85,11 +85,3 @@ int tabby_printer_packet_recv(int fd, tabby_printer_packet_header *header, error_io: return -errno; } - -int tabby_printer_response_send(int fd, uint8_t device, uint8_t status) { - uint8_t response[2] = { - device, status - }; - - return write(fd, &response, sizeof(response)); -}