-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.h
48 lines (42 loc) · 1.25 KB
/
main.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
39
40
41
42
43
44
45
46
47
48
/**
* Wiegand-SPI fimreware for ATTINY25/45/85
*
* main.h - main header file
*
* (c) 2016 Sam Thompson <[email protected]>
* The MIT License
*/
#ifndef _MAIN_H
#define _MAIN_H
/**
* Wiegand I/O
* These are parameterized should we want to support other MCUs
*/
#define WGD_DIR_REG DDRB
#define WGD_OUT_REG PORTB
#define WGD_IN_REG PINB
#define WGD_D0 PB3
#define WGD_D1 PB4
#define WGD_IRQ PB5
#define WGD_PCINT_D0 PCINT3
#define WGD_PCINT_D1 PCINT4
/** Timeouts to end listening for a Wiegand transmission */
#define T1_OFFSET 64
#define T1_PRESCALE (_BV(CS12) | _BV(CS11))
/**
* USI I/O
* These are parameterized should we want to support other MCUs
*/
#define USI_DIR_REG DDRB
#define USI_OUT_REG PORTB
#define USI_IN_REG PIN
#define USI_CLOCK_PIN PB2
#define USI_DATAIN_PIN PB0
#define USI_DATAOUT_PIN PB1
/** The status flag has a 6-bit counter and two flags it can raise */
#define FLAG_COUNTER_MSK 0x3F
#define FLAG_ERROR 6
#define FLAG_HAS_DATA 7
/** Just like _BV() but for 64-bit integers */
#define _BV_ULL(b) (1ULL<<(b))
#endif