You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by na...@apache.org on 2018/12/11 11:31:25 UTC

[mynewt-core] 03/04: hw/bsp: Add option to enable active mode on Reel Board

This is an automated email from the ASF dual-hosted git repository.

naraj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 2f8f3515c782508c8af4014e47a4f5ff3a002b9d
Author: MichaƂ Narajowski <mi...@codecoup.pl>
AuthorDate: Wed Nov 7 13:57:02 2018 +0100

    hw/bsp: Add option to enable active mode on Reel Board
    
    Active mode enables power supply to peripherals. When using
    display or sensors, please enable active mode.
---
 hw/bsp/reel_board/src/hal_bsp.c | 8 ++++++++
 hw/bsp/reel_board/syscfg.yml    | 3 +++
 2 files changed, 11 insertions(+)

diff --git a/hw/bsp/reel_board/src/hal_bsp.c b/hw/bsp/reel_board/src/hal_bsp.c
index 8d790d0..da24623 100644
--- a/hw/bsp/reel_board/src/hal_bsp.c
+++ b/hw/bsp/reel_board/src/hal_bsp.c
@@ -24,6 +24,7 @@
 #include "nrfx.h"
 #include "flash_map/flash_map.h"
 #include "hal/hal_bsp.h"
+#include "hal/hal_gpio.h"
 #include "hal/hal_flash.h"
 #include "hal/hal_system.h"
 #include "mcu/nrf52_hal.h"
@@ -80,9 +81,16 @@ hal_bsp_get_nvic_priority(int irq_num, uint32_t pri)
 void
 hal_bsp_init(void)
 {
+    int rc;
+
     /* Make sure system clocks have started */
     hal_system_clock_start();
 
     /* Create all available nRF52840 peripherals */
     nrf52_periph_create();
+
+    if (MYNEWT_VAL(REEL_BOARD_ENABLE_ACTIVE_MODE)) {
+        rc = hal_gpio_init_out(32, 1);
+        assert(rc == 0);
+    }
 }
diff --git a/hw/bsp/reel_board/syscfg.yml b/hw/bsp/reel_board/syscfg.yml
index 587c177..b102d4a 100644
--- a/hw/bsp/reel_board/syscfg.yml
+++ b/hw/bsp/reel_board/syscfg.yml
@@ -20,6 +20,9 @@ syscfg.defs:
     BSP_NRF52840:
         description: 'Set to indicate that BSP has nRF52840'
         value: 1
+    REEL_BOARD_ENABLE_ACTIVE_MODE:
+        description: 'Enable supply voltages for nRF52840 and peripherals'
+        value: 0
 
 syscfg.vals:
     MCU_NRF52840: 1