Formula Student Electronics & Software
The code for the embedded software
Loading...
Searching...
No Matches
test_digitalSender.cpp
Go to the documentation of this file.
1#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
19#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
33
41 Metro test{5000};
43 while (!test.check()) {
44 }
46 while (!test.check()) {
47 };
48 TEST_PASS();
49}
50
58 Metro test{5000};
61 while (!test.check()) {
62 }
63 TEST_PASS();
64}
65
74void test_blinkLED(void) {
75 Metro test{10000};
77
78 while (!test.check()) {
79 ds.blinkLED(1);
80 }
81 TEST_PASS();
82}
83
84int main() {
85 UNITY_BEGIN();
88 RUN_TEST(test_blinkLED);
89 return UNITY_END();
90}
91
Class responsible for controlling digital outputs in the Master Teensy.
static void closeSDC()
Closes the SDC in Master and SDC Logic.
void enterEmergencyState()
ASSI LEDs blue flashing, sdc open and buzzer ringing.
static void openSDC()
Opens the SDC in Master and SDC Logic.
void blinkLED(int pin)
Blinks the LED at the given pin.
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()