Skip to content

Commit 5a11529

Browse files
authored
Merge pull request #383 from adafruit/refactor-button
Refactor button
2 parents 583d67b + a6f668e commit 5a11529

File tree

64 files changed

+1745
-1898
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1745
-1898
lines changed

AGENTS.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Agent Instructions
2+
3+
## Style
4+
- Follow the repo `.clang-format` when making changes.
5+
6+
## Build / Verify
7+
- Prefer CMake for testing/verification.
8+
- Always build both boards during verification:
9+
- `feather_nrf52832`
10+
- `feather_nrf52840_express`
11+
12+
### CMake (preferred)
13+
```bash
14+
cmake -S . -B cmake-build-feather_nrf52832 -DBOARD=feather_nrf52832
15+
cmake --build cmake-build-feather_nrf52832
16+
17+
cmake -S . -B cmake-build-feather_nrf52840_express -DBOARD=feather_nrf52840_express
18+
cmake --build cmake-build-feather_nrf52840_express
19+
```
20+
21+
### Make (alternate)
22+
```bash
23+
make BOARD=feather_nrf52832 all
24+
make BOARD=feather_nrf52840_express all
25+
```

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ Officially supported boards are:
2424
- Adafruit Metro nRF52840 Express
2525
- [Raytac MDBT50Q-RX Dongle](https://www.adafruit.com/product/5199)
2626

27-
In addition, there is also lots of other 3rd-party boards which are added by other makers, users and community. Check out the [complete list of all boards here](/src/boards).
27+
In addition, there is also lots of other 3rd-party boards which are added by other makers, users and community. Check
28+
out the [complete list of all boards here](/supported_boards.md).
2829

2930
## Features
3031

src/boards/adm_b_nrf52840_1/board.h

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,43 +25,40 @@
2525
#ifndef ADM_B_NRF52840_1_H
2626
#define ADM_B_NRF52840_1_H
2727

28-
#define _PINNUM(port, pin) ((port)*32 + (pin))
29-
3028
/*------------------------------------------------------------------*/
3129
/* LED
3230
*------------------------------------------------------------------*/
33-
#define LEDS_NUMBER 1
34-
#define LED_PRIMARY_PIN _PINNUM(0, 19) // Red
35-
//#define LED_SECONDARY_PIN 12 // Blue
36-
#define LED_STATE_ON 0
31+
#define LEDS_NUMBER 1
32+
#define LED_PRIMARY_PIN PINNUM(0, 19) // Red
33+
// #define LED_SECONDARY_PIN 12 // Blue
34+
#define LED_STATE_ON 0
3735

3836
/*------------------------------------------------------------------*/
3937
/* BUTTON
4038
*------------------------------------------------------------------*/
41-
#define BUTTONS_NUMBER 2
4239

43-
#define BUTTON_1 _PINNUM(0, 11)
44-
#define BUTTON_2 _PINNUM(0, 12)
40+
#define BUTTON_DFU PINNUM(0, 11)
41+
#define BUTTON_DFU_OTA PINNUM(0, 12)
4542
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
4643

4744
//--------------------------------------------------------------------+
4845
// BLE OTA
4946
//--------------------------------------------------------------------+
50-
#define BLEDIS_MANUFACTURER "Atelier-Du-Maker"
51-
#define BLEDIS_MODEL "ADM_B_NRF52840_1"
47+
#define BLEDIS_MANUFACTURER "Atelier-Du-Maker"
48+
#define BLEDIS_MODEL "ADM_B_NRF52840_1"
5249

5350
//--------------------------------------------------------------------+
5451
// USB
5552
//--------------------------------------------------------------------+
5653

57-
#define USB_DESC_VID 0x239A
58-
#define USB_DESC_UF2_PID 0x009F
59-
#define USB_DESC_CDC_ONLY_PID 0x009F
54+
#define USB_DESC_VID 0x239A
55+
#define USB_DESC_UF2_PID 0x009F
56+
#define USB_DESC_CDC_ONLY_PID 0x009F
6057

6158
//------------- UF2 -------------//
62-
#define UF2_PRODUCT_NAME "AtelierDuMaker NRF52840 Breakout"
63-
#define UF2_VOLUME_LABEL "ADM840BOOT"
64-
#define UF2_BOARD_ID "ADM_B_NRF52840_1"
65-
#define UF2_INDEX_URL "https://github.com/Atelier-Du-Maker/HolyIoT_NRF52840"
59+
#define UF2_PRODUCT_NAME "AtelierDuMaker NRF52840 Breakout"
60+
#define UF2_VOLUME_LABEL "ADM840BOOT"
61+
#define UF2_BOARD_ID "ADM_B_NRF52840_1"
62+
#define UF2_INDEX_URL "https://github.com/Atelier-Du-Maker/HolyIoT_NRF52840"
6663

6764
#endif // ADM_B_NRF52840_1_H

src/boards/ae_bl652_bo/board.h

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,26 @@
2828
/*------------------------------------------------------------------*/
2929
/* LED
3030
*------------------------------------------------------------------*/
31-
#define LEDS_NUMBER 2
32-
#define LED_PRIMARY_PIN 17 // LED1
33-
#define LED_SECONDARY_PIN 19 // LED2
34-
#define LED_STATE_ON 1
31+
#define LEDS_NUMBER 2
32+
#define LED_PRIMARY_PIN 17 // LED1
33+
#define LED_SECONDARY_PIN 19 // LED2
34+
#define LED_STATE_ON 1
3535

3636
/*------------------------------------------------------------------*/
3737
/* BUTTON
3838
*------------------------------------------------------------------*/
39-
#define BUTTONS_NUMBER 2
40-
#define BUTTON_1 11 // BTN1
41-
#define BUTTON_2 15 // BTN2
42-
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
39+
#define BUTTON_DFU 11 // BTN1
40+
#define BUTTON_DFU_OTA 15 // BTN2
41+
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
4342

4443
/*------------------------------------------------------------------*/
4544
/* UART (only used by nRF52832)
4645
*------------------------------------------------------------------*/
47-
#define RX_PIN_NUMBER 8
48-
#define TX_PIN_NUMBER 6
49-
#define CTS_PIN_NUMBER 0
50-
#define RTS_PIN_NUMBER 0
51-
#define HWFC false
46+
#define RX_PIN_NUMBER 8
47+
#define TX_PIN_NUMBER 6
48+
#define CTS_PIN_NUMBER 0
49+
#define RTS_PIN_NUMBER 0
50+
#define HWFC false
5251

5352
//--------------------------------------------------------------------+
5453
// BLE OTA

src/boards/aramcon2_badge/board.h

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,41 +25,38 @@
2525
#ifndef _ARAMCON2_BADGE_H
2626
#define _ARAMCON2_BADGE_H
2727

28-
#define _PINNUM(port, pin) ((port)*32 + (pin))
29-
3028
/*------------------------------------------------------------------*/
3129
/* LED
3230
*------------------------------------------------------------------*/
33-
#define LEDS_NUMBER 1
34-
#define LED_PRIMARY_PIN _PINNUM(1, 11) // Red
31+
#define LEDS_NUMBER 1
32+
#define LED_PRIMARY_PIN PINNUM(1, 11) // Red
3533

36-
#define LED_NEOPIXEL _PINNUM(0, 8)
37-
#define NEOPIXELS_NUMBER 2
38-
#define BOARD_RGB_BRIGHTNESS 0x040404
34+
#define LED_NEOPIXEL PINNUM(0, 8)
35+
#define NEOPIXELS_NUMBER 2
36+
#define BOARD_RGB_BRIGHTNESS 0x040404
3937

4038
/*------------------------------------------------------------------*/
4139
/* BUTTON
4240
*------------------------------------------------------------------*/
43-
#define BUTTONS_NUMBER 2
44-
#define BUTTON_1 _PINNUM(0, 2) // left Button
45-
#define BUTTON_2 _PINNUM(0, 29) // middle button
46-
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
41+
#define BUTTON_DFU PINNUM(0, 2) // left Button
42+
#define BUTTON_DFU_OTA PINNUM(0, 29) // middle button
43+
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
4744

4845
// Used as model string in OTA mode
49-
#define BLEDIS_MANUFACTURER "ARAMCON Badge Team"
50-
#define BLEDIS_MODEL "ARAMCON2 Badge"
46+
#define BLEDIS_MANUFACTURER "ARAMCON Badge Team"
47+
#define BLEDIS_MODEL "ARAMCON2 Badge"
5148

5249
//--------------------------------------------------------------------+
5350
// USB
5451
//--------------------------------------------------------------------+
55-
#define USB_DESC_VID 0x239A
56-
#define USB_DESC_UF2_PID 0x007B
57-
#define USB_DESC_CDC_ONLY_PID 0x007B
52+
#define USB_DESC_VID 0x239A
53+
#define USB_DESC_UF2_PID 0x007B
54+
#define USB_DESC_CDC_ONLY_PID 0x007B
5855

5956
//------------- UF2 -------------//
60-
#define UF2_PRODUCT_NAME "ARAMCON2 Badge"
61-
#define UF2_VOLUME_LABEL "ARAMBOOT"
62-
#define UF2_BOARD_ID "nrf52840-ARAMCON2-Badge"
63-
#define UF2_INDEX_URL "https://github.com/aramcon-badge"
57+
#define UF2_PRODUCT_NAME "ARAMCON2 Badge"
58+
#define UF2_VOLUME_LABEL "ARAMBOOT"
59+
#define UF2_BOARD_ID "nrf52840-ARAMCON2-Badge"
60+
#define UF2_INDEX_URL "https://github.com/aramcon-badge"
6461

6562
#endif // _ARAMCON2_BADGE_H

src/boards/aramcon_badge_2019/board.h

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,43 +26,40 @@
2626
#ifndef _ARAMCON_BADGE_2019_H
2727
#define _ARAMCON_BADGE_2019_H
2828

29-
#define _PINNUM(port, pin) ((port)*32 + (pin))
30-
3129
/*------------------------------------------------------------------*/
3230
/* LED
3331
*------------------------------------------------------------------*/
34-
#define LEDS_NUMBER 1
35-
#define LED_PRIMARY_PIN _PINNUM(1, 11) // Red
32+
#define LEDS_NUMBER 1
33+
#define LED_PRIMARY_PIN PINNUM(1, 11) // Red
3634

37-
#define LED_NEOPIXEL _PINNUM(0, 8)
38-
#define NEOPIXELS_NUMBER 4
39-
#define BOARD_RGB_BRIGHTNESS 0x040404
35+
#define LED_NEOPIXEL PINNUM(0, 8)
36+
#define NEOPIXELS_NUMBER 4
37+
#define BOARD_RGB_BRIGHTNESS 0x040404
4038

4139
/*------------------------------------------------------------------*/
4240
/* BUTTON
4341
*------------------------------------------------------------------*/
44-
#define BUTTONS_NUMBER 2
45-
#define BUTTON_1 _PINNUM(0, 2) // left Button
46-
#define BUTTON_2 _PINNUM(0, 29) // middle button
47-
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
42+
#define BUTTON_DFU PINNUM(0, 2) // left Button
43+
#define BUTTON_DFU_OTA PINNUM(0, 29) // middle button
44+
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
4845

4946
//--------------------------------------------------------------------+
5047
// BLE OTA
5148
//--------------------------------------------------------------------+
52-
#define BLEDIS_MANUFACTURER "ARAMCON Badge Team"
53-
#define BLEDIS_MODEL "ARAMCON Badge 2019"
49+
#define BLEDIS_MANUFACTURER "ARAMCON Badge Team"
50+
#define BLEDIS_MODEL "ARAMCON Badge 2019"
5451

5552
//--------------------------------------------------------------------+
5653
// USB
5754
//--------------------------------------------------------------------+
58-
#define USB_DESC_VID 0x239A
59-
#define USB_DESC_UF2_PID 0x0079
60-
#define USB_DESC_CDC_ONLY_PID 0x0079
55+
#define USB_DESC_VID 0x239A
56+
#define USB_DESC_UF2_PID 0x0079
57+
#define USB_DESC_CDC_ONLY_PID 0x0079
6158

6259
//------------- UF2 -------------//
63-
#define UF2_PRODUCT_NAME "ARAMCON Badge 2019"
64-
#define UF2_VOLUME_LABEL "ARAMBOOT"
65-
#define UF2_BOARD_ID "nrf52840-ARAMCON-Badge-2019"
66-
#define UF2_INDEX_URL "https://github.com/aramcon-badge"
60+
#define UF2_PRODUCT_NAME "ARAMCON Badge 2019"
61+
#define UF2_VOLUME_LABEL "ARAMBOOT"
62+
#define UF2_BOARD_ID "nrf52840-ARAMCON-Badge-2019"
63+
#define UF2_INDEX_URL "https://github.com/aramcon-badge"
6764

6865
#endif // _ARAMCON_BADGE_2019_H

src/boards/arcade_feather_nrf52840_express/board.cmake

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/boards/arcade_feather_nrf52840_express/board.h

Lines changed: 0 additions & 70 deletions
This file was deleted.

src/boards/arcade_feather_nrf52840_express/board.mk

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/boards/arcade_feather_nrf52840_express/pinconfig.c

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)