Just4Trionic - CAN and BDM FLASH programmer for Saab cars

Dependencies:   mbed

Committer:
Just4pLeisure
Date:
Sat Apr 23 18:31:40 2016 +0000
Revision:
6:2fbcbebed28c
Parent:
5:1775b4b13232
Version 1.6 Faster T7 P-BUS FLASHing algorithm, longer T8 erase timeout fixed BDM register display function

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Just4pLeisure 1:d5452e398b76 1 /*******************************************************************************
Just4pLeisure 1:d5452e398b76 2
Just4pLeisure 1:d5452e398b76 3 interfaces.cpp - information and definitions about Just4Trionic external interfaces
Just4pLeisure 1:d5452e398b76 4 (c) 2010 by Sophie Dexter
Just4pLeisure 1:d5452e398b76 5
Just4pLeisure 1:d5452e398b76 6 ********************************************************************************
Just4pLeisure 1:d5452e398b76 7
Just4pLeisure 1:d5452e398b76 8 WARNING: Use at your own risk, sadly this software comes with no guarantees.
Just4pLeisure 1:d5452e398b76 9 This software is provided 'free' and in good faith, but the author does not
Just4pLeisure 1:d5452e398b76 10 accept liability for any damage arising from its use.
Just4pLeisure 1:d5452e398b76 11
Just4pLeisure 1:d5452e398b76 12 *******************************************************************************/
Just4pLeisure 1:d5452e398b76 13
Just4pLeisure 1:d5452e398b76 14 #ifndef __INTERFACES_H__
Just4pLeisure 1:d5452e398b76 15 #define __INTERFACES_H__
Just4pLeisure 1:d5452e398b76 16
Just4pLeisure 1:d5452e398b76 17 #include "mbed.h"
Just4pLeisure 1:d5452e398b76 18
Just4pLeisure 1:d5452e398b76 19 extern Serial pc; //Serial pc(USBTX, USBRX); // tx, rx
Just4pLeisure 1:d5452e398b76 20
Just4pLeisure 1:d5452e398b76 21 extern CAN can; //Serial pc(USBTX, USBRX); // tx, rx
Just4pLeisure 1:d5452e398b76 22 extern DigitalOut can_rs_pin; //
Just4pLeisure 1:d5452e398b76 23
Just4pLeisure 1:d5452e398b76 24 extern LocalFileSystem local; //Serial pc(USBTX, USBRX); // tx, rx
Just4pLeisure 1:d5452e398b76 25
Just4pLeisure 1:d5452e398b76 26 extern Timer timer;
Just4pLeisure 5:1775b4b13232 27 extern Timer timeout;
Just4pLeisure 1:d5452e398b76 28
Just4pLeisure 1:d5452e398b76 29 extern DigitalIn PIN_PWR; // power supply
Just4pLeisure 1:d5452e398b76 30 extern DigitalIn PIN_NC; // connection signal
Just4pLeisure 1:d5452e398b76 31 extern DigitalInOut PIN_BERR; // double bus fault input - will be an input when it is working properly
Just4pLeisure 1:d5452e398b76 32 extern DigitalInOut PIN_BKPT; // breakpoint/serial clock
Just4pLeisure 1:d5452e398b76 33 extern DigitalInOut PIN_RESET; // reset signal
Just4pLeisure 1:d5452e398b76 34 extern DigitalInOut PIN_DSI; // data input (to ECU) signal
Just4pLeisure 2:bf3a2b29259a 35 extern DigitalIn PIN_DSO; // data output (from ECU) signal
Just4pLeisure 1:d5452e398b76 36 extern DigitalIn PIN_FREEZE; // freeze signal
Just4pLeisure 2:bf3a2b29259a 37 //extern DigitalIn PIN_DS; // data strobe signal (not used)
Just4pLeisure 1:d5452e398b76 38
Just4pLeisure 1:d5452e398b76 39 //LEDS
Just4pLeisure 1:d5452e398b76 40
Just4pLeisure 1:d5452e398b76 41 // Use the LEDs to see if anything is happening
Just4pLeisure 1:d5452e398b76 42 extern DigitalOut led1; // LED1 CAN send
Just4pLeisure 1:d5452e398b76 43 extern DigitalOut led2; // LED2 CAN receive
Just4pLeisure 1:d5452e398b76 44 extern DigitalOut led3; // BDM activity LE
Just4pLeisure 1:d5452e398b76 45 extern DigitalOut led4; // Error LED
Just4pLeisure 1:d5452e398b76 46
Just4pLeisure 1:d5452e398b76 47 extern Ticker ticker;
Just4pLeisure 1:d5452e398b76 48
Just4pLeisure 1:d5452e398b76 49 void leds_off(void);
Just4pLeisure 1:d5452e398b76 50
Just4pLeisure 2:bf3a2b29259a 51 // led control macros
Just4pLeisure 2:bf3a2b29259a 52 // These macros use the fastio register method to control the leds
Just4pLeisure 2:bf3a2b29259a 53 #define CANTXLEDON LPC_GPIO1->FIOSET = (1 << 18) // Turn on the CAN bus transmitter activity led (led1, P1.18)
Just4pLeisure 2:bf3a2b29259a 54 #define CANTXLEDOFF LPC_GPIO1->FIOCLR = (1 << 18) // Turn off the CAN bus transmitter activity led (led1, P1.18)
Just4pLeisure 2:bf3a2b29259a 55 #define CANRXLEDON LPC_GPIO1->FIOSET = (1 << 20) // Turn on the CAN bus receiver activity led (led2, P1.20)
Just4pLeisure 2:bf3a2b29259a 56 #define CANRXLEDOFF LPC_GPIO1->FIOCLR = (1 << 20) // Turn off the CAN bus receiver activity led (led2, P1.20)
Just4pLeisure 2:bf3a2b29259a 57 #define ACTIVITYLEDON LPC_GPIO1->FIOSET = (1 << 21) // Turn on the activity led (led3, P1.21)
Just4pLeisure 2:bf3a2b29259a 58 #define ACTIVITYLEDOFF LPC_GPIO1->FIOCLR = (1 << 21) // Turn off the activity led (led3, P1.21)
Just4pLeisure 2:bf3a2b29259a 59 #define ERRORLEDON LPC_GPIO1->FIOSET = (1 << 23) // Turn on the ERROR led (led3, P1.23)
Just4pLeisure 2:bf3a2b29259a 60 #define ERRORLEDOFF LPC_GPIO1->FIOCLR = (1 << 23) // Turn off the ERROR led (led3, P1.23)
Just4pLeisure 2:bf3a2b29259a 61
Just4pLeisure 1:d5452e398b76 62 #endif // __INTERFACES_H__