Just4Trionic - CAN and BDM FLASH programmer for Saab cars

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers interfaces.h Source File

interfaces.h

00001 /*******************************************************************************
00002 
00003 interfaces.cpp - information and definitions about Just4Trionic external interfaces
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 #ifndef __INTERFACES_H__
00015 #define __INTERFACES_H__
00016 
00017 #include "mbed.h"
00018 
00019 extern Serial           pc;                     //Serial pc(USBTX, USBRX); // tx, rx
00020 
00021 extern CAN              can;                    //Serial pc(USBTX, USBRX); // tx, rx
00022 extern DigitalOut       can_rs_pin;             //
00023 
00024 extern LocalFileSystem  local;                  //Serial pc(USBTX, USBRX); // tx, rx
00025 
00026 extern Timer            timer;
00027 extern Timer            timeout;
00028 
00029 extern DigitalIn        PIN_PWR;                // power supply
00030 extern DigitalIn        PIN_NC;                 // connection signal
00031 extern DigitalInOut     PIN_BERR;               // double bus fault input - will be an input when it is working properly
00032 extern DigitalInOut     PIN_BKPT;               // breakpoint/serial clock
00033 extern DigitalInOut     PIN_RESET;              // reset signal
00034 extern DigitalInOut     PIN_DSI;                // data input (to ECU) signal
00035 extern DigitalIn        PIN_DSO;                // data output (from ECU) signal
00036 extern DigitalIn        PIN_FREEZE;             // freeze signal
00037 //extern DigitalIn        PIN_DS;                 // data strobe signal (not used)
00038 
00039 //LEDS
00040 
00041 // Use the LEDs to see if anything is happening
00042 extern DigitalOut       led1;                   // LED1 CAN send
00043 extern DigitalOut       led2;                   // LED2 CAN receive
00044 extern DigitalOut       led3;                   // BDM activity LE
00045 extern DigitalOut       led4;                   // Error LED
00046 
00047 extern Ticker           ticker;
00048 
00049 void leds_off(void);
00050 
00051 // led control macros
00052 // These macros use the fastio register method to control the leds
00053 #define CANTXLEDON      LPC_GPIO1->FIOSET = (1 << 18)   // Turn on the CAN bus transmitter activity led (led1, P1.18)
00054 #define CANTXLEDOFF     LPC_GPIO1->FIOCLR = (1 << 18)   // Turn off the CAN bus transmitter activity led (led1, P1.18)
00055 #define CANRXLEDON      LPC_GPIO1->FIOSET = (1 << 20)   // Turn on the CAN bus receiver activity led (led2, P1.20)
00056 #define CANRXLEDOFF     LPC_GPIO1->FIOCLR = (1 << 20)   // Turn off the CAN bus receiver activity led (led2, P1.20)
00057 #define ACTIVITYLEDON   LPC_GPIO1->FIOSET = (1 << 21)   // Turn on the activity led (led3, P1.21)
00058 #define ACTIVITYLEDOFF  LPC_GPIO1->FIOCLR = (1 << 21)   // Turn off the activity led (led3, P1.21)
00059 #define ERRORLEDON      LPC_GPIO1->FIOSET = (1 << 23)   // Turn on the ERROR led (led3, P1.23)
00060 #define ERRORLEDOFF     LPC_GPIO1->FIOCLR = (1 << 23)   // Turn off the ERROR led (led3, P1.23)
00061 
00062 #endif          // __INTERFACES_H__