Formula Student Electronics & Software
The code for the embedded software
Loading...
Searching...
No Matches
test_digitalReceiver.cpp
Go to the documentation of this file.
2#include "unity.h"
3
4#define GREEN_LED_1 4
5#define GREEN_LED_2 5
6#define GREEN_LED_3 6
7#define RED_LED_1 0
8#define RED_LED_2 1
9#define YELLOW_LED_1 2
10#define YELLOW_LED_2 3
11#define BUTTON_1 7
12#define BUTTON_2 8
13#define BUTTON_3 9
14#define BUTTON_4 10
15#define BUTTON_5 11
16#define BUTTON_6 12
17
18#define ASMS_IN_PIN BUTTON_1
19#define SDC_STATE_PIN BUTTON_2
20#define SDC_LOGIC_WATCHDOG_IN_PIN BUTTON_3
21#define SENSOR_PRESSURE_1_PIN BUTTON_4
22#define SENSOR_PRESSURE_2_PIN BUTTON_5
23#define LWSS_PIN BUTTON_6
24
25#define WHEEL_MEASUREMENT_INTERVAL_MS 1000 // clicks measured every second
26#define WHEEL_MEASUREMENT_INTERVAL_MIN (WHEEL_MEASUREMENT_INTERVAL_MS / 60000.0)
27#define PULSES_PER_ROTATION 60 // 60 pulses per rotation - if 1 pulse/click per sec will give 1 rpm
28// Constants defined to meassure number of clicks in 1s as rpm
29
31#include "model/systemData.hpp"
32
35
53// void test_lwss() {
54// Metro test{10000};
55// bool one_rpm = false, two_rpm = false, three_rpm = false, test_pass = false;
56// systemData.digitalData._left_wheel_rpm = 0;
57// while (!test.check() && !test_pass) {
58// digitalRecv.digitalReads();
59// if (systemData.digitalData._left_wheel_rpm > 2) {
60// three_rpm = true;
61// digitalWrite(GREEN_LED_3, HIGH);
62// } else {
63// digitalWrite(GREEN_LED_3, LOW);
64// }
65
66// if (systemData.digitalData._left_wheel_rpm > 1) {
67// two_rpm = true;
68// digitalWrite(GREEN_LED_2, HIGH);
69// } else {
70// digitalWrite(GREEN_LED_2, LOW);
71// }
72
73// if (systemData.digitalData._left_wheel_rpm > 0) {
74// one_rpm = true;
75// digitalWrite(GREEN_LED_1, HIGH);
76// } else {
77// digitalWrite(GREEN_LED_1, LOW);
78// }
79
80// test_pass = one_rpm && two_rpm && three_rpm;
81// }
82// TEST_ASSERT_TRUE(test_pass);
83// }
84
85void setUp() {
86 pinMode(GREEN_LED_1, OUTPUT);
87 pinMode(GREEN_LED_2, OUTPUT);
88 pinMode(GREEN_LED_3, OUTPUT);
89 pinMode(YELLOW_LED_1, OUTPUT);
90 pinMode(YELLOW_LED_2, OUTPUT);
91 pinMode(RED_LED_1, OUTPUT);
92 pinMode(RED_LED_2, OUTPUT);
93}
94
95int main() {
96 UNITY_BEGIN();
97 // RUN_TEST(test_lwss);
98 return UNITY_END();
99}
Class responsible for the reading of the digital inputs into the Master teensy.
The whole model of the system: holds all the data necessary.
Mission mission_
DigitalData digital_data_
#define RED_LED_2
#define GREEN_LED_1
#define YELLOW_LED_1
SystemData system_data
#define RED_LED_1
void setUp()
Test the Left Wheel Speed Sensor Check the Left wheel Speed Sensor is being well calculated PROTOCOL:
#define YELLOW_LED_2
auto digitalRecv
#define GREEN_LED_2
int main()
#define GREEN_LED_3