Nordic nRF5 SDK 學習筆記之五, 使用者定製數量的 LED 和 BUTTON
阿新 • • 發佈:2018-12-01
硬體: nRF52832 DK
軟體: nRF SKD Ver 15.2
1. LED 數量以板載的4個改為8個, 修改 pca10040.h 檔案中相關定義
// LEDs definitions for PCA10040 #define LEDS_NUMBER 8 #define LED_START 17 #define LED_1 17 #define LED_2 18 #define LED_3 19 #define LED_4 20 #define LED_5 21 #define LED_6 22 #define LED_7 23 #define LED_8 24 #define LED_STOP 20 #define LEDS_ACTIVE_STATE 0 #define LEDS_INV_MASK LEDS_MASK //#define LEDS_LIST { LED_1, LED_2, LED_3, LED_4 } #define LEDS_LIST { LED_1, LED_2, LED_3, LED_4,LED_5, LED_6, LED_7, LED_8 } #define BSP_LED_0 LED_1 #define BSP_LED_1 LED_2 #define BSP_LED_2 LED_3 #define BSP_LED_3 LED_4 #define BSP_LED_4 LED_5 #define BSP_LED_5 LED_6 #define BSP_LED_6 LED_7 #define BSP_LED_7 LED_8
2. BUTTON 數量以板載的4個改為8個
#define BUTTONS_NUMBER 8 //#define BUTTON_START 10 #define BUTTON_1 3 #define BUTTON_2 4 #define BUTTON_3 11 #define BUTTON_4 12 #define BUTTON_5 13 #define BUTTON_6 14 #define BUTTON_7 15 #define BUTTON_8 16 //#define BUTTON_STOP 16 #define BUTTON_PULL NRF_GPIO_PIN_PULLUP #define BUTTON_PULL_DOWN NRF_GPIO_PIN_PULLDOWN #define BUTTONS_ACTIVE_STATE 0 //#define BUTTONS_LIST { BUTTON_1, BUTTON_2, BUTTON_3, BUTTON_4 } #define BUTTONS_LIST { BUTTON_1, BUTTON_2, BUTTON_3, BUTTON_4,BUTTON_5, BUTTON_6, BUTTON_7, BUTTON_8 } #define BSP_BUTTON_0 BUTTON_1 #define BSP_BUTTON_1 BUTTON_2 #define BSP_BUTTON_2 BUTTON_3 #define BSP_BUTTON_3 BUTTON_4 #define BSP_BUTTON_4 BUTTON_5 #define BSP_BUTTON_5 BUTTON_6 #define BSP_BUTTON_6 BUTTON_7 #define BSP_BUTTON_7 BUTTON_8
3. 修改 sdk_config.h
// <o> GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS - Number of lower power input pins
#ifndef GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS
#define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 8
#endif