-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprinter.h
More file actions
34 lines (26 loc) · 929 Bytes
/
printer.h
File metadata and controls
34 lines (26 loc) · 929 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef __PRINTER_H__
#define __PRINTER_H__
#include <gb/gb.h>
// commands
#define PRINTER_CMD_INIT 0x01
#define PRINTER_CMD_PRINT 0x02
#define PRINTER_CMD_DATA 0x04
#define PRINTER_CMD_BREAK 0x08
#define PRINTER_CMD_STATUS 0x0F
// status flags
#define PRINTER_STATUS_CHECKSUM_INVALID 0x01
#define PRINTER_STATUS_PRINTING 0x02
#define PRINTER_STATUS_DATA_FULL 0x04
#define PRINTER_STATUS_UNPROCESSED_DATA 0x08
#define PRINTER_STATUS_PACKET_ERROR 0x10
#define PRINTER_STATUS_PAPER_JAM 0x20
#define PRINTER_STATUS_OTHER_ERROR 0x40
#define PRINTER_STATUS_LOW_BATTERY 0x80
// statuses considered an error
#define PRINTER_STATUS_ERROR 0b01110101
#define PRINTER_STATUS_ERROR_EOF 0b01110001
#define COMPRESSION_NONE 0x00
#define COMPRESSION_RLE 0x01
INT8 print(char text[14][20]);
void generate_pattern(UINT8* data, UINT8 line);
#endif