@@ -67,14 +67,18 @@ const uint32_t g_ADigitalPinMap[] =
6767 19 , // D31 is P0.19 is PGOOD
6868};
6969
70-
71- void disableUnusedPin (uint8_t pin) {
72- NRF_GPIO->PIN_CNF [pin] = (GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos) |
73- (GPIO_PIN_CNF_INPUT_Disconnect << GPIO_PIN_CNF_INPUT_Pos) |
74- (GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos);
70+ void disableUnusedPin (NRF_GPIO_Type *port, uint8_t pin) {
71+ // Configure for lowest power consumption
72+ port->PIN_CNF [pin] = ((uint32_t )GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos)
73+ | ((uint32_t )GPIO_PIN_CNF_INPUT_Disconnect << GPIO_PIN_CNF_INPUT_Pos)
74+ | ((uint32_t )GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos)
75+ | ((uint32_t )GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos)
76+ | ((uint32_t )GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos);
7577}
7678
7779
80+
81+
7882void initVariant ()
7983{
8084 // Enable DC/DC converter for better power efficiency
@@ -89,23 +93,22 @@ void initVariant()
8993 // nrf_gpio_cfg_input(18, NRF_GPIO_PIN_PULLDOWN); // P0.18
9094
9195
92- // Configure unused P0.xx pins
93- disableUnusedPin (9 ); // P0.09
94- disableUnusedPin (10 ); // P0.10
95- disableUnusedPin (13 ); // P0.13
96- disableUnusedPin (14 ); // P0.14
97- disableUnusedPin (15 ); // P0.15
98- disableUnusedPin (16 ); // P0.16
99- disableUnusedPin (17 ); // P0.17
100- disableUnusedPin (20 ); // P0.20
101-
102- // Configure unused P1.xx pins
103- disableUnusedPin (P1_BANK + 0 ); // P1.00
104- disableUnusedPin (P1_BANK + 1 ); // P1.01
105- disableUnusedPin (P1_BANK + 3 ); // P1.03
106- disableUnusedPin (P1_BANK + 4 ); // P1.04
107- disableUnusedPin (P1_BANK + 6 ); // P1.06
108-
96+ // Configure unused P0.xx pins
97+ disableUnusedPin (NRF_P0, 9 ); // P0.09
98+ disableUnusedPin (NRF_P0, 10 ); // P0.10
99+ disableUnusedPin (NRF_P0, 13 ); // P0.13
100+ disableUnusedPin (NRF_P0, 14 ); // P0.14
101+ disableUnusedPin (NRF_P0, 15 ); // P0.15
102+ disableUnusedPin (NRF_P0, 16 ); // P0.16
103+ disableUnusedPin (NRF_P0, 17 ); // P0.17
104+ disableUnusedPin (NRF_P0, 20 ); // P0.20
105+
106+ // Configure unused P1.xx pins
107+ disableUnusedPin (NRF_P1, 0 ); // P1.00
108+ disableUnusedPin (NRF_P1, 1 ); // P1.01
109+ disableUnusedPin (NRF_P1, 3 ); // P1.03
110+ disableUnusedPin (NRF_P1, 4 ); // P1.04
111+ disableUnusedPin (NRF_P1, 6 ); // P1.06
109112 // Disable debug interface if not actively debugging
110113 NRF_CLOCK->TRACECONFIG = 0 ;
111114
0 commit comments