-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhwprofile.h
81 lines (55 loc) · 2.05 KB
/
hwprofile.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef BOILPOWER_HWPROFILE_H_
#define BOILPOWER_HWPROFILE_H_
//Display output registers
#define DISPLAY_CHAR_SELECT_OUTPUT_REG PORTC
#define DISPLAY_CHAR_OUTPUT_REG PORTD
//Display direction registers
#define DISPLAY_CHAR_SELECT_DIR_REG DDRC
#define DISPLAY_CHAR_DIR_REG DDRD
//Display pin bitmasks
static const uint8_t kDisplayCharSelectPinMask = 0x38;
static const uint8_t kDisplayCharPinMask = 0xff;
//Display char select bit map
#define DISPLAY_CHAR_COUNT 3
#define DISPLAY_MAX_NUMBER 999
static const uint8_t kDisplayCharSelect[DISPLAY_CHAR_COUNT] = {_BV(5), _BV(4), _BV(3)};
//Display Timer Configuration
#define DISPLAY_TIMER_CONFIG_A_REG TCCR0A
#define DISPLAY_TIMER_CONFIG_B_REG TCCR0B
#define DISPLAY_TIMER_INTERRUPT_MASK_REG TIMSK0
#define DISPLAY_TIMER_COMPARE_VALUE_REG OCR0A
static const uint8_t kDisplayTimerMode = _BV(WGM01);
static const uint8_t kDisplayTimerInterruptMask = _BV(OCIE0A);
static const uint8_t kDisplayTimerCompareValue = 125;
static const uint8_t kDisplayTimerPrescaler = (_BV(CS00) | _BV(CS01));
//Encoder input register
#define ENCODER_INPUT_REG PINC
//Encoder direction register
#define ENCODER_DIR_REG DDRC
//Encoder pin bitmask
static const uint8_t kEncoderPinMask = 0x07;
//Encoder pin function mapping
static const uint8_t kEncoderPinA = _BV(0);
static const uint8_t kEncoderPinB = _BV(1);
static const uint8_t kEncoderPinE = _BV(2);
//Encoder Pin Change Interrupts
#define ENCODER_PCINT_MASK_REG PCMSK1
#define ENCODER_PCINT_VECTOR PCINT1_vect
static const uint8_t kEncoderPCINTPort = _BV(PCIE1);
static const uint8_t kEncoderPCINTMask = _BV(PCINT8) | _BV(PCINT10);
//Status output register
#define STATUS_OUTPUT_REG PORTB
//Status direction register
#define STATUS_DIR_REG DDRB
//Status pin bitmask
static const uint8_t kStatusPinMask = 0x23;
//Status output register
#define PWM_OUTPUT_REG PORTB
/* PWM Output Pin PB2 */
//PWM direction register
#define PWM_DIR_REG DDRB
//PWM pin bitmask
static const uint8_t kPwmPinMask = 0x04;
//OneWire PB3
//Option PB4
#endif