Sophie Dexter
/
Just4Trionic
Just4Trionic - CAN and BDM FLASH programmer for Saab cars
Embed:
(wiki syntax)
Show/hide line numbers
interfaces.cpp
00001 /******************************************************************************* 00002 00003 interfaces.cpp 00004 (c) 2010 by Sophie Dexter 00005 00006 ******************************************************************************** 00007 00008 WARNING: Use at your own risk, sadly this software comes with no guarantees. 00009 This software is provided 'free' and in good faith, but the author does not 00010 accept liability for any damage arising from its use. 00011 00012 *******************************************************************************/ 00013 00014 #include "interfaces.h" 00015 00016 //Serial pc(USBTX, USBRX); // tx, rx 00017 Serial pc(USBTX, USBRX); 00018 00019 // A timer for timing how long things take to happen 00020 Timer timer; 00021 // A timer for checking that timeout periods aren't exceeded 00022 Timer timeout; 00023 00024 // We use CAN on mbed pins 29(CAN_TXD) and 30(CAN_RXD). 00025 CAN can(p30, p29); 00026 // CAN_RS pin at Philips PCA82C250 can bus controller. 00027 // activate transceiver by pulling this pin to GND. 00028 // (Rise and fall slope controlled by resistor R_s) 00029 // (+5V result in tranceiver standby mode) 00030 // For further information see datasheet page 4 00031 DigitalOut can_rs_pin(p28); 00032 00033 // Need to create this to be able to read and write files on the mbed 'disk' 00034 LocalFileSystem local("local"); 00035 00036 00037 DigitalIn PIN_PWR(p19); // power supply 00038 DigitalIn PIN_NC(p20); // connection signal 00039 DigitalInOut PIN_BERR(p21); // double bus fault input - will be an input when it is working properly 00040 DigitalInOut PIN_BKPT(p22); // breakpoint/serial clock 00041 DigitalInOut PIN_RESET(p23); // reset signal 00042 DigitalInOut PIN_DSI(p24); // data input (to ECU) signal 00043 DigitalIn PIN_DSO(p25); // data output (from ECU) signal 00044 DigitalIn PIN_FREEZE(p26); // freeze signal 00045 //DigitalIn PIN_DS(p27); // data strobe signal (not used) 00046 00047 //LEDS 00048 00049 // Use the LEDs to if anything is happening 00050 00051 DigitalOut led1(LED1); // LED1 CAN send 00052 DigitalOut led2(LED2); // LED2 CAN receive 00053 DigitalOut led3(LED3); // BDM activity LED 00054 DigitalOut led4(LED4); // Error LED 00055 00056 Ticker ticker; 00057 00058 void leds_off() { 00059 CANTXLEDOFF; 00060 CANRXLEDOFF; 00061 ACTIVITYLEDOFF; 00062 }
Generated on Fri Jul 15 2022 00:43:05 by 1.7.2