nrf51822_aqi_sensor_test/main.c

59 lines
1.4 KiB
C

#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "bsp.h"
#include "nrf_drv_clock.h"
#include "nordic_common.h"
#include "sdk_errors.h"
#include "app_error.h"
#include "FreeRTOS.h"
#include "task.h"
#include "timers.h"
#define APP_TIMER_PRESCALER 0
#define APP_TIMER_OP_QUEUE_SIZE 4
TaskHandle_t xTaskBlinkLEDHandle = NULL;
void vTaskBlinkLED(void *pvParameters);
TimerHandle_t xTimerBlinkAnotherLEDHandle = NULL;
void xTimerBlinkAnotherLEDCallback(void *pvParameters);
int main(void) {
ret_code_t err_code;
err_code = nrf_drv_clock_init();
APP_ERROR_CHECK(err_code);
bsp_board_leds_init();
bsp_board_leds_off();
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
UNUSED_VARIABLE(xTaskCreate(vTaskBlinkLED, "TASKLED0", 128, NULL, 2, xTaskBlinkLEDHandle));
xTimerBlinkAnotherLEDHandle = xTimerCreate("TIMERLED1", pdMS_TO_TICKS(200), pdTRUE, NULL, xTimerBlinkAnotherLEDCallback);
UNUSED_VARIABLE(xTimerStart(xTimerBlinkAnotherLEDHandle, 0));
vTaskStartScheduler();
for(;;) {
//
}
}
void vTaskBlinkLED(void *pvParameters) {
UNUSED_VARIABLE(pvParameters);
for(;;) {
bsp_board_led_invert(BSP_BOARD_LED_0);
vTaskDelay(1000);
}
}
void xTimerBlinkAnotherLEDCallback(void *pvParameters) {
UNUSED_VARIABLE(pvParameters);
bsp_board_led_invert(BSP_BOARD_LED_1);
}