Implement tabby_printer_link_init()
This commit is contained in:
parent
d9007fc717
commit
a48298e08f
2 changed files with 19 additions and 0 deletions
|
@ -31,6 +31,8 @@ typedef struct _tabby_printer_packet {
|
|||
};
|
||||
} tabby_printer_packet;
|
||||
|
||||
int tabby_printer_link_init(int fd);
|
||||
|
||||
/*
|
||||
* For receiving printer data packets from a Game Boy Camera
|
||||
*/
|
||||
|
|
|
@ -9,6 +9,23 @@
|
|||
|
||||
#define PACKET_RECV_ERROR_THRESHOLD 30
|
||||
|
||||
int tabby_printer_link_init(int fd) {
|
||||
uint8_t out = 'K',
|
||||
in;
|
||||
|
||||
while (1) {
|
||||
read(fd, &in, 1);
|
||||
|
||||
if (in == 'O') {
|
||||
write(fd, &out, 1);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint16_t checksum(tabby_printer_packet *header, void *body) {
|
||||
uint16_t checksum = header->data[2]
|
||||
+ header->data[3]
|
||||
|
|
Loading…
Add table
Reference in a new issue