Dilbert
Firmware for the Dilbert interactive badge.
 All Classes Files Functions Variables Enumerations Macros Pages
Dilbert.h
Go to the documentation of this file.
1 
3 #ifndef _DILBERT_H_
4 #define _DILBERT_H_
5 
6 #include <Adafruit_ILI9341.h>
7 #include <Adafruit_NeoPixel.h>
8 #include <UniversalInputManager.h>
9 
10 #include "Adafruit_MCP23017.h"
11 
17 class Dilbert
18 {
19 public:
20  static const uint8_t MCP23017_INT_GPIO = 1;
21  static const uint8_t SD_CS_GPIO = 3;
22  static const uint8_t TFT_CS_GPIO = 0;
23  static const uint8_t TFT_DC_GPIO = 2;
24  static const uint8_t TFT_BACKLIGHT_GPIO = 16;
25  static const uint8_t NEOPIXEL_GPIO = 15;
26 
27  static const uint8_t BUTTON_UP = 1;
28  static const uint8_t BUTTON_DOWN = 2;
29  static const uint8_t BUTTON_LEFT = 0;
30  static const uint8_t BUTTON_RIGHT = 3;
31  static const uint8_t BUTTON_A = 4;
32  static const uint8_t BUTTON_B = 5;
33 
34 public:
35  Dilbert();
36  virtual ~Dilbert();
37 
38  void begin(size_t numNeoPixels = 8);
39 
45  {
46  return *m_tftDisplay;
47  }
48 
55  uint16_t backlight() const
56  {
57  return m_backlightIntensity;
58  }
59 
60  void setBacklightOn(bool on);
61  void setBacklight(uint16_t intensity);
62 
67  inline Adafruit_NeoPixel &neoPixels()
68  {
69  return *m_neopixels;
70  }
71 
81  {
82  return *m_io;
83  }
84 
89  inline UniversalInputManager &buttons()
90  {
91  return *m_buttons;
92  }
93 
94 private:
95  Adafruit_MCP23017 *m_io;
96 
97  Adafruit_ILI9341 *m_tftDisplay; //<! Display driver
98  uint16_t m_backlightIntensity;
99 
100  UniversalInputManager *m_buttons;
101 
102  Adafruit_NeoPixel *m_neopixels;
103 };
104 
105 #endif
uint16_t backlight() const
Gets the backlight intensity.
Definition: Dilbert.h:55
static const uint8_t BUTTON_LEFT
Left button GPIO (on MCP23017)
Definition: Dilbert.h:29
void setBacklightOn(bool on)
Sets the backlight intensity.
Definition: Dilbert.cpp:73
static const uint8_t BUTTON_DOWN
Down button GPIO (on MCP23017)
Definition: Dilbert.h:28
static const uint8_t TFT_BACKLIGHT_GPIO
TFT backlight GPIO.
Definition: Dilbert.h:24
Adafruit_ILI9341 & display()
Gets the TFT display driver.
Definition: Dilbert.h:44
UniversalInputManager & buttons()
Gets the button manager.
Definition: Dilbert.h:89
static const uint8_t BUTTON_B
B button GPIO (on MCP23017)
Definition: Dilbert.h:32
Definition: Adafruit_MCP23017.h:20
static const uint8_t TFT_CS_GPIO
TFT chip select GPIO.
Definition: Dilbert.h:22
Main hardware abstraction class.
Definition: Dilbert.h:17
static const uint8_t BUTTON_RIGHT
Right button GPIO (on MCP23017)
Definition: Dilbert.h:30
static const uint8_t SD_CS_GPIO
SD chip select GPIO (on UART0 Rx)
Definition: Dilbert.h:21
Dilbert()
Create a new driver.
Definition: Dilbert.cpp:10
static const uint8_t MCP23017_INT_GPIO
MCP23017 interrupt GPIO (on UART0 Tx)
Definition: Dilbert.h:20
static const uint8_t TFT_DC_GPIO
TFT DC GPIO.
Definition: Dilbert.h:23
void begin(size_t numNeoPixels=8)
Initialises the badge hardware.
Definition: Dilbert.cpp:34
void setBacklight(uint16_t intensity)
Sets the backlight intensity.
Definition: Dilbert.cpp:84
Adafruit_MCP23017 & io()
Gets the IO expender driver.
Definition: Dilbert.h:80
Adafruit_NeoPixel & neoPixels()
Gets the NeoPixel LED driver.
Definition: Dilbert.h:67
static const uint8_t NEOPIXEL_GPIO
NeoPIxel GPIO.
Definition: Dilbert.h:25
Definition: Adafruit_ILI9341.h:121
static const uint8_t BUTTON_A
A button GPIO (on MCP23017)
Definition: Dilbert.h:31
static const uint8_t BUTTON_UP
Up buppion GPIO (on MCP23017)
Definition: Dilbert.h:27