File tree Expand file tree Collapse file tree 2 files changed +4
-8
lines changed
libraries/Bluefruit52Lib/examples/Peripheral/ancs_oled Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -133,9 +133,9 @@ void suspendLoop(void);
133
133
#define bit (b ) (1UL << (b))
134
134
135
135
#ifdef NRF_P1
136
- #define digitalPinToPort (P ) ( (g_ADigitalPinMap[P] < 32 ) ? NRF_P0 : NRF_P1 )
136
+ #define digitalPinToPort (P ) ( (g_ADigitalPinMap[P] < 32 ) ? NRF_P0 : NRF_P1 )
137
137
#else
138
- #define digitalPinToPort (P ) ( NRF_P0 )
138
+ #define digitalPinToPort (P ) ( NRF_P0 )
139
139
#endif
140
140
141
141
#define digitalPinToBitMask (P ) ( 1UL << ( g_ADigitalPinMap[P] < 32 ? g_ADigitalPinMap[P] : (g_ADigitalPinMap[P]-32 ) ) )
Original file line number Diff line number Diff line change 30
30
#if defined ARDUINO_NRF52832_FEATHER
31
31
// Feather nRF52832
32
32
#define BUTTON_A 31
33
- #define BUTTON_B 30
34
33
#define BUTTON_C 27
35
34
36
35
#else
37
36
// Default for others
38
37
#define BUTTON_A 9
39
- #define BUTTON_B 6
40
38
#define BUTTON_C 5
41
39
42
40
#endif
@@ -75,7 +73,6 @@ void setup()
75
73
{
76
74
// Button configured
77
75
pinMode (BUTTON_A, INPUT_PULLUP);
78
- pinMode (BUTTON_B, INPUT_PULLUP);
79
76
pinMode (BUTTON_C, INPUT_PULLUP);
80
77
81
78
// init with the I2C addr 0x3C (for the 128x32) and show splashscreen
@@ -92,7 +89,7 @@ void setup()
92
89
93
90
Bluefruit.begin ();
94
91
Bluefruit.setTxPower (4 ); // Check bluefruit.h for supported values
95
- Bluefruit. setName ( " Bluefruit52 " );
92
+
96
93
Bluefruit.Periph .setConnectCallback (connect_callback);
97
94
Bluefruit.Periph .setDisconnectCallback (disconnect_callback);
98
95
@@ -453,8 +450,7 @@ uint32_t readPressedButtons(void)
453
450
454
451
// Take current read and masked with BUTTONs
455
452
// Note: Bitwise inverted since buttons are active (pressed) LOW
456
- uint32_t debounced = ~(*portInputRegister ( digitalPinToPort (0 ) ));
457
- debounced &= (bit (BUTTON_A) | bit (BUTTON_B) | bit (BUTTON_C));
453
+ uint32_t debounced = ~( (digitalRead (BUTTON_A) << BUTTON_A) | (digitalRead (BUTTON_C) << BUTTON_C) );
458
454
459
455
// Copy current state into array
460
456
states[ (index & (MAX_CHECKS-1 )) ] = debounced;
You can’t perform that action at this time.
0 commit comments