moved GPT to LLD
This commit is contained in:
parent
5d1b4d1d77
commit
321ec844af
|
@ -62,7 +62,7 @@
|
|||
* @brief Enables the GPT subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_GPT FALSE
|
||||
#define HAL_USE_GPT TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,6 +26,22 @@ WDGConfig WDG_config = {
|
|||
};
|
||||
|
||||
|
||||
void gpt_callback(GPTDriver *gptp) {
|
||||
palTogglePad(IOPORT1, LED2);
|
||||
}
|
||||
|
||||
/*
|
||||
* GPT configuration
|
||||
* Frequency: 31250Hz (32us period)
|
||||
* Resolution: 16 bits
|
||||
*/
|
||||
static const GPTConfig gpt_config = {
|
||||
.frequency = 31250,
|
||||
.callback = gpt_callback,
|
||||
.resolution = 16,
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Command Random
|
||||
*/
|
||||
|
@ -140,9 +156,7 @@ static THD_FUNCTION(Thread1, arg) {
|
|||
|
||||
|
||||
while (1) {
|
||||
palSetPad(IOPORT1, led);
|
||||
chThdSleepMilliseconds(100);
|
||||
palClearPad(IOPORT1, led);
|
||||
palTogglePad(IOPORT1, led);
|
||||
chThdSleepMilliseconds(100);
|
||||
}
|
||||
}
|
||||
|
@ -166,12 +180,14 @@ int main(void)
|
|||
sdStart(&SD1, &serial_config);
|
||||
|
||||
palSetPad(IOPORT1, LED1);
|
||||
palSetPad(IOPORT1, LED2);
|
||||
palSetPad(IOPORT1, LED3);
|
||||
palClearPad(IOPORT1, LED2);
|
||||
palClearPad(IOPORT1, LED3);
|
||||
palSetPad(IOPORT1, LED4);
|
||||
|
||||
gptStart(&GPTD1, &gpt_config);
|
||||
gptStartContinuous(&GPTD1, 31250);
|
||||
|
||||
|
||||
|
||||
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO+1,
|
||||
Thread1, NULL);
|
||||
|
||||
|
@ -181,6 +197,7 @@ int main(void)
|
|||
shellThread, (void *)&shell_cfg1);
|
||||
|
||||
|
||||
|
||||
|
||||
printf(PORT_INFO "\r\n");
|
||||
chThdSleep(2);
|
||||
|
@ -189,7 +206,9 @@ int main(void)
|
|||
|
||||
printf("Priority levels %d\r\n", CORTEX_PRIORITY_LEVELS);
|
||||
|
||||
test_execute((BaseSequentialStream *)&SD1);
|
||||
//test_execute((BaseSequentialStream *)&SD1);
|
||||
|
||||
NRF_P0->DETECTMODE = 0;
|
||||
|
||||
while (true) {
|
||||
if (watchdog_started &&
|
||||
|
|
|
@ -22,9 +22,6 @@
|
|||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define NRF5_SOFTDEVICE_THREAD_WA_SIZE 128
|
||||
|
||||
#define SHELL_CMD_TEST_ENABLED FALSE
|
||||
|
@ -44,6 +41,7 @@
|
|||
#define NRF5_SERIAL_USE_UART0 TRUE
|
||||
#define NRF5_SERIAL_USE_HWFLOWCTRL TRUE
|
||||
#define NRF5_RNG_USE_RNG0 TRUE
|
||||
#define NRF5_GPT_USE_TIMER0 TRUE
|
||||
|
||||
|
||||
#define WDG_USE_TIMEOUT_CALLBACK TRUE
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @file NRF51x22/gpt_lld.c
|
||||
* @brief NRF51x22 GPT subsystem low level driver source.
|
||||
* @file NRF5/LLD/hal_gpt_lld.c
|
||||
* @brief NRF5 GPT subsystem low level driver source.
|
||||
*
|
||||
* @addtogroup GPT
|
||||
* @{
|
||||
|
@ -102,6 +102,7 @@ static uint8_t prescaler(uint16_t freq)
|
|||
static void gpt_lld_serve_interrupt(GPTDriver *gptp) {
|
||||
|
||||
gptp->tim->EVENTS_COMPARE[gptp->cc_int] = 0;
|
||||
(void)gptp->tim->EVENTS_COMPARE[gptp->cc_int];
|
||||
if (gptp->state == GPT_ONESHOT)
|
||||
gptp->state = GPT_READY; /* Back in GPT_READY state. */
|
||||
gptp->config->callback(gptp);
|
|
@ -15,8 +15,8 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @file NRF51x22/gpt_lld.h
|
||||
* @brief NRF51x22 GPT subsystem low level driver header.
|
||||
* @file NRF5/LLD/gpt_lld.h
|
||||
* @brief NRF5 GPT subsystem low level driver header.
|
||||
*
|
||||
* @addtogroup GPT
|
||||
* @{
|
|
@ -124,6 +124,7 @@
|
|||
#error "Invalid IRQ priority assigned to ST driver"
|
||||
#endif
|
||||
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver data structures and types. */
|
||||
/*===========================================================================*/
|
||||
|
|
|
@ -26,7 +26,7 @@ ifneq ($(findstring HAL_USE_ADC TRUE,$(HALCONF)),)
|
|||
PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/NRF51822/hal_adc_lld.c
|
||||
endif
|
||||
ifneq ($(findstring HAL_USE_GPT TRUE,$(HALCONF)),)
|
||||
PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/NRF51822/hal_gpt_lld.c
|
||||
PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_gpt_lld.c
|
||||
endif
|
||||
ifneq ($(findstring HAL_USE_WDG TRUE,$(HALCONF)),)
|
||||
PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_wdg_lld.c
|
||||
|
@ -51,7 +51,7 @@ PLATFORMSRC = ${CHIBIOS}/os/hal/ports/common/ARMCMx/nvic.c \
|
|||
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/NRF51822/hal_ext_lld.c \
|
||||
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/NRF51822/hal_i2c_lld.c \
|
||||
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/NRF51822/hal_adc_lld.c \
|
||||
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/NRF51822/hal_gpt_lld.c \
|
||||
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_gpt_lld.c \
|
||||
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_wdg_lld.c \
|
||||
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_rng_lld.c \
|
||||
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/NRF51822/hal_pwm_lld.c \
|
||||
|
|
|
@ -12,6 +12,9 @@ endif
|
|||
ifneq ($(findstring HAL_USE_SERIAL TRUE,$(HALCONF)),)
|
||||
PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_serial_lld.c
|
||||
endif
|
||||
ifneq ($(findstring HAL_USE_GPT TRUE,$(HALCONF)),)
|
||||
PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_gpt_lld.c
|
||||
endif
|
||||
ifneq ($(findstring HAL_USE_WDG TRUE,$(HALCONF)),)
|
||||
PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_wdg_lld.c
|
||||
endif
|
||||
|
@ -24,6 +27,7 @@ PLATFORMSRC = ${CHIBIOS}/os/hal/ports/common/ARMCMx/nvic.c \
|
|||
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_pal_lld.c \
|
||||
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_serial_lld.c \
|
||||
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_st_lld.c \
|
||||
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_gpt_lld.c \
|
||||
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_wdg_lld.c \
|
||||
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_rng_lld.c
|
||||
endif
|
||||
|
|
Loading…
Reference in New Issue