-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathahrs_project.ino
48 lines (40 loc) · 1.37 KB
/
ahrs_project.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <string.h>
#include "gdl_90.h"
#include "imu.h"
#include "defines.h"
#ifndef LED_BUILTIN
#define LED_BUILTIN 13
#endif
#define ms_to_tick(x) x/portTICK_PERIOD_MS //Arduino default ticks.
void TaskBlink( void *pvParameters );
// the setup function runs once when you press reset or power the board
void setup(void) {
Serial.begin(115200);
gdl_90_init();
imu_init();
// blink task, for debugging.
xTaskCreatePinnedToCore(
TaskBlink
, "TaskBlink" // A name just for humans
, 1024 // This stack size can be checked & adjusted by reading the Stack Highwater
, NULL
, 2 // Priority, with 3 (configMAX_PRIORITIES - 1) being the highest, and 0 being the lowest.
, NULL
, FAST_CORE);
}
/*--------------------------------------------------*/
/*---------------------- Tasks ---------------------*/
/*--------------------------------------------------*/
void TaskBlink(void *pvParameters) // This is a task.
{
(void) pvParameters;
pinMode(LED_BUILTIN, OUTPUT);
for (;;) // A Task shall never return or exit.
{
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
vTaskDelay(ms_to_tick(100)); // On for 1/10 of s
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
vTaskDelay(ms_to_tick(900)); // Wait 9/10 s.
}
}
void loop() {} // Empty. Things are done in Tasks.