Cutting out more crap; I mean the µc sends health responses anyway
This commit is contained in:
parent
eba12edc65
commit
3c7633108c
3 changed files with 9 additions and 26 deletions
|
@ -1,7 +0,0 @@
|
||||||
#ifndef _TABBY_H
|
|
||||||
#define _TABBY_H
|
|
||||||
|
|
||||||
#include <tabby/clock.h>
|
|
||||||
#include <tabby/command.h>
|
|
||||||
|
|
||||||
#endif /* _TABBY_H */
|
|
|
@ -17,7 +17,7 @@ typedef enum {
|
||||||
/*
|
/*
|
||||||
* Data definitions for packets sent from Game Boy to printer
|
* Data definitions for packets sent from Game Boy to printer
|
||||||
*/
|
*/
|
||||||
typedef struct _tabby_printer_packet_header {
|
typedef struct _tabby_printer_packet {
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
uint8_t preamble[2],
|
uint8_t preamble[2],
|
||||||
|
@ -29,15 +29,13 @@ typedef struct _tabby_printer_packet_header {
|
||||||
|
|
||||||
uint8_t data[6];
|
uint8_t data[6];
|
||||||
};
|
};
|
||||||
} tabby_printer_packet_header;
|
} tabby_printer_packet;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Methods for communicating with Game Boy as a printer
|
* Methods for communicating with Game Boy as a printer
|
||||||
*/
|
*/
|
||||||
int tabby_printer_packet_recv(int fd, tabby_printer_packet_header *header,
|
int tabby_printer_packet_recv(int fd, tabby_printer_packet *header,
|
||||||
void *body,
|
void *body,
|
||||||
uint16_t *checksum);
|
uint16_t *checksum);
|
||||||
|
|
||||||
int tabby_printer_response_send(int fd, uint8_t device, uint8_t status);
|
|
||||||
|
|
||||||
#endif /* _TABBY_PRINTER_H */
|
#endif /* _TABBY_PRINTER_H */
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#define PACKET_RECV_ERROR_THRESHOLD 30
|
#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]
|
uint16_t checksum = header->data[2]
|
||||||
+ header->data[3]
|
+ header->data[3]
|
||||||
+ header->data[4]
|
+ header->data[4]
|
||||||
|
@ -20,9 +20,9 @@ static uint16_t checksum(tabby_printer_packet_header *header, void *body) {
|
||||||
return checksum;
|
return checksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tabby_printer_packet_recv(int fd, tabby_printer_packet_header *header,
|
int tabby_printer_packet_recv(int fd, tabby_printer_packet *header,
|
||||||
void *body,
|
void *body,
|
||||||
uint16_t *sum) {
|
uint16_t *sum) {
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
|
|
||||||
size_t i = 0,
|
size_t i = 0,
|
||||||
|
@ -85,11 +85,3 @@ int tabby_printer_packet_recv(int fd, tabby_printer_packet_header *header,
|
||||||
error_io:
|
error_io:
|
||||||
return -errno;
|
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));
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue