Squashed commit of the following:

Author: Gregory Nutt <gnutt@nuttx.org>

    A few trivial updates from review of changes.

    Remove references to NRF52-PCA10040 from documentation.  Replace with NRF52-generic.

    Remove configs/nrf52-pca10040/  Replaced with configs/nrf52-generic.

Author: Zou Hanya <hanyazou@gmail.com>

    Improve LED handling #if~#endif in nrf52_autoleds.c and nrf52_userleds.c

    Add Adafruit Feather nRF52 board LED support

    Add Adafruit Feather nRF52 board

    Add nrf52-generic

    Replace 'pca10040' with 'generic'

    Copy from nrf52-pca10040 to nrf52-generic
This commit is contained in:
Zou Hanya 2018-11-18 07:51:24 -06:00 committed by Gregory Nutt
parent d2da0be4ee
commit 74cd8a53d5
25 changed files with 394 additions and 199 deletions

View File

@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4">
<td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
<p>Last Updated: November 14, 2018</p>
<p>Last Updated: November 18, 2018</p>
</td>
</tr>
</table>
@ -1530,7 +1530,7 @@
<li><a href="#armcortexr4">ARM Cortex-R4</a> (2)</li>
<li><a href="#armcortexm0">ARM Cortex-M0/M0+</a> (10)</li>
<li><a href="#armcortexm3">ARM Cortex-M3</a> (37)</li>
<li><a href="#armcortexm4">ARM Cortex-M4</a> (49)</li>
<li><a href="#armcortexm4">ARM Cortex-M4</a> (50)</li>
<li><a href="#armcortexm7">ARM Cortex-M7</a> (13)</li>
</ul>
<li>Atmel AVR
@ -3793,11 +3793,16 @@ nsh>
<a name="nrf52"><b>Nordic Semiconductor/NRF52xxx</b>.</a>
Initial architecture support of the NRF52 including UART, Timer, and GPIOs was contributed by Janne Rosberg in NuttX-7.25.
Janne also contributed board support for the NRF52-PCA10040 development board at that time.
Additional drivers include:
</p>
<p>
The NRF52 was generalized by Hanya Zou in NuttX-7.28 for any similar board based on the NRF52832 MCU. Support was specifically included for the Adafruit NRF52 Feather board.
</p>
<p>
Available drivers include:
</p>
<ul>
<li>
<b>NuttX-7.25</b>. A watchdog timer driver was added by Levin Li.
<b>NuttX-7.25</b>. UART, Timer, and GPIOs from Janne Rosberg and a watchdog timer driver was added by Levin Li.
</li>
<li>
<b>NuttX-7.25</b>. Flash PROGMEM support was added by Alan Carvalho de Assis.
@ -3806,25 +3811,11 @@ nsh>
<ul>
<p>
<b>STATUS:</b>
Refer to the NRF52-PCA10040 board <a href="https://bitbucket.org/nuttx/nuttx/src/master/configs/nrf52-pca10040/README.txt" target="_blank">README</a> file for further information.
Refer to the generic NRF52 board <a href="https://bitbucket.org/nuttx/nuttx/src/master/configs/nrf52-generic/README.txt" target="_blank">README</a> file for further information.
</p>
</ul>
</td>
</tr>
* Nordic NRF52 Drivers:
- NRF52: Added watchdog timer drivers. Includes significant
updates from Levin Li.
- NRF52: Added nRF52 Flash PROGMEM support From Alan Carvalho de
Assis.
* Nordic NRF52 Boards:
- NRF52: Added support for the NRF52 including initially UART, Timer
and GPIO support. From Janne Rosberg.
<tr>
<td><br></td>
<td><hr></td>
@ -4071,9 +4062,6 @@ nsh>
</ul>
</td>
</tr>
<li><a href="#">STMicro STM32F334</a> <small>(STM32 F3 family, ARM Cortex-M4)</small></li>
<tr>
<td><br></td>
<td><hr></td>
@ -4082,8 +4070,8 @@ nsh>
<td><br></td>
<td>
<p>
<a name="stm32f334x"><b>STMicro STM32 STM32F334 (STM32 F3 family, ARM Cortex-M4)</b>.</a>
<p>
<a name="stm32f334x"><b>STMicro STM32 F334 (STM32 F3 family, ARM Cortex-M4)</b>.</a>
</p>
<p>
Support for the STMicro <b>STM32F334-Disco</b> board was contributed by Mateusz Szafoni in NuttX-7.22 and for the <b>Nucleo-STM32F334R8</b> was contributed in an earlier release.
</p>
@ -5240,9 +5228,6 @@ Mem: 29232 5920 23312 23312
</p>
</td>
</tr>
<li><a href="#">Atmel SAMD5x/E5x</a> <small>(ARM Cortex-M4)</small></li>
<tr>
<td><br></td>
<td><hr></td>

View File

@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4">
<td>
<h1><big><font color="#3c34ec"><i>NuttX README Files</i></font></big></h1>
<p>Last Updated: November 17, 2018</p>
<p>Last Updated: November 18, 2018</p>
</td>
</tr>
</table>
@ -173,8 +173,8 @@ nuttx/
| | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/configs/moteino-mega/README.txt" target="_blank"><b><i>README.txt</i></b></a>
| |- ne64badge/
| | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/configs/ne64badge/README.txt" target="_blank"><b><i>README.txt</i></b></a>
| |- nrf52-pca10040/
| | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/configs/nrf52-pca10040/README.txt" target="_blank"><b><i>README.txt</i></b></a>
| |- nrf52-generic/
| | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/configs/nrf52-generic/README.txt" target="_blank"><b><i>README.txt</i></b></a>
| |- ntosd-dm320/
| | |- <a href="https://bitbucket.org/nuttx/nuttx/src/master/configs/ntosd-dm320/doc/README.txt" target="_blank">doc/README.txt</a>
| | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/configs/ntosd-dm320/README.txt" target="_blank"><b><i>README.txt</i></b></a>

View File

@ -1847,7 +1847,7 @@ nuttx/
| | `- README.txt
| |- ne63badge/
| | `- README.txt
| |- nrf52-pca10040/
| |- nrf52-generic/
| | `- README.txt
| |- ntosd-dm320/
| | |- doc/README.txt

View File

@ -174,6 +174,7 @@
# define GPIO_PIN29 (29 << GPIO_PIN_SHIFT)
# define GPIO_PIN30 (30 << GPIO_PIN_SHIFT)
# define GPIO_PIN31 (31 << GPIO_PIN_SHIFT)
# define GPIO_PIN(n) ((n) << GPIO_PIN_SHIFT)
/************************************************************************************
* Public Types

View File

@ -553,6 +553,17 @@ config ARCH_BOARD_NRF52_PCA10040
---help---
PCA10040 Evaluation board
config ARCH_BOARD_NRF52_GENERIC
bool "Generic NRF52832 board"
depends on ARCH_CHIP_NRF52
select ARCH_HAVE_LEDS
select ARCH_HAVE_BUTTONS
---help---
NuttX port to the a generic NRF52832 board. Support is in place for
the NRF PCA10040 board from Nordic Semiconductor or for the Adafruit
NRF52 feather and can be simply extended to other board based on the
NRF52832 MCU.
config ARCH_BOARD_LPC1766STK
bool "Olimex LPC1766-STK board"
depends on ARCH_CHIP_LPC1766
@ -1755,7 +1766,7 @@ config ARCH_BOARD
default "misoc" if ARCH_BOARD_MISOC
default "moteino-mega" if ARCH_BOARD_MOTEINO_MEGA
default "ne64badge" if ARCH_BOARD_NE64BADGE
default "nrf52-pca10040" if ARCH_BOARD_NRF52_PCA10040
default "nrf52-generic" if ARCH_BOARD_NRF52_GENERIC
default "ntosd-dm320" if ARCH_BOARD_NTOSD_DM320
default "nucleo-144" if ARCH_BOARD_NUCLEO_144
default "nucleo-f072rb" if ARCH_BOARD_NUCLEO_F072RB
@ -2068,8 +2079,8 @@ endif
if ARCH_BOARD_NE64BADGE
source "configs/ne64badge/Kconfig"
endif
if ARCH_BOARD_NRF52_PCA10040
source "configs/nrf52-pca10040/Kconfig"
if ARCH_BOARD_NRF52_GENERIC
source "configs/nrf52-generic/Kconfig"
endif
if ARCH_BOARD_NTOSD_DM320
source "configs/ntosd-dm320/Kconfig"

View File

@ -410,9 +410,10 @@ configs/ne64badge
STATUS: Under development. The port is code-complete but has
not yet been fully tested.
configs/nrf52-pca10040
NuttX port to the NRF PCA10040 board from Nordic Semiconductor
featuring the NRF52832 MCU.
configs/nrf52-generic
NuttX port to the a generic NRF52. Support is in place for the NRF
PCA10040 board from Nordic Semiconductor or for the Adafruit NRF52
feather, both featuring the NRF52832 MCU.
configs/ntosd-dm320
This port uses the Neuros OSD v1.0 Dev Board with a GNU arm-nuttx-elf

View File

@ -0,0 +1,56 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
if ARCH_BOARD_NRF52_GENERIC
config NRF52_GENERIC_UART0_RX_PIN
int "Pin select for UART0 TXD"
default 23
---help---
Pin select for UART0 TXD
config NRF52_GENERIC_UART0_TX_PIN
int "Pin select for UART0 TXD"
default 24
---help---
Pin select for UART0 TXD
config NRF52_GENERIC_NUM_LEDS
int "Number of LEDs"
default 4
---help---
Number of LEDs
config NRF52_GENERIC_LED_ACTIVELOW
bool "Board LEDs are 'active low'"
default y
---help---
Board LEDs are 'active low'
config NRF52_GENERIC_LED1_PIN
int "Pin select for LED 1"
default 17
---help---
Pin select for LED 1
config NRF52_GENERIC_LED2_PIN
int "Pin select for LED 2"
default 18
---help---
Pin select for LED 2
config NRF52_GENERIC_LED3_PIN
int "Pin select for LED 3"
default 19
---help---
Pin select for LED 3
config NRF52_GENERIC_LED4_PIN
int "Pin select for LED 4"
default 20
---help---
Pin select for LED 4
endif

View File

@ -1,35 +1,14 @@
README
======
README for NuttX port to the NRF PCA10040 board from Nordic Semiconductor
featuring the NRF52832 MCU.
README for NuttX port to generic NRF52832 boards.
Contents
========
- PCA10040 development board
- Status
- LED and Pushbuttons
- Serial Console
- PCA10040 development board
- Configurations
- STATUS
PCA10040 board
==============
Memory Map
----------
Block Start Length
Name Address
--------------------- ---------- ------
FLASH 0x00000000 512K
RAM 0x20000000 64K
Console
-------
The PCA10040 default console is the UART0.
Status
======
@ -40,10 +19,24 @@ Status
are present and fully verified. This includes: SYSTICK system time,
pin and GPIO configuration, and serial console support.
LED and Pushbuttons
===================
PCA10040 board
==============
LEDS
Console
-------
The PCA10040 default console is the UART0.
The PCA10040 does not have RS-232 drivers or serial connectors on board.
UART0, is available on P4 as follows:
-------- -----
Signal PIN
-------- -----
UART0-TX P0.24
UART0-RX P0.23
LEDs
----
The PCA10040 has 4 user-controllable LEDs
@ -55,47 +48,58 @@ LED and Pushbuttons
A low output illuminates the LED.
If CONFIG_ARCH_LEDS is defined, the LED will be controlled as follows
for NuttX debug functionality (where NC means "No Change").
TBD!
If CONFIG_ARCH_LEDS is not defined, then the LEDs are completely under
control of the application. The following interfaces are then available
for application control of the LEDs:
void board_userled_initialize(void);
void board_userled(int led, bool ledon);
void board_userled_all(uint8_t ledset);
Pushbuttons
-----------
To be provided
Serial Console
==============
Feather nRF52 board
===================
The PCA10040 does not have RS-232 drivers or serial connectors on board.
UART0, is available on P4 as follows:
https://www.adafruit.com/product/3406
-------- -----
Signal PIN
-------- -----
UART0-TX P0.24
UART0-RX P0.23
Console
-------
The Feather nRF52 default console is the UART0.
The Feather nRF52 have USB serial bridge chip on board and UART0 is
connected to micro USB connector through the bridge chip.
LEDs
----
The Feather has 2 user-controllable LEDs
LED MCU
LED1 PIN-17
LED2 PIN-19
A high output illuminates the LED.
Pushbuttons
-----------
The Feather nRF52 does not have user-controllable buttons. The reset button
on the board is connected to nRF52832 reset pin directly.
Memory Map
==========
Block Start Length
Name Address
--------------------- ---------- ------
FLASH 0x00000000 512K
RAM 0x20000000 64K
Configurations
==============
Each PCA10040 configuration is maintained in a sub-directory and can be selected
as follow:
Each configuration is maintained in a sub-directory and can be selected as
follow:
tools/configure.sh nrf52-pca10040/<subdir>
tools/configure.sh nrf52-generic/<subdir>
Where <subdir> is one of the following:
nsh:
----
<board>-nsh:
-----------
This configuration is the NuttShell (NSH) example at examples/nsh/.
NOTES:
@ -109,8 +113,23 @@ Where <subdir> is one of the following:
b. Execute 'make menuconfig' in nuttx/ in order to start the
reconfiguration process.
wdog:
----
<board>-wdog:
------------
This configuration is a simple NSH-based test of the nRF52 watchdog
timer driver using the test at apps/examples/watchdog.
CONFIG_ARCH_LEDS
----------------
If CONFIG_ARCH_LEDS is defined, the LED will be controlled as follows
for NuttX debug functionality (where NC means "No Change").
TBD!
If CONFIG_ARCH_LEDS is not defined, then the LEDs are completely under
control of the application. The following interfaces are then available
for application control of the LEDs:
void board_userled_initialize(void);
void board_userled(int led, bool ledon);
void board_userled_all(uint8_t ledset);

View File

@ -0,0 +1,47 @@
# CONFIG_ARCH_FPU is not set
# CONFIG_NSH_DISABLE_IFCONFIG is not set
# CONFIG_NSH_DISABLE_PS is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="nrf52-generic"
CONFIG_ARCH_BOARD_NRF52_GENERIC=y
CONFIG_ARCH_CHIP_NRF52832=y
CONFIG_ARCH_CHIP_NRF52=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_STDARG_H=y
CONFIG_BOARD_LOOPSPERMSEC=5500
CONFIG_FAT_LCNAMES=y
CONFIG_FAT_LFN=y
CONFIG_FS_FAT=y
CONFIG_MAX_TASKS=16
CONFIG_MAX_WDOGPARMS=2
CONFIG_MM_REGIONS=2
CONFIG_NFILE_DESCRIPTORS=8
CONFIG_NFILE_STREAMS=8
CONFIG_NRF52_UART0=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_LINELEN=64
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_MQ_MSGS=4
CONFIG_PREALLOC_TIMERS=4
CONFIG_PREALLOC_WDOGS=4
CONFIG_RAM_SIZE=65535
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
CONFIG_START_DAY=26
CONFIG_START_MONTH=3
CONFIG_SYMTAB_ORDEREDBYNAME=y
CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_NRF52_GENERIC_UART0_RX_PIN=8
CONFIG_NRF52_GENERIC_UART0_TX_PIN=6
CONFIG_NRF52_GENERIC_NUM_LEDS=2
# CONFIG_NRF52_GENERIC_LED_ACTIVELOW is not set
CONFIG_NRF52_GENERIC_LED1_PIN=17
CONFIG_NRF52_GENERIC_LED2_PIN=19
CONFIG_USER_ENTRYPOINT="nsh_main"
CONFIG_WDOG_INTRESERVE=0

View File

@ -0,0 +1,52 @@
# CONFIG_ARCH_FPU is not set
# CONFIG_ARCH_LEDS is not set
# CONFIG_NRF52_GENERIC_LED_ACTIVELOW is not set
# CONFIG_NSH_DISABLE_IFCONFIG is not set
# CONFIG_NSH_DISABLE_PS is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="nrf52-generic"
CONFIG_ARCH_BOARD_NRF52_GENERIC=y
CONFIG_ARCH_CHIP_NRF52832=y
CONFIG_ARCH_CHIP_NRF52=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_STDARG_H=y
CONFIG_BOARD_LOOPSPERMSEC=5500
CONFIG_BUILTIN=y
CONFIG_EXAMPLES_LEDS=y
CONFIG_FAT_LCNAMES=y
CONFIG_FAT_LFN=y
CONFIG_FS_FAT=y
CONFIG_MAX_TASKS=16
CONFIG_MAX_WDOGPARMS=2
CONFIG_MM_REGIONS=2
CONFIG_NFILE_DESCRIPTORS=8
CONFIG_NFILE_STREAMS=8
CONFIG_NRF52_GENERIC_LED2_PIN=19
CONFIG_NRF52_GENERIC_NUM_LEDS=2
CONFIG_NRF52_GENERIC_UART0_RX_PIN=8
CONFIG_NRF52_GENERIC_UART0_TX_PIN=6
CONFIG_NRF52_UART0=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_LINELEN=64
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_MQ_MSGS=4
CONFIG_PREALLOC_TIMERS=4
CONFIG_PREALLOC_WDOGS=4
CONFIG_RAM_SIZE=65535
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
CONFIG_START_DAY=26
CONFIG_START_MONTH=3
CONFIG_SYMTAB_ORDEREDBYNAME=y
CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_USERLED=y
CONFIG_USERLED_LOWER=y
CONFIG_USER_ENTRYPOINT="nsh_main"
CONFIG_WDOG_INTRESERVE=0

View File

@ -1,5 +1,5 @@
/****************************************************************************
* configs/nrf52-pca10040/include/board.h
* configs/nrf52_generic/include/board.h
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Author: Janne Rosberg <janne@offcode.fi>
@ -33,8 +33,8 @@
*
****************************************************************************/
#ifndef _CONFIGS_NRF52_PCA10040_INCLUDE_BOARD_H
#define _CONFIGS_NRF52_PCA10040_INCLUDE_BOARD_H
#ifndef _CONFIGS_NRF52_GENERIC_INCLUDE_BOARD_H
#define _CONFIGS_NRF52_GENERIC_INCLUDE_BOARD_H
/****************************************************************************
* Included Files
@ -66,7 +66,7 @@
#define BOARD_LED2 1
#define BOARD_LED3 2
#define BOARD_LED4 3
#define BOARD_NLEDS 4
#define BOARD_NLEDS CONFIG_NRF52_GENERIC_NUM_LEDS
/* LED bits for use with board_userled_all() */
@ -118,7 +118,7 @@
* driver can set up the UART for the serial console properly.
*/
#define BOARD_UART0_RX_PIN (GPIO_INPUT | GPIO_PIN23)
#define BOARD_UART0_TX_PIN (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PIN24)
#define BOARD_UART0_RX_PIN (GPIO_INPUT | GPIO_PIN(CONFIG_NRF52_GENERIC_UART0_RX_PIN))
#define BOARD_UART0_TX_PIN (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PIN(CONFIG_NRF52_GENERIC_UART0_TX_PIN))
#endif /* _CONFIGS_NRF52_PCA10040_INCLUDE_BOARD_H */
#endif /* _CONFIGS_NRF52_GENERIC_INCLUDE_BOARD_H */

View File

@ -2,8 +2,8 @@
# CONFIG_NSH_DISABLE_IFCONFIG is not set
# CONFIG_NSH_DISABLE_PS is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="nrf52-pca10040"
CONFIG_ARCH_BOARD_NRF52_PCA10040=y
CONFIG_ARCH_BOARD="nrf52-generic"
CONFIG_ARCH_BOARD_NRF52_GENERIC=y
CONFIG_ARCH_CHIP_NRF52832=y
CONFIG_ARCH_CHIP_NRF52=y
CONFIG_ARCH_STACKDUMP=y

View File

@ -2,8 +2,8 @@
# CONFIG_NSH_DISABLE_IFCONFIG is not set
# CONFIG_NSH_DISABLE_PS is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="nrf52-pca10040"
CONFIG_ARCH_BOARD_NRF52_PCA10040=y
CONFIG_ARCH_BOARD="nrf52-generic"
CONFIG_ARCH_BOARD_NRF52_GENERIC=y
CONFIG_ARCH_CHIP_NRF52832=y
CONFIG_ARCH_CHIP_NRF52=y
CONFIG_ARCH_STACKDUMP=y

View File

@ -1,5 +1,5 @@
############################################################################
# configs/nrf52-pca10040/scripts/Make.defs
# configs/nrf52-generic/scripts/Make.defs
#
# Copyright (C) 2014, 2017, 2018 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>

View File

@ -1,5 +1,5 @@
/****************************************************************************
* configs/nrf52-pca10040/scripts/flash_config.ld
* configs/nrf52-generic/scripts/flash_config.ld
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Author: Janne Rosberg <janne@offcode.fi>

View File

@ -1,5 +1,5 @@
############################################################################
# configs/nrf52-pca10040/src/Makefile
# configs/nrf52-generic/src/Makefile
#
# Copyright (C) 2018 Gregory Nutt. All rights reserved.
# Author: Janne Rosberg <janne@offcode.fi>

View File

@ -1,5 +1,5 @@
/****************************************************************************
* configs/nrf52-pca10040/src/lpc4357-evb.h
* configs/nrf52-generic/src/nrf52-generic.h
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -33,8 +33,8 @@
*
****************************************************************************/
#ifndef _CONFIGS_NRF52PCA10040_SRC_NRF52PCA10040_H
#define _CONFIGS_NRF52PCA10040_SRC_NRF52PCA10040_H
#ifndef _CONFIGS_NRF52GENERIC_SRC_NRF52GENERIC_H
#define _CONFIGS_NRF52GENERIC_SRC_NRF52GENERIC_H
/****************************************************************************
* Included Files
@ -50,27 +50,12 @@
****************************************************************************/
/* LED definitions **********************************************************/
/* The PCA10040 has 4 user-controllable LEDs
*
* ---- ------- -------------
* LED SIGNAL MCU
* ---- ------- -------------
* LED1 GPIO 17
* LED2 GPIO 18
* LED3 GPIO 19
* LED4 GPIO 20
* ---- ------- -------------
*
* A low output illuminates the LED.
*
*/
/* Definitions to configure LED GPIO as outputs */
#define GPIO_LED1 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PIN17)
#define GPIO_LED2 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PIN18)
#define GPIO_LED3 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PIN19)
#define GPIO_LED4 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PIN20)
#define GPIO_LED1 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PIN(CONFIG_NRF52_GENERIC_LED1_PIN))
#define GPIO_LED2 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PIN(CONFIG_NRF52_GENERIC_LED2_PIN))
#define GPIO_LED3 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PIN(CONFIG_NRF52_GENERIC_LED3_PIN))
#define GPIO_LED4 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PIN(CONFIG_NRF52_GENERIC_LED4_PIN))
/* Button definitions *******************************************************/
/* Board supports four buttons. */
@ -111,4 +96,4 @@
int nrf52_bringup(void);
#endif /* __ASSEMBLY__ */
#endif /* _CONFIGS_NRF52PCA10040_SRC_NRF52PCA10040_H */
#endif /* _CONFIGS_NRF52GENERIC_SRC_NRF52GENERIC_H */

View File

@ -1,5 +1,5 @@
/****************************************************************************
* config/nrf52-pca10040/src/nrf52_appinit.c
* config/nrf52-generic/src/nrf52_appinit.c
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Author: Janne Rosberg <janne@offcode.fi>
@ -46,7 +46,7 @@
#include <nuttx/board.h>
#include "chip.h"
#include "nrf52-pca10040.h"
#include "nrf52-generic.h"
/****************************************************************************
* Public Functions

View File

@ -1,5 +1,5 @@
/****************************************************************************
* configs/nrf52-pca10040/src/lpc43_autoleds.c
* configs/nrf52-generic/src/lpc43_autoleds.c
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -61,10 +61,36 @@
#include "up_arch.h"
#include "up_internal.h"
#include "nrf52-pca10040.h"
#include "nrf52-generic.h"
#ifdef CONFIG_ARCH_LEDS
#ifdef CONFIG_NRF52_GENERIC_LED_ACTIVELOW
#define LED_ON 0
#define LED_OFF 1
#else
#define LED_ON 1
#define LED_OFF 0
#endif
/* This array maps an LED number to GPIO pin configuration */
static const uint32_t g_ledcfg[BOARD_NLEDS] =
{
#if 0 < BOARD_NLEDS
GPIO_LED1,
#endif
#if 1 < BOARD_NLEDS
GPIO_LED2,
#endif
#if 2 < BOARD_NLEDS
GPIO_LED3,
#endif
#if 3 < BOARD_NLEDS
GPIO_LED4,
#endif
};
/****************************************************************************
* Private Functions
****************************************************************************/
@ -93,14 +119,16 @@ static void led_dumppins(FAR const char *msg)
void board_autoled_initialize(void)
{
int i;
/* Configure LED pin as a GPIO outputs */
led_dumppins("board_autoled_initialize() Entry)");
nrf52_gpio_config(GPIO_LED1);
nrf52_gpio_config(GPIO_LED2);
nrf52_gpio_config(GPIO_LED3);
nrf52_gpio_config(GPIO_LED4);
for (i = 0; i < BOARD_NLEDS; i++)
{
nrf52_gpio_config(g_ledcfg[i]);
}
led_dumppins("board_autoled_initialize() Exit");
}
@ -111,24 +139,9 @@ void board_autoled_initialize(void)
void board_autoled_on(int led)
{
switch (led)
if ((unsigned)led < BOARD_NLEDS)
{
default:
case 0:
nrf52_gpio_write(GPIO_LED1, 0);
break;
case 1:
nrf52_gpio_write(GPIO_LED2, 0);
break;
case 2:
nrf52_gpio_write(GPIO_LED3, 0);
break;
case 3:
nrf52_gpio_write(GPIO_LED4, 0);
break;
nrf52_gpio_write(g_ledcfg[led], LED_ON);
}
}
@ -138,24 +151,9 @@ void board_autoled_on(int led)
void board_autoled_off(int led)
{
switch (led)
if ((unsigned)led < BOARD_NLEDS)
{
default:
case 0:
nrf52_gpio_write(GPIO_LED1, 1);
break;
case 1:
nrf52_gpio_write(GPIO_LED2, 1);
break;
case 2:
nrf52_gpio_write(GPIO_LED3, 1);
break;
case 3:
nrf52_gpio_write(GPIO_LED4, 1);
break;
nrf52_gpio_write(g_ledcfg[led], LED_OFF);
}
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* configs/nrf52-pca10040/src/lpc43_boot.c
* configs/nrf52-generic/src/lpc43_boot.c
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -47,7 +47,7 @@
#include "up_arch.h"
#include "up_internal.h"
#include "nrf52-pca10040.h"
#include "nrf52-generic.h"
/****************************************************************************
* Public Functions

View File

@ -1,5 +1,5 @@
/****************************************************************************
* config/nrf52-pca10040/src/nrf53_bringup.c
* config/nrf52-generic/src/nrf53_bringup.c
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -42,7 +42,13 @@
#include <sys/types.h>
#include <syslog.h>
#include "nrf52_wdt.h"
#ifdef CONFIG_NRF52_WDT
# include "nrf52_wdt.h"
#endif
#ifdef CONFIG_USERLED
# include <nuttx/leds/userled.h>
#endif
/****************************************************************************
* Public Functions
@ -76,6 +82,16 @@ int nrf52_bringup(void)
}
#endif
#ifdef CONFIG_USERLED
/* Register the LED driver */
ret = userled_lower_initialize(CONFIG_EXAMPLES_LEDS_DEVPATH);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret);
}
#endif
UNUSED(ret);
return OK;
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* configs/nrf52-pca10400/src/nrf52_buttons.c
* configs/nrf52-generic/src/nrf52_buttons.c
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Author: Janne Rosberg <janne@offcode.fi>
@ -48,7 +48,7 @@
#include "nrf52_gpio.h"
#include "nrf52-pca10040.h"
#include "nrf52-generic.h"
#ifdef CONFIG_ARCH_BUTTONS
@ -56,7 +56,7 @@
* Private Data
****************************************************************************/
/* Pin configuration for each PCA10400 button. This array is indexed by
/* Pin configuration for each PCA10040 button. This array is indexed by
* the BUTTON_* definitions in board.h
*/

View File

@ -1,5 +1,5 @@
/****************************************************************************
* configs/nrf52-pca10040/src/nrf52_userleds.c
* configs/nrf52-generic/src/nrf52_userleds.c
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Author: Janne Rosberg <janne@offcode.fi>
@ -49,7 +49,7 @@
#include "up_arch.h"
#include "up_internal.h"
#include "nrf52-pca10040.h"
#include "nrf52-generic.h"
#ifndef CONFIG_ARCH_LEDS
@ -67,6 +67,32 @@
* void board_userled_all(uint8_t ledset);
*/
#ifdef CONFIG_NRF52_GENERIC_LED_ACTIVELOW
#define LED_ON 0
#define LED_OFF 1
#else
#define LED_ON 1
#define LED_OFF 0
#endif
/* This array maps an LED number to GPIO pin configuration */
static const uint32_t g_ledcfg[BOARD_NLEDS] =
{
#if 0 < BOARD_NLEDS
GPIO_LED1,
#endif
#if 1 < BOARD_NLEDS
GPIO_LED2,
#endif
#if 2 < BOARD_NLEDS
GPIO_LED3,
#endif
#if 3 < BOARD_NLEDS
GPIO_LED4,
#endif
};
/****************************************************************************
* Private Functions
****************************************************************************/
@ -95,16 +121,18 @@ static void led_dumppins(FAR const char *msg)
void board_userled_initialize(void)
{
int i;
/* Configure LED pin as a GPIO outputs */
led_dumppins("board_userled_initialize() Entry)");
/* Configure GPIO as an outputs */
nrf52_gpio_config(GPIO_LED1);
nrf52_gpio_config(GPIO_LED2);
nrf52_gpio_config(GPIO_LED3);
nrf52_gpio_config(GPIO_LED4);
for (i = 0; i < BOARD_NLEDS; i++)
{
nrf52_gpio_config(g_ledcfg[i]);
}
led_dumppins("board_userled_initialize() Exit");
}
@ -115,9 +143,9 @@ void board_userled_initialize(void)
void board_userled(int led, bool ledon)
{
if (led == BOARD_LED1)
if ((unsigned)led < BOARD_NLEDS)
{
nrf52_gpio_write(GPIO_LED1, !ledon);
nrf52_gpio_write(g_ledcfg[led], ledon ? LED_ON : LED_OFF);
}
}
@ -127,10 +155,14 @@ void board_userled(int led, bool ledon)
void board_userled_all(uint8_t ledset)
{
nrf52_gpio_write(GPIO_LED1, (ledset & BOARD_LED1_BIT) == 0);
nrf52_gpio_write(GPIO_LED2, (ledset & BOARD_LED2_BIT) == 0);
nrf52_gpio_write(GPIO_LED3, (ledset & BOARD_LED3_BIT) == 0);
nrf52_gpio_write(GPIO_LED4, (ledset & BOARD_LED4_BIT) == 0);
int i;
/* Configure LED1-8 GPIOs for output */
for (i = 0; i < BOARD_NLEDS; i++)
{
nrf52_gpio_write(g_ledcfg[i], (ledset & (1 << i)) ? LED_ON : LED_OFF);
}
}
#endif /* !CONFIG_ARCH_LEDS */

View File

@ -1,8 +0,0 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
if ARCH_BOARD_NRF52_PCA10040
endif