Loading...
Searching...
No Matches
heartbeat.c
1/***********************************************************************************
2 * @file heartbeat.c *
3 * @author Matt Ricci *
4 * @addtogroup RTOS *
5 * *
6 * @{ *
7 ***********************************************************************************/
8
9#include "FreeRTOS.h"
10#include "task.h"
11
12#include "heartbeat.h"
13
14#include "gpiopin.h"
15#include "devices.h"
16
17/* =============================================================================== */
22void vHeartbeatBlink(void *argument) {
23
24 const TickType_t xFrequency = pdMS_TO_TICKS(125);
25 GPIOpin_t heartbeatLED = GPIOpin_init(LED1_PORT, LED1_PIN, NULL);
26
27 for (;;) {
28 TickType_t xLastWakeTime = xTaskGetTickCount();
29 vTaskDelayUntil(&xLastWakeTime, xFrequency);
30
31 heartbeatLED.toggle(&heartbeatLED);
32 }
33}
34
void(* toggle)(struct GPIOpin *)
Definition gpiopin.h:157
GPIOpin_t GPIOpin_init(GPIO_TypeDef *, GPIO_Pin, GPIO_Config *)
Initialiser for a GPIO peripheral pin interface.
Definition gpiopin.c:28
Struct definition for a GPIO pin.
Definition gpiopin.h:151