nrf/boards: Add support for BLYST Nano module based boards.

- IBK-BLYST-NANO: Breakout board
- IDK-BLYST-NANO: DevKit board with builtin IDAP-M CMSIS-DAP Debug JTAG,
  RGB led
- BLUEIO-TAG-EVIM: Sensor tag board (environmental sensor
  (T, H, P, Air quality) + 9 axis motion sensor)

Also, the LED module has been updated to support individual base level
configuration of each LED. If set, this will be used instead of the
common configuration, MICROPY_HW_LED_PULLUP. The new configuration,
MICROPY_HW_LEDX_LEVEL, where X is the LED number can be used to set
the base level of the specific LED.
pull/4727/head
Nguyen Hoan Hoang 2019-03-20 17:38:03 +07:00 zatwierdzone przez Glenn Ruben Bakke
rodzic 2a791170ce
commit 9a6f6fd68d
13 zmienionych plików z 465 dodań i 17 usunięć

Wyświetl plik

@ -296,6 +296,14 @@ sd: $(BUILD)/$(OUTPUT_FILENAME).hex
pyocd-flashtool -t $(MCU_VARIANT) $(SOFTDEV_HEX)
pyocd-flashtool -t $(MCU_VARIANT) $<
else ifeq ($(FLASHER), idap)
flash: $(BUILD)/$(OUTPUT_FILENAME).hex
IDAPnRFPRog $<
sd: $(BUILD)/$(OUTPUT_FILENAME).hex
IDAPnRFPRog $(SOFTDEV_HEX) $<
endif
$(BUILD)/$(OUTPUT_FILENAME).elf: $(OBJ)

Wyświetl plik

@ -34,6 +34,8 @@ This is a port of MicroPython to the Nordic Semiconductor nRF series of chips.
* [Adafruit Feather nRF52](https://www.adafruit.com/product/3406)
* [Thingy:52](http://www.nordicsemi.com/eng/Products/Nordic-Thingy-52)
* [Arduino Primo](http://www.arduino.org/products/boards/arduino-primo)
* [IBK-BLYST-NANO breakout board](https://www.crowdsupply.com/i-syst/blyst-nano)
* [BLUEIO-TAG-EVIM BLYST Nano Sensor board](https://www.crowdsupply.com/i-syst/blyst-nano)
* nRF52840
* [PCA10056](http://www.nordicsemi.com/eng/Products/nRF52840-Preview-DK)
@ -120,8 +122,20 @@ wt51822_s4at | s110 | Peripheral | Manual
pca10040 | s132 | Peripheral and Central | [Segger](#segger-targets)
feather52 | s132 | Peripheral and Central | Manual, SWDIO and SWCLK solder points on the bottom side of the board
arduino_primo | s132 | Peripheral and Central | [PyOCD](#pyocdopenocd-targets)
ibk_blyst_nano | s132 | Peripheral and Central | [IDAP](#idap-midap-link-targets)
idk_blyst_nano | s132 | Peripheral and Central | [IDAP](#idap-midap-link-targets)
blueio_tag_evim | s132 | Peripheral and Central | [IDAP](#idap-midap-link-targets)
pca10056 | s140 | Peripheral and Central | [Segger](#segger-targets)
## IDAP-M/IDAP-Link Targets
Install the necessary tools to flash and debug using IDAP-M/IDAP-Link CMSIS-DAP Debug JTAG:
[IDAPnRFProg for Linux](https://sourceforge.net/projects/idaplinkfirmware/files/Linux/IDAPnRFProg_1_7_190320.zip/download)
[IDAPnRFProg for OSX](https://sourceforge.net/projects/idaplinkfirmware/files/OSX/IDAPnRFProg_1_7_190320.zip/download)
[IDAPnRFProg for Windows](https://sourceforge.net/projects/idaplinkfirmware/files/Windows/IDAPnRFProg_1_7_190320.zip/download)
## Segger Targets
Install the necessary tools to flash and debug using Segger:

Wyświetl plik

@ -0,0 +1,77 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2019 I-SYST inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#define MICROPY_HW_BOARD_NAME "BLUEIO-TAG-EVIM"
#define MICROPY_HW_MCU_NAME "NRF52832"
#define MICROPY_PY_SYS_PLATFORM "BLYST Nano"
#define MICROPY_PY_MACHINE_SOFT_PWM (1)
#define MICROPY_PY_MUSIC (1)
#define MICROPY_PY_MACHINE_UART (1)
#define MICROPY_PY_MACHINE_HW_PWM (1)
#define MICROPY_PY_MACHINE_HW_SPI (1)
#define MICROPY_PY_MACHINE_TIMER (1)
#define MICROPY_PY_MACHINE_RTCOUNTER (1)
#define MICROPY_PY_MACHINE_I2C (1)
#define MICROPY_PY_MACHINE_ADC (1)
#define MICROPY_PY_MACHINE_TEMP (1)
#define MICROPY_PY_RANDOM_HW_RNG (1)
#define MICROPY_HW_HAS_LED (1)
#define MICROPY_HW_LED_COUNT (4)
#define MICROPY_HW_LED_PULLUP (1)
#define MICROPY_HW_LED1 (30) // LED1
#define MICROPY_HW_LED1_LEVEL (0)
#define MICROPY_HW_LED2 (20) // LED2
#define MICROPY_HW_LED2_LEVEL (1)
#define MICROPY_HW_LED3 (19) // LED3
#define MICROPY_HW_LED3_LEVEL (1)
#define MICROPY_HW_LED4 (18) // LED4
#define MICROPY_HW_LED4_LEVEL (1)
// UART config
#define MICROPY_HW_UART1_RX (8)
#define MICROPY_HW_UART1_TX (7)
#define MICROPY_HW_UART1_CTS (12)
#define MICROPY_HW_UART1_RTS (11)
#define MICROPY_HW_UART1_HWFC (1)
// SPI0 config
#define MICROPY_HW_SPI0_NAME "SPI0"
#define MICROPY_HW_SPI0_SCK (23) //
#define MICROPY_HW_SPI0_MOSI (24) //
#define MICROPY_HW_SPI0_MISO (25) //
#define MICROPY_HW_PWM0_NAME "PWM0"
#define MICROPY_HW_PWM1_NAME "PWM1"
#define MICROPY_HW_PWM2_NAME "PWM2"
// buzzer pin
#define MICROPY_HW_MUSIC_PIN (14)
#define HELP_TEXT_BOARD_LED "1,2,3,4"

Wyświetl plik

@ -0,0 +1,8 @@
MCU_SERIES = m4
MCU_VARIANT = nrf52
MCU_SUB_VARIANT = nrf52832
SOFTDEV_VERSION = 6.1.1
LD_FILES += boards/nrf52832_512k_64k.ld
FLASHER = idap
NRF_DEFINES += -DNRF52832_XXAA

Wyświetl plik

@ -0,0 +1,30 @@
P2,P2
P3,P3
P4,P4
P5,P5
P6,P6
P7,P7
P8,P8
P9,P9
P10,P10
P11,P11
P12,P12
P13,P13
P14,P14
P15,P15
P16,P16
P17,P17
P18,P18
P19,P19
P20,P20
P21,P21
P22,P22
P23,P23
P24,P24
P25,P25
P26,P26
P27,P27
P28,P28
P29,P29
P30,P30
P31,P31
1 P2 P2
2 P3 P3
3 P4 P4
4 P5 P5
5 P6 P6
6 P7 P7
7 P8 P8
8 P9 P9
9 P10 P10
10 P11 P11
11 P12 P12
12 P13 P13
13 P14 P14
14 P15 P15
15 P16 P16
16 P17 P17
17 P18 P18
18 P19 P19
19 P20 P20
20 P21 P21
21 P22 P22
22 P23 P23
23 P24 P24
24 P25 P25
25 P26 P26
26 P27 P27
27 P28 P28
28 P29 P29
29 P30 P30
30 P31 P31

Wyświetl plik

@ -0,0 +1,69 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2019 I-SYST inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#define MICROPY_HW_BOARD_NAME "IBK-BLYST-NANO"
#define MICROPY_HW_MCU_NAME "NRF52832"
#define MICROPY_PY_SYS_PLATFORM "BLYST Nano"
#define MICROPY_PY_MACHINE_SOFT_PWM (1)
#define MICROPY_PY_MUSIC (1)
#define MICROPY_PY_MACHINE_UART (1)
#define MICROPY_PY_MACHINE_HW_PWM (1)
#define MICROPY_PY_MACHINE_HW_SPI (1)
#define MICROPY_PY_MACHINE_TIMER (1)
#define MICROPY_PY_MACHINE_RTCOUNTER (1)
#define MICROPY_PY_MACHINE_I2C (1)
#define MICROPY_PY_MACHINE_ADC (1)
#define MICROPY_PY_MACHINE_TEMP (1)
#define MICROPY_PY_RANDOM_HW_RNG (1)
#define MICROPY_HW_HAS_LED (1)
#define MICROPY_HW_LED_COUNT (3)
#define MICROPY_HW_LED_PULLUP (1)
#define MICROPY_HW_LED1 (30) // LED1
#define MICROPY_HW_LED2 (29) // LED2
#define MICROPY_HW_LED3 (28) // LED3
// UART config
#define MICROPY_HW_UART1_RX (8)
#define MICROPY_HW_UART1_TX (7)
#define MICROPY_HW_UART1_CTS (12)
#define MICROPY_HW_UART1_RTS (11)
#define MICROPY_HW_UART1_HWFC (1)
// SPI0 config
#define MICROPY_HW_SPI0_NAME "SPI0"
#define MICROPY_HW_SPI0_SCK (23) //
#define MICROPY_HW_SPI0_MOSI (24) //
#define MICROPY_HW_SPI0_MISO (25) //
#define MICROPY_HW_PWM0_NAME "PWM0"
#define MICROPY_HW_PWM1_NAME "PWM1"
#define MICROPY_HW_PWM2_NAME "PWM2"
#define HELP_TEXT_BOARD_LED "1,2,3"

Wyświetl plik

@ -0,0 +1,8 @@
MCU_SERIES = m4
MCU_VARIANT = nrf52
MCU_SUB_VARIANT = nrf52832
SOFTDEV_VERSION = 6.1.1
LD_FILES += boards/nrf52832_512k_64k.ld
FLASHER = idap
NRF_DEFINES += -DNRF52832_XXAA

Wyświetl plik

@ -0,0 +1,30 @@
P2,P2
P3,P3
P4,P4
P5,P5
P6,P6
P7,P7
P8,P8
P9,P9
P10,P10
P11,P11
P12,P12
P13,P13
P14,P14
P15,P15
P16,P16
P17,P17
P18,P18
P19,P19
P20,P20
P21,P21
P22,P22
P23,P23
P24,P24
P25,P25
P26,P26
P27,P27
P28,P28
P29,P29
P30,P30
P31,P31
1 P2 P2
2 P3 P3
3 P4 P4
4 P5 P5
5 P6 P6
6 P7 P7
7 P8 P8
8 P9 P9
9 P10 P10
10 P11 P11
11 P12 P12
12 P13 P13
13 P14 P14
14 P15 P15
15 P16 P16
16 P17 P17
17 P18 P18
18 P19 P19
19 P20 P20
20 P21 P21
21 P22 P22
22 P23 P23
23 P24 P24
24 P25 P25
25 P26 P26
26 P27 P27
27 P28 P28
28 P29 P29
29 P30 P30
30 P31 P31

Wyświetl plik

@ -0,0 +1,70 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2019 I-SYST inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#define MICROPY_HW_BOARD_NAME "IDK-BLYST-NANO"
#define MICROPY_HW_MCU_NAME "NRF52832"
#define MICROPY_PY_SYS_PLATFORM "BLYST Nano"
#define MICROPY_PY_MACHINE_SOFT_PWM (1)
#define MICROPY_PY_MUSIC (1)
#define MICROPY_PY_MACHINE_UART (1)
#define MICROPY_PY_MACHINE_HW_PWM (1)
#define MICROPY_PY_MACHINE_HW_SPI (1)
#define MICROPY_PY_MACHINE_TIMER (1)
#define MICROPY_PY_MACHINE_RTCOUNTER (1)
#define MICROPY_PY_MACHINE_I2C (1)
#define MICROPY_PY_MACHINE_ADC (1)
#define MICROPY_PY_MACHINE_TEMP (1)
#define MICROPY_PY_RANDOM_HW_RNG (1)
#define MICROPY_HW_HAS_LED (1)
#define MICROPY_HW_LED_COUNT (4)
#define MICROPY_HW_LED_PULLUP (1)
#define MICROPY_HW_LED1 (30) // LED1
#define MICROPY_HW_LED2 (29) // LED2
#define MICROPY_HW_LED3 (28) // LED3
#define MICROPY_HW_LED4 (27) // LED4
// UART config
#define MICROPY_HW_UART1_RX (8)
#define MICROPY_HW_UART1_TX (7)
#define MICROPY_HW_UART1_CTS (12)
#define MICROPY_HW_UART1_RTS (11)
#define MICROPY_HW_UART1_HWFC (1)
// SPI0 config
#define MICROPY_HW_SPI0_NAME "SPI0"
#define MICROPY_HW_SPI0_SCK (23) //
#define MICROPY_HW_SPI0_MOSI (24) //
#define MICROPY_HW_SPI0_MISO (25) //
#define MICROPY_HW_PWM0_NAME "PWM0"
#define MICROPY_HW_PWM1_NAME "PWM1"
#define MICROPY_HW_PWM2_NAME "PWM2"
#define HELP_TEXT_BOARD_LED "1,2,3,4"

Wyświetl plik

@ -0,0 +1,8 @@
MCU_SERIES = m4
MCU_VARIANT = nrf52
MCU_SUB_VARIANT = nrf52832
SOFTDEV_VERSION = 6.1.1
LD_FILES += boards/nrf52832_512k_64k.ld
FLASHER = idap
NRF_DEFINES += -DNRF52832_XXAA

Wyświetl plik

@ -0,0 +1,30 @@
P2,P2
P3,P3
P4,P4
P5,P5
P6,P6
P7,P7
P8,P8
P9,P9
P10,P10
P11,P11
P12,P12
P13,P13
P14,P14
P15,P15
P16,P16
P17,P17
P18,P18
P19,P19
P20,P20
P21,P21
P22,P22
P23,P23
P24,P24
P25,P25
P26,P26
P27,P27
P28,P28
P29,P29
P30,P30
P31,P31
1 P2 P2
2 P3 P3
3 P4 P4
4 P5 P5
5 P6 P6
6 P7 P7
7 P8 P8
8 P9 P9
9 P10 P10
10 P11 P11
11 P12 P12
12 P13 P13
13 P14 P14
14 P15 P15
15 P16 P16
16 P17 P17
17 P18 P18
18 P19 P19
19 P20 P20
20 P21 P21
21 P22 P22
22 P23 P23
23 P24 P24
24 P25 P25
25 P26 P26
26 P27 P27
27 P28 P28
28 P29 P29
29 P30 P30
30 P31 P31

Wyświetl plik

@ -33,31 +33,122 @@
#if MICROPY_HW_HAS_LED
#define LED_OFF(pin) {(MICROPY_HW_LED_PULLUP) ? nrf_gpio_pin_set(pin) : nrf_gpio_pin_clear(pin); }
#define LED_ON(pin) {(MICROPY_HW_LED_PULLUP) ? nrf_gpio_pin_clear(pin) : nrf_gpio_pin_set(pin); }
typedef struct _board_led_obj_t {
mp_obj_base_t base;
mp_uint_t led_id;
mp_uint_t hw_pin;
uint8_t hw_pin_port;
bool act_level;
} board_led_obj_t;
STATIC const board_led_obj_t board_led_obj[] = {
static inline void LED_OFF(board_led_obj_t * const led_obj) {
if (led_obj->act_level) {
nrf_gpio_pin_clear(led_obj->hw_pin);
}
else {
nrf_gpio_pin_set(led_obj->hw_pin);
}
}
static inline void LED_ON(board_led_obj_t * const led_obj) {
if (led_obj->act_level) {
nrf_gpio_pin_set(led_obj->hw_pin);
}
else {
nrf_gpio_pin_clear(led_obj->hw_pin);
}
}
static const board_led_obj_t board_led_obj[] = {
#if MICROPY_HW_LED_TRICOLOR
{{&board_led_type}, BOARD_LED_RED, MICROPY_HW_LED_RED},
{{&board_led_type}, BOARD_LED_GREEN, MICROPY_HW_LED_GREEN},
{{&board_led_type}, BOARD_LED_BLUE, MICROPY_HW_LED_BLUE},
{{&board_led_type}, BOARD_LED_RED, MICROPY_HW_LED_RED, 0, MICROPY_HW_LED_PULLUP != 0 ? 0 : 1},
{{&board_led_type}, BOARD_LED_GREEN, MICROPY_HW_LED_GREEN,0, MICROPY_HW_LED_PULLUP != 0 ? 0 : 1},
{{&board_led_type}, BOARD_LED_BLUE, MICROPY_HW_LED_BLUE,0, MICROPY_HW_LED_PULLUP != 0 ? 0 : 1},
#elif (MICROPY_HW_LED_COUNT == 1)
{{&board_led_type}, BOARD_LED1, MICROPY_HW_LED1},
{{&board_led_type}, BOARD_LED1, MICROPY_HW_LED1, 0,
#ifdef MICROPY_HW_LED1_LEVEL
MICROPY_HW_LED1_LEVEL,
#else
MICROPY_HW_LED_PULLUP != 0 ? 0 : 1
#endif
},
#elif (MICROPY_HW_LED_COUNT == 2)
{{&board_led_type}, BOARD_LED1, MICROPY_HW_LED1},
{{&board_led_type}, BOARD_LED2, MICROPY_HW_LED2},
{{&board_led_type}, BOARD_LED1, MICROPY_HW_LED1, 0,
#ifdef MICROPY_HW_LED1_LEVEL
MICROPY_HW_LED1_LEVEL,
#else
MICROPY_HW_LED_PULLUP != 0 ? 0 : 1
#endif
},
{{&board_led_type}, BOARD_LED2, MICROPY_HW_LED2, 0,
#ifdef MICROPY_HW_LED2_LEVEL
MICROPY_HW_LED2_LEVEL,
#else
MICROPY_HW_LED_PULLUP != 0 ? 0 : 1
#endif
},
#elif (MICROPY_HW_LED_COUNT == 3)
{{&board_led_type}, BOARD_LED1, MICROPY_HW_LED1, 0,
#ifdef MICROPY_HW_LED1_LEVEL
MICROPY_HW_LED1_LEVEL,
#else
MICROPY_HW_LED_PULLUP != 0 ? 0 : 1
#endif
},
{{&board_led_type}, BOARD_LED2, MICROPY_HW_LED2, 0,
#ifdef MICROPY_HW_LED2_LEVEL
MICROPY_HW_LED2_LEVEL,
#else
MICROPY_HW_LED_PULLUP != 0 ? 0 : 1
#endif
},
{{&board_led_type}, BOARD_LED3, MICROPY_HW_LED3, 0,
#ifdef MICROPY_HW_LED3_LEVEL
MICROPY_HW_LED3_LEVEL,
#else
MICROPY_HW_LED_PULLUP != 0 ? 0 : 1
#endif
},
#else
{{&board_led_type}, BOARD_LED1, MICROPY_HW_LED1},
{{&board_led_type}, BOARD_LED2, MICROPY_HW_LED2},
{{&board_led_type}, BOARD_LED3, MICROPY_HW_LED3},
{{&board_led_type}, BOARD_LED4, MICROPY_HW_LED4},
{{&board_led_type}, BOARD_LED1, MICROPY_HW_LED1, 0,
#ifdef MICROPY_HW_LED1_LEVEL
MICROPY_HW_LED1_LEVEL,
#else
MICROPY_HW_LED_PULLUP != 0 ? 0 : 1
#endif
},
{{&board_led_type}, BOARD_LED2, MICROPY_HW_LED2, 0,
#ifdef MICROPY_HW_LED2_LEVEL
MICROPY_HW_LED2_LEVEL,
#else
MICROPY_HW_LED_PULLUP != 0 ? 0 : 1
#endif
},
{{&board_led_type}, BOARD_LED3, MICROPY_HW_LED3, 0,
#ifdef MICROPY_HW_LED3_LEVEL
MICROPY_HW_LED3_LEVEL,
#else
MICROPY_HW_LED_PULLUP != 0 ? 0 : 1
#endif
},
{{&board_led_type}, BOARD_LED4, MICROPY_HW_LED4, 0,
#ifdef MICROPY_HW_LED4_LEVEL
MICROPY_HW_LED4_LEVEL,
#else
MICROPY_HW_LED_PULLUP != 0 ? 0 : 1
#endif
},
#endif
};
@ -65,16 +156,17 @@ STATIC const board_led_obj_t board_led_obj[] = {
void led_init(void) {
for (uint8_t i = 0; i < NUM_LEDS; i++) {
LED_OFF(board_led_obj[i].hw_pin);
LED_OFF((board_led_obj_t*)&board_led_obj[i]);
nrf_gpio_cfg_output(board_led_obj[i].hw_pin);
}
}
void led_state(board_led_obj_t * led_obj, int state) {
if (state == 1) {
LED_ON(led_obj->hw_pin);
LED_ON(led_obj);
} else {
LED_OFF(led_obj->hw_pin);
LED_OFF(led_obj);
}
}

Wyświetl plik

@ -38,6 +38,10 @@ typedef enum {
#elif (MICROPY_HW_LED_COUNT == 2)
BOARD_LED1 = 1,
BOARD_LED2 = 2,
#elif (MICROPY_HW_LED_COUNT == 3)
BOARD_LED1 = 1,
BOARD_LED2 = 2,
BOARD_LED3 = 3,
#else
BOARD_LED1 = 1,
BOARD_LED2 = 2,