PokittoButtons.h
Go to the documentation of this file.
1 /**************************************************************************/
35 /**************************************************************************/
36 
37 
38 #ifndef POKITTOBUTTONS_H
39 #define POKITTOBUTTONS_H
40 
41 #include <stdint.h>
42 #include "Pokitto_settings.h"
43 #include "GBcompatibility.h"
44 #include "PokittoGlobs.h"
45 
46 #ifndef POK_SIM
47  #include "HWButtons.h"
48  #define CHWLONGPRESSTIMEOUT 100
49 #else
50  #include "PokittoSimulator.h"
51  #define CHWLONGPRESSTIMEOUT 1000
52 #endif // POK_SIM
53 
54 
55 namespace Pokitto {
56 
57 class Buttons {
58 public:
59  // Original functions
60  static uint8_t buttons_state, buttons_held, buttons_released;
61  static void initButtons();
62  static void pollButtons();
63  static uint8_t leftBtn();
64  static uint8_t rightBtn();
65  static uint8_t upBtn();
66  static uint8_t downBtn();
67  static uint8_t aBtn();
68  static uint8_t bBtn();
69  static uint8_t cBtn();
70  static uint8_t leftHeld();
71  static uint8_t rightHeld();
72  static uint8_t upHeld();
73  static uint8_t downHeld();
74  static uint8_t aHeld();
75  static uint8_t bHeld();
76  static uint8_t cHeld();
77 
78  static uint8_t leftReleased();
79  static uint8_t rightReleased();
80  static uint8_t upReleased();
81  static uint8_t downReleased();
82  static uint8_t aReleased();
83  static uint8_t bReleased();
84  static uint8_t cReleased();
85 
86  // GB compatibility functions
87  static void begin();
88  static void update();
89  static bool pressed(uint8_t button);
90  static bool released(uint8_t button);
91  static bool held(uint8_t button, uint8_t time);
92  static bool repeat(uint8_t button, uint8_t period);
93  static uint8_t timeHeld(uint8_t button);
94  static uint8_t pins[NUM_BTN];
95  static uint8_t states[NUM_BTN];
96  static uint8_t heldStates[NUM_BTN]; // additional, not GB based
97 private:
98  static uint16_t cHWLongPress; //forced hardware detection of C long press
99 };
100 
101 }
102 
103 #endif // POKITTOBUTTONS_H
104 
105 
106 
107 
108 
109 
Definition: PokittoButtons.h:57
static uint8_t timeHeld(uint8_t button)
Definition: PokittoButtons.cpp:168
static void update()
Definition: PokittoButtons.cpp:55
Definition: PokittoBacklight.h:42
static bool held(uint8_t button, uint8_t time)
Definition: PokittoButtons.cpp:139
static bool repeat(uint8_t button, uint8_t period)
Definition: PokittoButtons.cpp:152