Formula Student Electronics & Software
The code for the embedded software
Loading...
Searching...
No Matches
test_digitalReceiver.cpp
Go to the documentation of this file.
1
#include "
model/digitalData.hpp
"
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
30
#include "
embedded/digitalReceiver.hpp
"
31
#include "
model/systemData.hpp
"
32
33
SystemData
system_data
;
34
auto
digitalRecv
=
DigitalReceiver
(&
system_data
.
digital_data_
, &
system_data
.
mission_
);
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
85
void
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
95
int
main
() {
96
UNITY_BEGIN();
97
// RUN_TEST(test_lwss);
98
return
UNITY_END();
99
}
DigitalReceiver
Class responsible for the reading of the digital inputs into the Master teensy.
Definition
digitalReceiver.hpp:16
digitalData.hpp
digitalReceiver.hpp
SystemData
The whole model of the system: holds all the data necessary.
Definition
systemData.hpp:12
SystemData::mission_
Mission mission_
Definition
systemData.hpp:18
SystemData::digital_data_
DigitalData digital_data_
Definition
systemData.hpp:17
systemData.hpp
RED_LED_2
#define RED_LED_2
Definition
test_digitalReceiver.cpp:8
GREEN_LED_1
#define GREEN_LED_1
Definition
test_digitalReceiver.cpp:4
YELLOW_LED_1
#define YELLOW_LED_1
Definition
test_digitalReceiver.cpp:9
system_data
SystemData system_data
Definition
test_digitalReceiver.cpp:33
RED_LED_1
#define RED_LED_1
Definition
test_digitalReceiver.cpp:7
setUp
void setUp()
Test the Left Wheel Speed Sensor Check the Left wheel Speed Sensor is being well calculated PROTOCOL:
Definition
test_digitalReceiver.cpp:85
YELLOW_LED_2
#define YELLOW_LED_2
Definition
test_digitalReceiver.cpp:10
digitalRecv
auto digitalRecv
Definition
test_digitalReceiver.cpp:34
GREEN_LED_2
#define GREEN_LED_2
Definition
test_digitalReceiver.cpp:5
main
int main()
Definition
test_digitalReceiver.cpp:95
GREEN_LED_3
#define GREEN_LED_3
Definition
test_digitalReceiver.cpp:6
master
test
test_digital_receiver
test_digitalReceiver.cpp
Generated by
1.9.8