Formula Student Electronics & Software
The code for the embedded software
Loading...
Searching...
No Matches
test_digitalSender.cpp
Go to the documentation of this file.
2#include "unity.h"
3
4// undefine before all the pins defined after
5#undef SDC_LOGIC_CLOSE_SDC_PIN
6#undef SDC_LOGIC_WATCHDOG_OUT_PIN
7#undef EBS_VALVE_1_PIN
8#undef EBS_VALVE_2_PIN
9#undef MASTER_SDC_OUT_PIN
10
11#define SDC_LOGIC_CLOSE_SDC_PIN 2
12#define MASTER_SDC_OUT_PIN 3
13#define EBS_VALVE_1_PIN 4
14#define EBS_VALVE_2_PIN 5
15#define SDC_LOGIC_WATCHDOG_OUT_PIN 6
16
17#define UNALLOWED_PIN 0
18
20#include "metro.h"
21
22void setUp(void) {
23 for (int pin = 0; pin < 7; pin++) {
24 pinMode(pin, OUTPUT);
25 digitalWrite(pin, LOW);
26 }
27}
28
29void tearDown(void) {
30 // This is run after EACH test
31}
32
40 Metro test{5000};
42 while (!test.check()) {
43 }
45 while (!test.check()) {
46 };
47 TEST_PASS();
48}
49
57 Metro test{5000};
60 while (!test.check()) {
61 }
62 TEST_PASS();
63}
64
73void test_blinkLED(void) {
74 Metro test{10000};
76
77 while (!test.check()) {
78 ds.blink_led(1);
79 }
80 TEST_PASS();
81}
82
83int main() {
84 UNITY_BEGIN();
87 RUN_TEST(test_blinkLED);
88 return UNITY_END();
89}
Class responsible for controlling digital outputs in the Master Teensy.
void enter_emergency_state()
ASSI LEDs blue flashing, sdc open and buzzer ringing.
void blink_led(int pin)
Blinks the LED at the given pin.
static void open_sdc()
Opens the SDC in Master and SDC Logic.
Our own implementation of Metro class.
Definition metro.h:13
void test_blinkLED(void)
Test the blinkLED function The toggle watchdog is the same function as blink LED so we can afirm that...
void test_openSDC_then_closeSDC(void)
Test the SDC Functions PROTOCOL:
void setUp(void)
void tearDown(void)
void test_enterEmergencyState_and_turn_off_LEDS(void)
Test the enterEmergency state function PROTOCOL:
int main()