-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmarco.ino
38 lines (32 loc) · 992 Bytes
/
marco.ino
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
#include <Adafruit_NeoPixel.h>
#include <RotaryEncoder.h>
#include <Wire.h>
#include <Keyboard.h>
#include "marco.h"
using namespace marco;
Controller *mothership;
Adafruit_NeoPixel *pixels;
Adafruit_SH1106G *display;
RotaryEncoder *ec;
DisplayConfiguration *dc;
void checkEncoderPosition()
{
ec->tick();
}
void setup()
{
// set rotary encoder inputs and interrupts
pinMode(PIN_ROTA, INPUT_PULLUP);
pinMode(PIN_ROTB, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(PIN_ROTA), checkEncoderPosition, CHANGE);
attachInterrupt(digitalPinToInterrupt(PIN_ROTB), checkEncoderPosition, CHANGE);
pixels = new Adafruit_NeoPixel(NUM_NEOPIXEL, PIN_NEOPIXEL, NEO_GRB + NEO_KHZ800);
display = new Adafruit_SH1106G(128, 64, &SPI1, OLED_DC, OLED_RST, OLED_CS);
ec = new RotaryEncoder(PIN_ROTA, PIN_ROTB, RotaryEncoder::LatchMode::FOUR3);
dc = new DisplayConfiguration("marco");
mothership = new Controller(pixels, display, ec, dc);
}
void loop()
{
mothership->refresh();
}