-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathMyArduboy.h
67 lines (62 loc) · 2 KB
/
MyArduboy.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
#pragma once
//#define USE_ARDUBOY2_LIB
#ifdef USE_ARDUBOY2_LIB
#include <Arduboy2.h>
#include <ArduboyPlaytune.h>
#define ARDUBOY_LIB_CLASS Arduboy2
#define ARDUBOY_LIB_VER_TGT 50100
typedef uint8_t buffer_t;
#else
#include <Arduboy.h>
#define ARDUBOY_LIB_CLASS Arduboy
#define ARDUBOY_LIB_VER_TGT 10101
typedef unsigned char buffer_t;
class MyArduboyAudio : public ArduboyAudio
{
public:
void static begin();
void static on();
void static off();
void static toggle();
};
#endif
class MyArduboy : public ARDUBOY_LIB_CLASS
{
public:
#ifdef USE_ARDUBOY2_LIB
MyArduboy(void);
#endif
void beginNoLogo(void);
bool nextFrame(void);
bool buttonDown(uint8_t buttons);
bool buttonPressed(uint8_t buttons);
bool buttonUp(uint8_t buttons);
void setTextColor(uint8_t color);
void setTextColor(uint8_t color, uint8_t bg);
size_t printEx(int16_t x, int16_t y, const char *p);
size_t printEx(int16_t x, int16_t y, const __FlashStringHelper *p);
virtual size_t write(uint8_t);
void drawRect2(int16_t x, int16_t y, uint8_t w, int8_t h, uint8_t color);
void drawFastVLine2(int16_t x, int16_t y, int8_t h, uint8_t color);
void drawFastHLine2(int16_t x, int16_t y, uint8_t w, uint8_t color);
void fillRect2(int16_t x, int16_t y, uint8_t w, int8_t h, uint8_t color);
bool isAudioEnabled(void);
void setAudioEnabled(bool on);
void saveAudioOnOff(void);
void playScore2(const byte *score, uint8_t priority);
void stopScore2(void);
private:
void myDrawChar(int16_t x, int16_t y, unsigned char c, uint8_t color, uint8_t bg, uint8_t size);
void fillBeltBlack(buffer_t *p, uint8_t d, uint8_t w);
void fillBeltWhite(buffer_t *p, uint8_t d, uint8_t w);
uint8_t textcolor = WHITE;
uint8_t textbg = BLACK;
uint8_t lastButtonState;
uint8_t currentButtonState;
uint8_t playScorePriority;
#ifdef USE_ARDUBOY2_LIB
ArduboyPlaytune *pTunes;
#else
MyArduboyAudio myAudio;
#endif
};