forked from qmk/qmk_firmware
-
Notifications
You must be signed in to change notification settings - Fork 29
/
custom_board.h
130 lines (105 loc) · 3.16 KB
/
custom_board.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#ifndef CUSTOM_BOARD_H
#define CUSTOM_BOARD_H
#ifdef __cplusplus
extern "C" {
#endif
#define GPIO(port, pin) ((port << 6) | pin)
//#define USE_NRFMICRO_1_1
//#define USE_NRFMICRO_1_2
#define USE_NRFMICRO_1_3
#ifdef USE_NRFMICRO_1_1
#define FLIPPED_NRFMICRO
#define USE_SWITCH_PIN
#define USE_GND_POWER_PIN
#define USE_BATTERY_PIN
#define BATTERY_R1 10
#define BATTERY_R2 13
#endif
#ifdef USE_NRFMICRO_1_2
#define USE_INTERNAL_LDO
#define USE_MCP73811_CTRL
//#define USE_MCP73831_CTRL
#define USE_VCC_POWER_PIN
#define USE_BATTERY_PIN
#define BATTERY_R1 820
#define BATTERY_R2 2000
#endif
#ifdef USE_NRFMICRO_1_3
#define USE_TP4054_CTRL
#define USE_VCC_POWER_PIN
#define USE_BATTERY_PIN
#define BATTERY_R1 820
#define BATTERY_R2 2000
#endif
// there are currently 3 types of charger control, some of them use 13K internal pull-down:
// USE_MCP73811_CTRL - STAT_PIN is 0/1: disable/enable, PROG_PIN is 0/1: 85/450 mA
// USE_MCP73831_CTRL - no resistor (!), PROG_PIN is no-pull/pull-down: disable/77 mA
// USE_TP4054_CTRL - 10K resistor, PROG_PIN is no-pull/gnd/pull-down: disable/100 mA/43 mA
#define PIN1 GPIO(0,6)
#define PIN2 GPIO(0,8)
#ifdef FLIPPED_NRFMICRO //flipped nRFMicro 0.03 (jumpers on the on/off switch side)
#define PIN20 GPIO(0,15)
#define PIN19 GPIO(0,17)
#define PIN18 GPIO(0,20)
#define PIN17 GPIO(0,13)
#define PIN16 GPIO(0,24)
#define PIN15 GPIO(0,9)
#define PIN14 GPIO(0,10)
#define PIN13 GPIO(1,6)
#define PIN12 GPIO(1,11)
#define PIN11 GPIO(0,28)
#define PIN10 GPIO(0,3)
#define PIN9 GPIO(1,13)
#define PIN8 GPIO(0,2)
#define PIN7 GPIO(0,29)
#define PIN6 GPIO(0,31)
#define PIN5 GPIO(0,30)
#else // regular nRFMicro 0.03 (jumpers on the USB connector side)
#define PIN5 GPIO(0,15)
#define PIN6 GPIO(0,17)
#define PIN7 GPIO(0,20)
#define PIN8 GPIO(0,13)
#define PIN9 GPIO(0,24)
#define PIN10 GPIO(0,9)
#define PIN11 GPIO(0,10)
#define PIN12 GPIO(1,6)
#define PIN13 GPIO(1,11)
#define PIN14 GPIO(0,28)
#define PIN15 GPIO(0,3)
#define PIN16 GPIO(1,13)
#define PIN17 GPIO(0,2)
#define PIN18 GPIO(0,29)
#define PIN19 GPIO(0,31)
#define PIN20 GPIO(0,30)
#endif
#define LED_PIN GPIO(1,10)
#define SWITCH_PIN GPIO(0,26)
#define POWER_PIN GPIO(1,9)
#define STAT_PIN GPIO(0,7)
#define PROG_PIN GPIO(0,5)
// pin 0.04, must be analog
#define BATTERY_PIN NRF_SAADC_INPUT_AIN2
// i2c pins
#define CONFIG_PIN_SDA PIN5
#define CONFIG_PIN_SCL PIN6
//#define NRF_LOG_ENABLED 0
//#define NRF_LOG_BACKEND_SERIAL_USES_UART 0
//#define NRF_LOG_BACKEND_SERIAL_UART_TX_PIN 5
#define NRF_LOG_BACKEND_UART_TX_PIN 8
//#define DEBUG
// Low frequency clock source to be used by the SoftDevice
#ifdef S210
// #define NRF_CLOCK_LFCLKSRC NRF_CLOCK_LFCLKSRC_XTAL_20_PPM
#else
// NRF_CLOCK_LF_SRC_RC - internal oscillator
// NRF_CLOCK_LF_SRC_XTAL - external crystal
// using E73 internal oscillator (assume there's no external crystal soldered)
#define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_RC, \
.rc_ctiv = 16, \
.rc_temp_ctiv = 2, \
.xtal_accuracy = 0}
#endif
#ifdef __cplusplus
}
#endif
#endif // CUSTOM_BOARD_H