-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy patharythmatik.h
More file actions
64 lines (50 loc) · 1.77 KB
/
Copy patharythmatik.h
File metadata and controls
64 lines (50 loc) · 1.77 KB
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
#ifndef ARYTHMATIK_H
#define ARYTHMATIK_H
#include <Arduino.h>
// Oled setting
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <EEPROM.h>
#include <EncoderButton.h>
#include <Wire.h>
#include "arythmatik_config.h"
#include "arythmatik_peripherials.h"
#include "digital_input.h"
#include "digital_output.h"
#include "encoder_dir.h"
namespace modulove {
/// @brief Hardware abstraction wrapper for A-RYTH-MATIK module.
class Arythmatik {
public:
/// @brief Constructor
Arythmatik()
: display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1),
eb(ENCODER_PIN1, ENCODER_PIN2, ENCODER_SW_PIN) {}
/// @brief Deconstructor
~Arythmatik() {}
// Module configuration storage struct.
arythmatik::Config config;
/// @brief Initializes the Arduino, and A-RYTH-MATIK hardware.
void Init();
/// @brief Pin change handlers
/// @param callback
void AttachClockHandler(void (*callback)(void));
void AttachResetHandler(void (*callback)(void));
/// @brief Read the state of the CLK and RST inputs.
void ProcessInputs();
/// @brief Parse the configured EncoderButton increment direction.
/// @return Direction of turn or unchanged.
arythmatik::Direction EncoderDirection();
Adafruit_SSD1306 display; ///< OLED display object.
EncoderButton eb; ///< EncoderButton object.
DigitalOutput outputs[arythmatik::OUTPUT_COUNT]; ///< An array containing
///< each Output object.
DigitalInput clk; ///< CLK Digital Input object.
DigitalInput rst; ///< RST Digital Input object.
private:
void InitDisplay();
void InitInputs();
void InitOutputs();
};
} // namespace modulove
#endif