SAE Teensy ECU
IIT SAE Microcontroller programming
Loading...
Searching...
No Matches
test_b.h
1#ifndef __TEST_B_H__
2#define __TEST_B_H__
3
4#include "module.hpp"
5
6#include "Pins.h"
7
8class e : public Module::Module_t {
9
10 LOG_TAG ID = "e";
11
12 void setup() {
13 Log.i(ID, "Setup", id);
15 }
16
17 volatile int counter = 0;
18
19 void run() {
20 while (1) {
21 Log.i(ID, "running", counter++);
22 Thread::delay(350);
23 Log.w(ID, "LED!");
24 Pins::setPinValue(PINS_BOTH_LED, counter % 2);
25 }
26 }
27
28 void print() {
29 Log.i(ID, "ID", id);
30 }
31} e;
32
33class d_t : public Module::Module_t {
34
35 using Module::Module_t::Module_t;
36
37 LOG_TAG ID = "d";
38
39 void setup() {
40 Log.i(ID, "Setup", id);
41 }
42
43 volatile int counter = 0;
44
45 void run() {
46 while (1) {
47 Log.i(ID, "running", counter++);
48 Thread::delay(1000);
49 if (counter == 20) {
50 counter /= 4;
51 }
52 }
53 }
54
55 void print() {
56 Log.i(ID, "ID", id);
57 }
58
59} d("d", &e);
60
61class c_t : public Module::Module_t {
62
63 using Module::Module_t::Module_t;
64
65 LOG_TAG ID = "c";
66
67 void setup() {
68 Log.i(ID, "Setup", id);
69 }
70
71 volatile int counter = 0;
72
73 // void run() {
74 // while (1) {
75 // Log.i(ID, "running", counter++);
76 // Thread::delay(1000);
77 // }
78 // }
79
80 void print() {
81 Log.i(ID, "ID", id);
82 }
83
84} c("c", &d);
85
86class b_t : public Module::Module_t {
87
88 using Module::Module_t::Module_t;
89
90 LOG_TAG ID = "b";
91
92 void setup() {
93 Log.i(ID, "Setup", id);
94 }
95
96 volatile int counter = 0;
97
98 void run() {
99 while (1) {
100 Log.i(ID, "running", counter++);
101 Thread::delay(1000);
102 }
103 }
104
105 void print() {
106 Log.i(ID, "ID", id);
107 }
108} b("b");
109
110d_t d0("d0", &b);
111#endif // __TEST_B_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.
Update, set, and get predefined pin values.
Module_t should be used for major components of a framework, it is used to isolate,...
Definition test_b.h:86
Definition test_b.h:61
Definition test_b.h:33
Definition test_b.h:8
void setPinValue(uint8_t GPIO_Pin, int value)
Set the pin value of a predefined pin.
void initialize(void)
Initialize all predefined pins.
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.