-
Notifications
You must be signed in to change notification settings - Fork 11
/
sr.h
38 lines (31 loc) · 841 Bytes
/
sr.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
#ifndef SR_H
#define SR_H
#include <stdint.h>
const uint16_t DEBOUNCE_DELAY = 500;
// Shift register states
struct sr {
uint8_t state; // Shift register current state
int8_t previous; // Shift register previous state
uint32_t debounceTime; // Shift register time since last debounce
};
// Shift register button - pin mappings
struct srAssignments {
// Shift register 1
const uint8_t button2;
const uint8_t button3;
const uint8_t button5;
const uint8_t button6;
const uint8_t button9;
const uint8_t buttonNext;
// Shift register 2
const uint8_t button1;
const uint8_t button4;
const uint8_t button7;
const uint8_t button8;
const uint8_t buttonPlayPause;
const uint8_t buttonPrevious;
};
void setupSr();
uint8_t srShiftIn(bool doLatch);
bool debounce(sr *srd);
#endif