-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinterfaces.cpp
More file actions
60 lines (42 loc) · 2.05 KB
/
interfaces.cpp
File metadata and controls
60 lines (42 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*******************************************************************************
interfaces.cpp
(c) 2010 by Sophie Dexter
********************************************************************************
WARNING: Use at your own risk, sadly this software comes with no guarantees.
This software is provided 'free' and in good faith, but the author does not
accept liability for any damage arising from its use.
*******************************************************************************/
#include "interfaces.h"
//Serial pc(USBTX, USBRX); // tx, rx
Serial pc(USBTX, USBRX);
// A timer for timing how long things take to happen
Timer timer;
// A timer for checking that timeout periods aren't exceeded
Timer timeout;
// We use CAN on mbed pins 29(CAN_TXD) and 30(CAN_RXD).
CAN can(p30, p29);
USBCombi combi;
max6675 sensor(p12, p13, p14); //miso, sclk, cs
// Need to create this to be able to read and write files on the mbed 'disk'
LocalFileSystem local("local");
DigitalIn PIN_PWR(p19); // power supply
DigitalIn PIN_NC(p20); // connection signal
DigitalInOut PIN_BERR(p21); // double bus fault input - will be an input when it is working properly
DigitalInOut PIN_BKPT(p22); // breakpoint/serial clock
DigitalInOut PIN_RESET(p23); // reset signal
DigitalInOut PIN_DSI(p24); // data input (to ECU) signal
DigitalIn PIN_DSO(p25); // data output (from ECU) signal
DigitalIn PIN_FREEZE(p26); // freeze signal
//DigitalIn PIN_DS(p27); // data strobe signal (not used)
//LEDS
// Use the LEDs to if anything is happening
DigitalOut led1(LED1); // LED1 CAN send
DigitalOut led2(LED2); // LED2 CAN receive
DigitalOut led3(LED3); // BDM activity LED
DigitalOut led4(LED4); // Error LED
Ticker ticker;
void leds_off() {
CANTXLEDOFF;
CANRXLEDOFF;
ACTIVITYLEDOFF;
}