SAE Teensy ECU
IIT SAE Microcontroller programming
Loading...
Searching...
No Matches
test_a.h
1#ifndef __TEST_A_H__
2#define __TEST_A_H__
3
4#include "module.hpp"
5#include "test_b.h"
6
8 LOG_TAG ID = "GPIO";
9
10 using Module::MessengerModule_t::MessengerModule_t;
11
12 void setup() {
13 Log.i(ID, "Setup", id);
14 }
15
16 volatile bool state = false;
17 volatile int counter = 0;
18 volatile bool led = false;
19
20 void run() {
21 while (1) {
22 if ((state = !state)) {
23 Log.i(ID, "running", counter++);
24 Thread::delay(500);
25 Log.w(ID, "LED!");
26 Pins::setPinValue(PINS_BOTH_LED, (led = !led));
27 } else {
28 Log.i(ID, "running alt");
29 Thread::delay(1000);
30 }
31 }
32 }
33
34} GPIO(Module::DEFAULT_STACK_SIZE);
35
37 LOG_TAG ID = "a";
38
39 using Module::MessengerModule_t::MessengerModule_t;
40
41 void setup() {
42 Log.i(ID, "Setup", id);
43 }
44
45 volatile bool state = false;
46 volatile int counter = 0;
47 volatile bool led = false;
48
49 void run() {
50 while (1) {
51 if ((state = !state)) {
52 Log.i(ID, "running", counter++);
53 Thread::delay(500);
54 Log.w(ID, "LED!");
55 Pins::setPinValue(PINS_BOTH_LED, (led = !led));
56 } else {
57 Log.i(ID, "running alt");
58 Thread::delay(1000);
59 }
60 }
61 }
62
63} a(Module::DEFAULT_STACK_SIZE, &b, &c, &d);
64
65#endif // __TEST_A_H__
const char * LOG_TAG
Type definition of logging tags This typedef is necessary to allow for easier manipulation of code by...
Definition Log.h:48
Logging::Log_t Log
The global logging object.
Definition test_a.h:7
Definition test_a.h:36
void setPinValue(uint8_t GPIO_Pin, int value)
Set the pin value of a predefined pin.
void w(LOG_TAG TAG, LOG_MSG message)
Log a string using a warning tag.
void i(LOG_TAG TAG, LOG_MSG message)
Log a string using an info tag.