boards/arm/nrf52/nrf52840-dk: add timer example
This commit is contained in:
parent
4152193e0a
commit
8fe3a46dc0
55
boards/arm/nrf52/nrf52840-dk/configs/timer/defconfig
Normal file
55
boards/arm/nrf52/nrf52840-dk/configs/timer/defconfig
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#
|
||||||
|
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||||
|
#
|
||||||
|
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||||
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
|
# modifications.
|
||||||
|
#
|
||||||
|
# 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="nrf52840-dk"
|
||||||
|
CONFIG_ARCH_BOARD_NRF52840_DK=y
|
||||||
|
CONFIG_ARCH_CHIP="nrf52"
|
||||||
|
CONFIG_ARCH_CHIP_NRF52840=y
|
||||||
|
CONFIG_ARCH_CHIP_NRF52=y
|
||||||
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
|
CONFIG_ARCH_STDARG_H=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=5500
|
||||||
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_EXAMPLES_TIMER=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_RTC0=y
|
||||||
|
CONFIG_NRF52_TIMER0=y
|
||||||
|
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_TIMER=y
|
||||||
|
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||||
|
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||||
|
CONFIG_WDOG_INTRESERVE=0
|
@ -75,4 +75,8 @@ ifeq ($(CONFIG_NRF52840DK_HIGHPRI),y)
|
|||||||
CSRCS += nrf52_highpri.c
|
CSRCS += nrf52_highpri.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_TIMER),y)
|
||||||
|
CSRCS += nrf52_timer.c
|
||||||
|
endif
|
||||||
|
|
||||||
include $(TOPDIR)/boards/Board.mk
|
include $(TOPDIR)/boards/Board.mk
|
||||||
|
@ -161,11 +161,24 @@ int nrf52_hts221_initialize(char *devpath);
|
|||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Initialize SX127X LPWAN interaface.
|
* Initialize SX127X LPWAN interaface.
|
||||||
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_LPWAN_SX127X
|
#ifdef CONFIG_LPWAN_SX127X
|
||||||
int nrf52_lpwaninitialize(void);
|
int nrf52_lpwaninitialize(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: nrf52_timer_driver_setup
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Initialize TIMER driver.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_TIMER
|
||||||
|
int nrf52_timer_driver_setup(FAR const char *devpath, int timer);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __ASSEMBLY__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
#endif /* __BOARDS_ARM_NRF52_NRF52840_DK_SRC_NRF52840_DK_H */
|
#endif /* __BOARDS_ARM_NRF52_NRF52840_DK_SRC_NRF52840_DK_H */
|
||||||
|
@ -48,6 +48,12 @@
|
|||||||
|
|
||||||
#include "nrf52840-dk.h"
|
#include "nrf52840-dk.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#define NRF52_TIMER (0)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -174,6 +180,18 @@ int nrf52_bringup(void)
|
|||||||
}
|
}
|
||||||
#endif /* CONFIG_LPWAN_SX127X */
|
#endif /* CONFIG_LPWAN_SX127X */
|
||||||
|
|
||||||
|
#ifdef CONFIG_TIMER
|
||||||
|
/* Configure TIMER driver */
|
||||||
|
|
||||||
|
ret = nrf52_timer_driver_setup("/dev/timer0", NRF52_TIMER);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR,
|
||||||
|
"ERROR: Failed to initialize timer driver: %d\n",
|
||||||
|
ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
UNUSED(ret);
|
UNUSED(ret);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
58
boards/arm/nrf52/nrf52840-dk/src/nrf52_timer.c
Normal file
58
boards/arm/nrf52/nrf52840-dk/src/nrf52_timer.c
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/arm/nrf52/nrf52840-dk/src/nrf52_timer.c
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
#include <nuttx/timers/timer.h>
|
||||||
|
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include "nrf52_tim_lowerhalf.h"
|
||||||
|
|
||||||
|
#include "nrf52840-dk.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: nrf52_timer_driver_setup
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Configure the timer driver.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* devpath - The full path to the timer device. This should be of the
|
||||||
|
* form /dev/timer0
|
||||||
|
* timer - The timer's number.
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Zero (OK) is returned on success; A negated errno value is returned
|
||||||
|
* to indicate the nature of any failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int nrf52_timer_driver_setup(FAR const char *devpath, int timer)
|
||||||
|
{
|
||||||
|
return nrf52_timer_initialize(devpath, timer);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user