-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathArduboy.h
75 lines (64 loc) · 1.9 KB
/
Arduboy.h
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include <SPI.h>
// Choose which board to compile for in the next 2 lines.....
#define ARDUBOY_10 //< compile for the production Arduboy v1.0
//#define AB_DEVKIT //< compile for the official dev kit
#define CLK 13
#define MOSI 11
//-------------------------------------------------------------
#ifdef AB_DEVKIT
#define CS 6
#define DC 4
#define RST 12
#define PIN_LEFT_BUTTON 9
#define PIN_RIGHT_BUTTON 5
#define PIN_UP_BUTTON 8
#define PIN_DOWN_BUTTON 10
#define PIN_A_BUTTON A0
#define PIN_B_BUTTON A1
// map all LEDs to the single TX LED on DEVKIT
#define RED_LED 17
#define GREEN_LED 17
#define BLUE_LED 17
#define TX_LED 17
#define RX_LED 17
//-------------------------------------------------------------
#else
#define CS 12
#define DC 4
#define RST 6
#define PIN_LEFT_BUTTON A2
#define PIN_RIGHT_BUTTON A1
#define PIN_UP_BUTTON A0
#define PIN_DOWN_BUTTON A3
#define PIN_A_BUTTON 7
#define PIN_B_BUTTON 8
#define RED_LED 10
#define GREEN_LED 11
#define BLUE_LED 9
#define TX_LED 30
#define RX_LED 17
#endif
//--------------------------------------------------------------
class Arduboy {
public:
Arduboy();
uint8_t getInput();
void start();
void blank();
void white();
void grey();
void drawbitmap(const unsigned char *bitmap, int posn, int size, int invert);
void draw24x16tile(const unsigned char *bitmap, int x, int y);
void draw4x4tiles(unsigned char *bitmap, int x, int y);
void drawchar(unsigned char *bitmap, int x, int y);
void drawTile(int x, int _y, const unsigned char *image);
void drawTile(int x, int _y, unsigned char image[]);
void drawSprite(int x, int y, const unsigned char *image, uint8_t frame);
void scrollLeft();
private:
uint8_t readCapacitivePin(int pinToMeasure);
uint8_t readCapXtal(int pinToMeasure);
volatile uint8_t *mosiport, *clkport, *csport, *dcport;
uint8_t mosipinmask, clkpinmask, cspinmask, dcpinmask;
bool scrolling;
};