Move defines into header for keypad encoder
This commit is contained in:
parent
2c4a1b1565
commit
8f47841b72
2 changed files with 12 additions and 11 deletions
12
74C922.c
12
74C922.c
|
@ -1,16 +1,8 @@
|
|||
#include "config.h"
|
||||
#include "74C922.h"
|
||||
#include <avr/io.h>
|
||||
#include <stdbool.h>
|
||||
#include <util/delay.h>
|
||||
|
||||
// Pin Definitions
|
||||
#define ENCODER_A_PIN PD6
|
||||
#define ENCODER_B_PIN PD5
|
||||
#define ENCODER_C_PIN PD4
|
||||
#define ENCODER_D_PIN PD3
|
||||
#define ENCODER_OE_PIN PD2
|
||||
#define ENCODER_DA_PIN PD1
|
||||
|
||||
void prepare_interrupt() {
|
||||
EICRA |= (1 << ISC00); // Any logical change triggers interrupt
|
||||
EIMSK |= (1 << INT0); // INT0 external interrupt
|
||||
|
@ -50,4 +42,4 @@ uint8_t encoder_read() {
|
|||
return encoder_data;
|
||||
}
|
||||
|
||||
bool encoder_available() { return (PIND & (1 << ENCODER_DA_PIN)); }
|
||||
bool encoder_available() { return (PIND & (1 << ENCODER_DA_PIN)); }
|
||||
|
|
11
74C922.h
11
74C922.h
|
@ -1,8 +1,17 @@
|
|||
#ifndef H74C922_H
|
||||
#define H74C922_H
|
||||
#include <stdint.h>
|
||||
|
||||
// Pin Definitions
|
||||
#define ENCODER_A_PIN PD6
|
||||
#define ENCODER_B_PIN PD5
|
||||
#define ENCODER_C_PIN PD4
|
||||
#define ENCODER_D_PIN PD3
|
||||
#define ENCODER_OE_PIN PD2
|
||||
#define ENCODER_DA_PIN PD1
|
||||
|
||||
void encoder_init();
|
||||
uint8_t encoder_read();
|
||||
bool encoder_available();
|
||||
|
||||
#endif // 74C922_H
|
||||
#endif // 74C922_H
|
||||
|
|
Loading…
Add table
Reference in a new issue