Merge pull request #14025 from fjmolinas/pr_nrf5x_rtt_conf
boards/common/nrf5x: add configurable RTT_FREQUENCY
This commit is contained in:
commit
5773db93f8
@ -29,11 +29,21 @@ extern "C" {
|
|||||||
* @name Real time counter configuration
|
* @name Real time counter configuration
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define RTT_DEV (1) /* NRF_RTC1 */
|
#ifndef RTT_DEV
|
||||||
#define RTT_MAX_VALUE (0x00ffffff)
|
#define RTT_DEV (1) /* NRF_RTC1 */
|
||||||
#define RTT_FREQUENCY (1024)
|
#endif
|
||||||
|
|
||||||
|
#define RTT_MAX_VALUE (0x00ffffff) /* 24bit */
|
||||||
|
#define RTT_MAX_FREQUENCY (32768U) /* in Hz */
|
||||||
|
#define RTT_MIN_FREQUENCY (8U) /* in Hz */
|
||||||
|
#define RTT_CLOCK_FREQUENCY (32768U) /* in Hz, LFCLK*/
|
||||||
|
|
||||||
|
#ifndef RTT_FREQUENCY
|
||||||
|
#define RTT_FREQUENCY (1024U) /* in Hz */
|
||||||
|
#endif
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* end extern "C" */
|
} /* end extern "C" */
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -28,9 +28,18 @@ extern "C" {
|
|||||||
* @name Real time counter configuration
|
* @name Real time counter configuration
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define RTT_DEV (1) /* NRF_RTC1 */
|
#ifndef RTT_DEV
|
||||||
#define RTT_MAX_VALUE (0x00ffffff)
|
#define RTT_DEV (1) /* NRF_RTC1 */
|
||||||
#define RTT_FREQUENCY (1024)
|
#endif
|
||||||
|
|
||||||
|
#define RTT_MAX_VALUE (0x00ffffff) /* 24bit */
|
||||||
|
#define RTT_MAX_FREQUENCY (32768U) /* in Hz */
|
||||||
|
#define RTT_MIN_FREQUENCY (8U) /* in Hz */
|
||||||
|
#define RTT_CLOCK_FREQUENCY (32768U) /* in Hz, LFCLK*/
|
||||||
|
|
||||||
|
#ifndef RTT_FREQUENCY
|
||||||
|
#define RTT_FREQUENCY (1024U) /* in Hz */
|
||||||
|
#endif
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@ -38,8 +38,6 @@
|
|||||||
#error "RTT configuration: invalid or no RTC device specified (RTT_DEV)"
|
#error "RTT configuration: invalid or no RTC device specified (RTT_DEV)"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LFCLK_FREQ (32768U)
|
|
||||||
|
|
||||||
/* allocate memory for callbacks and their args */
|
/* allocate memory for callbacks and their args */
|
||||||
static rtt_cb_t alarm_cb;
|
static rtt_cb_t alarm_cb;
|
||||||
static void *alarm_arg;
|
static void *alarm_arg;
|
||||||
@ -59,7 +57,7 @@ void rtt_init(void)
|
|||||||
/* configure interrupt */
|
/* configure interrupt */
|
||||||
NVIC_EnableIRQ(IRQn);
|
NVIC_EnableIRQ(IRQn);
|
||||||
/* set prescaler */
|
/* set prescaler */
|
||||||
DEV->PRESCALER = (LFCLK_FREQ / RTT_FREQUENCY) - 1;
|
DEV->PRESCALER = (RTT_CLOCK_FREQUENCY / RTT_FREQUENCY) - 1;
|
||||||
/* start the actual RTT thing */
|
/* start the actual RTT thing */
|
||||||
DEV->TASKS_START = 1;
|
DEV->TASKS_START = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user