This is a complete listing of the RS-EDP software for the mbed module to support the RS-EDP platform.

Dependencies:   mbed

Committer:
DavidGilesHitex
Date:
Fri Nov 19 09:49:16 2010 +0000
Revision:
0:5b7639d1f2c4

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DavidGilesHitex 0:5b7639d1f2c4 1 /* Configure the I/O Port Structure */
DavidGilesHitex 0:5b7639d1f2c4 2 /* ******************************** */
DavidGilesHitex 0:5b7639d1f2c4 3
DavidGilesHitex 0:5b7639d1f2c4 4
DavidGilesHitex 0:5b7639d1f2c4 5
DavidGilesHitex 0:5b7639d1f2c4 6
DavidGilesHitex 0:5b7639d1f2c4 7 /* includes files */
DavidGilesHitex 0:5b7639d1f2c4 8 #include "mbed.h" /* Header file for mbed module */
DavidGilesHitex 0:5b7639d1f2c4 9 #include "defines.h" /* User defines */
DavidGilesHitex 0:5b7639d1f2c4 10 #include "misra_types.h" /* MISRA Types */
DavidGilesHitex 0:5b7639d1f2c4 11 #include "RSEDP_Slave_Address_Defines.h" /* Slave address of I2C Devices defined here */
DavidGilesHitex 0:5b7639d1f2c4 12
DavidGilesHitex 0:5b7639d1f2c4 13
DavidGilesHitex 0:5b7639d1f2c4 14
DavidGilesHitex 0:5b7639d1f2c4 15 /* Digital I/O */
DavidGilesHitex 0:5b7639d1f2c4 16 DigitalOut User_Led1(LED1);
DavidGilesHitex 0:5b7639d1f2c4 17 DigitalOut User_Led2(LED2);
DavidGilesHitex 0:5b7639d1f2c4 18 DigitalOut User_Led3(LED3);
DavidGilesHitex 0:5b7639d1f2c4 19 DigitalOut User_Led4(LED4);
DavidGilesHitex 0:5b7639d1f2c4 20
DavidGilesHitex 0:5b7639d1f2c4 21
DavidGilesHitex 0:5b7639d1f2c4 22 /* SPI Interface to RS-EDP CNTRL_SPI and the SD Card on Adapter board */
DavidGilesHitex 0:5b7639d1f2c4 23 SPI CNTRL_spi(p5, p6, p7); /* MOSI, MISO, SCLK */
DavidGilesHitex 0:5b7639d1f2c4 24
DavidGilesHitex 0:5b7639d1f2c4 25 /* pin 8 used as input */
DavidGilesHitex 0:5b7639d1f2c4 26 DigitalIn DigitalIn_Pin8(p8);
DavidGilesHitex 0:5b7639d1f2c4 27
DavidGilesHitex 0:5b7639d1f2c4 28 /* I2C Interface to RS-EDP CNTRL I2C */
DavidGilesHitex 0:5b7639d1f2c4 29 I2C CNTRL_i2c(p9, p10); /* SDA, SCL */
DavidGilesHitex 0:5b7639d1f2c4 30
DavidGilesHitex 0:5b7639d1f2c4 31
DavidGilesHitex 0:5b7639d1f2c4 32 /* SPI interface to base board MCI Pins and to LCD pins on the adapter board */
DavidGilesHitex 0:5b7639d1f2c4 33 SPI MCI_spi(p11, p12, p13); /* MOSI, MISO, SCLK */
DavidGilesHitex 0:5b7639d1f2c4 34
DavidGilesHitex 0:5b7639d1f2c4 35 /* pin 14 used as digital out */
DavidGilesHitex 0:5b7639d1f2c4 36 DigitalOut DigitalOut_Pin14(p14);
DavidGilesHitex 0:5b7639d1f2c4 37
DavidGilesHitex 0:5b7639d1f2c4 38
DavidGilesHitex 0:5b7639d1f2c4 39 /* Analogue I/O Pin Definitions or General I/O */
DavidGilesHitex 0:5b7639d1f2c4 40 AnalogIn AD0(p15);
DavidGilesHitex 0:5b7639d1f2c4 41 AnalogIn AD1(p16);
DavidGilesHitex 0:5b7639d1f2c4 42 AnalogIn AD2(p17);
DavidGilesHitex 0:5b7639d1f2c4 43 AnalogIn AD3(p18);
DavidGilesHitex 0:5b7639d1f2c4 44
DavidGilesHitex 0:5b7639d1f2c4 45 DigitalOut DigitalOut_Pin19(p19);
DavidGilesHitex 0:5b7639d1f2c4 46
DavidGilesHitex 0:5b7639d1f2c4 47 /* pin 20 not configured */
DavidGilesHitex 0:5b7639d1f2c4 48
DavidGilesHitex 0:5b7639d1f2c4 49
DavidGilesHitex 0:5b7639d1f2c4 50 /* Pin21 used as PWM */
DavidGilesHitex 0:5b7639d1f2c4 51 PwmOut PwmOut_Pin21(p21);
DavidGilesHitex 0:5b7639d1f2c4 52
DavidGilesHitex 0:5b7639d1f2c4 53 /* pin 22 - not configured */
DavidGilesHitex 0:5b7639d1f2c4 54 PwmOut PwmOut_Pin23(p23);
DavidGilesHitex 0:5b7639d1f2c4 55
DavidGilesHitex 0:5b7639d1f2c4 56 /* Pin24 used as PWM */
DavidGilesHitex 0:5b7639d1f2c4 57 DigitalOut DigitalOut_Pin24(p24);
DavidGilesHitex 0:5b7639d1f2c4 58
DavidGilesHitex 0:5b7639d1f2c4 59
DavidGilesHitex 0:5b7639d1f2c4 60 /* Serial Interface to RS-EDP ASC1 UART1 */
DavidGilesHitex 0:5b7639d1f2c4 61 Serial UART1(p26, p25); /* Tx,Rx Serial UART0/ASC0 - secondary UART channel */
DavidGilesHitex 0:5b7639d1f2c4 62
DavidGilesHitex 0:5b7639d1f2c4 63
DavidGilesHitex 0:5b7639d1f2c4 64 /* Serial Interface to RS-EDP ASC0 UART0 */
DavidGilesHitex 0:5b7639d1f2c4 65 Serial UART0(p28, p27); /* Tx,Rx Serial UART0/ASC0 - primary UART channel */
DavidGilesHitex 0:5b7639d1f2c4 66
DavidGilesHitex 0:5b7639d1f2c4 67
DavidGilesHitex 0:5b7639d1f2c4 68 /* pin 29 - not configured */
DavidGilesHitex 0:5b7639d1f2c4 69
DavidGilesHitex 0:5b7639d1f2c4 70
DavidGilesHitex 0:5b7639d1f2c4 71 /* Pin29 & Pin30 - used as CAN or general I/O */
DavidGilesHitex 0:5b7639d1f2c4 72 DigitalIn DigitalIn_Pin30(p30);
DavidGilesHitex 0:5b7639d1f2c4 73
DavidGilesHitex 0:5b7639d1f2c4 74
DavidGilesHitex 0:5b7639d1f2c4 75
DavidGilesHitex 0:5b7639d1f2c4 76 /* Configure the USB as a virtual communications port */
DavidGilesHitex 0:5b7639d1f2c4 77 Serial pc(USBTX, USBRX);
DavidGilesHitex 0:5b7639d1f2c4 78
DavidGilesHitex 0:5b7639d1f2c4 79
DavidGilesHitex 0:5b7639d1f2c4 80
DavidGilesHitex 0:5b7639d1f2c4 81
DavidGilesHitex 0:5b7639d1f2c4 82 /* Function Prototypes */
DavidGilesHitex 0:5b7639d1f2c4 83 void setup_mbed_ports(void);
DavidGilesHitex 0:5b7639d1f2c4 84
DavidGilesHitex 0:5b7639d1f2c4 85
DavidGilesHitex 0:5b7639d1f2c4 86
DavidGilesHitex 0:5b7639d1f2c4 87 /* Configure the I/O Ports */
DavidGilesHitex 0:5b7639d1f2c4 88 void setup_mbed_ports(void)
DavidGilesHitex 0:5b7639d1f2c4 89 {
DavidGilesHitex 0:5b7639d1f2c4 90 pc.baud(115000); /* Baud rate should be 115k baud */
DavidGilesHitex 0:5b7639d1f2c4 91 pc.format(8,Serial::None,1); /* format is 8 data bits, no stop bit, no parity */
DavidGilesHitex 0:5b7639d1f2c4 92
DavidGilesHitex 0:5b7639d1f2c4 93 User_Led1 = LED_ON;
DavidGilesHitex 0:5b7639d1f2c4 94 User_Led2 = LED_OFF;
DavidGilesHitex 0:5b7639d1f2c4 95 User_Led3 = LED_ON;
DavidGilesHitex 0:5b7639d1f2c4 96 User_Led4 = LED_OFF;
DavidGilesHitex 0:5b7639d1f2c4 97
DavidGilesHitex 0:5b7639d1f2c4 98 DigitalOut_Pin14 = 0;
DavidGilesHitex 0:5b7639d1f2c4 99 DigitalOut_Pin19 = 1; /* if motor drive fitted set brake to ON */
DavidGilesHitex 0:5b7639d1f2c4 100 DigitalOut_Pin24 = 0;
DavidGilesHitex 0:5b7639d1f2c4 101
DavidGilesHitex 0:5b7639d1f2c4 102 PwmOut_Pin23 = (1.0f); /* if motor drive board fitted set PWM duty to zero */
DavidGilesHitex 0:5b7639d1f2c4 103
DavidGilesHitex 0:5b7639d1f2c4 104 }
DavidGilesHitex 0:5b7639d1f2c4 105
DavidGilesHitex 0:5b7639d1f2c4 106
DavidGilesHitex 0:5b7639d1f2c4 107
DavidGilesHitex 0:5b7639d1f2c4 108
DavidGilesHitex 0:5b7639d1f2c4 109