File tree Expand file tree Collapse file tree 2 files changed +23
-6
lines changed Expand file tree Collapse file tree 2 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ volatile float current_in_telem = 0;
12
12
volatile float brake_pressure_telem = 0 ;
13
13
14
14
// Ticker to poll input readings at fixed rate
15
- STM32TimerInterrupt IOTimer (TIM7 );
15
+ STM32TimerInterrupt IOTimer (TIM2 );
16
16
17
17
void initIO () {
18
18
pinMode (MCU_DIR, OUTPUT);
@@ -35,6 +35,7 @@ void initIO() {
35
35
36
36
void readIO ()
37
37
{
38
+ digital_data.mc_on = digitalRead (MC_ON);
38
39
digital_data.mc_speed_sig = digitalRead (MCU_SPEED_SIG);
39
40
digital_data.park_brake = digitalRead (PRK_BRK_TELEM);
40
41
@@ -56,11 +57,6 @@ void set_eco_mode(bool eco){
56
57
digital_data.eco_mode = eco;
57
58
}
58
59
59
- void set_mc_on (bool mc_on){
60
- digital_data.mc_on = mc_on;
61
- digitalWrite (MC_ON, mc_on);
62
- }
63
-
64
60
void writeAccOut (float newAccOut) {
65
61
acc_out = newAccOut;
66
62
analogWrite (PA5, acc_out);
Original file line number Diff line number Diff line change 5
5
6
6
CANPDC canBus (CAN1, DEF);
7
7
8
+ uint8_t counter = 0 ;
9
+
8
10
void setup () {
9
11
Serial.begin (115200 );
10
12
initIO ();
@@ -13,4 +15,23 @@ void setup() {
13
15
void loop () {
14
16
canBus.sendPDCData ();
15
17
canBus.runQueue (DATA_SEND_PERIOD);
18
+ counter++;
19
+ if (counter >= 10 ) {
20
+ counter = 0 ;
21
+
22
+ // clear the screen
23
+ printf (" \e[1;1H\e[2J" );
24
+
25
+ // digital inputs
26
+ printf (" mc_on: %d\n " , digital_data.mc_on );
27
+ printf (" park_brake: %d\n " , digital_data.park_brake );
28
+
29
+ // analog inputs
30
+ printf (" acc_in: %f\n " , acc_in);
31
+ printf (" 12V: %f\n " , lv_12V_telem);
32
+ printf (" 5V: %f\n " , lv_5V_telem);
33
+ printf (" 5V current: %f\n " , lv_5V_current);
34
+ printf (" current in: %f\n " , current_in_telem);
35
+ printf (" brake pressure: %f\n " , brake_pressure_telem);
36
+ }
16
37
}
You can’t perform that action at this time.
0 commit comments