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 /* MBED Module - RS-EDP Platform */
DavidGilesHitex 0:5b7639d1f2c4 2 /* ***************************** */
DavidGilesHitex 0:5b7639d1f2c4 3
DavidGilesHitex 0:5b7639d1f2c4 4 #include "mbed.h"
DavidGilesHitex 0:5b7639d1f2c4 5 #include "RSEDP_Mbed_Complete.h"
DavidGilesHitex 0:5b7639d1f2c4 6
DavidGilesHitex 0:5b7639d1f2c4 7
DavidGilesHitex 0:5b7639d1f2c4 8
DavidGilesHitex 0:5b7639d1f2c4 9
DavidGilesHitex 0:5b7639d1f2c4 10 /* Main Loop Here */
DavidGilesHitex 0:5b7639d1f2c4 11 int main(void)
DavidGilesHitex 0:5b7639d1f2c4 12 {
DavidGilesHitex 0:5b7639d1f2c4 13
DavidGilesHitex 0:5b7639d1f2c4 14 setup_mbed_ports(); /* Setup the I/O Structure of the mbed module */
DavidGilesHitex 0:5b7639d1f2c4 15 pc.printf("\n\n\n\n\n\n\n\rWelcome the the MBED LPC1768 Developers Module\n\r");
DavidGilesHitex 0:5b7639d1f2c4 16 pc.printf("Using the RS-EDP Development Platform hardware\n\r");
DavidGilesHitex 0:5b7639d1f2c4 17 pc.printf("Software Revision Number: %d\n\r\n", FIRMWARE_VERSION);
DavidGilesHitex 0:5b7639d1f2c4 18
DavidGilesHitex 0:5b7639d1f2c4 19
DavidGilesHitex 0:5b7639d1f2c4 20 /* mbed Setup */
DavidGilesHitex 0:5b7639d1f2c4 21 pc.printf("\nMbed Module setup...\n\r");
DavidGilesHitex 0:5b7639d1f2c4 22 pc.printf(" Setting up the CNTRL SPI for Master mode\n\r");
DavidGilesHitex 0:5b7639d1f2c4 23 setup_CNTRL_SPI_Master_Mode(); /* SPI setup */
DavidGilesHitex 0:5b7639d1f2c4 24 pc.printf(" Setting up the CNTRL I2C for Master mode\n\r");
DavidGilesHitex 0:5b7639d1f2c4 25 setup_CNTRL_I2C_Master_Mode(); /* Main CNTRL I2C control channel */
DavidGilesHitex 0:5b7639d1f2c4 26 pc.printf(" Setting up the ASC0, UART0 Serial Channel\n\r");
DavidGilesHitex 0:5b7639d1f2c4 27 setup_UART0(); /* Standard UART */
DavidGilesHitex 0:5b7639d1f2c4 28 pc.printf(" Setting up the ASC1, UART1 Serial Channel\n\r");
DavidGilesHitex 0:5b7639d1f2c4 29 setup_UART1(); /* Additional UART */
DavidGilesHitex 0:5b7639d1f2c4 30
DavidGilesHitex 0:5b7639d1f2c4 31
DavidGilesHitex 0:5b7639d1f2c4 32 /* Base Board Configuration & setup */
DavidGilesHitex 0:5b7639d1f2c4 33 pc.printf("\nBase Board setup...\n\r");
DavidGilesHitex 0:5b7639d1f2c4 34 pc.printf(" Setting up the 24LC32 Serial EEPROM\n\r");
DavidGilesHitex 0:5b7639d1f2c4 35 RSEDP_BB_setup_24LC32(M24C32_BASE_BOARD); /* Setup the Serial EEPROM device on the base board */
DavidGilesHitex 0:5b7639d1f2c4 36 pc.printf(" Setting up the PCA9675 Serial Latch For reading the DIP Switches\n\r");
DavidGilesHitex 0:5b7639d1f2c4 37 // RSEDP_BB_setup_PCA9675(PCA9675_BASE_BOARD); /* Setup the Serial Latch on the base board */
DavidGilesHitex 0:5b7639d1f2c4 38
DavidGilesHitex 0:5b7639d1f2c4 39 if (COMMS_MODULE_FITTED == YES)
DavidGilesHitex 0:5b7639d1f2c4 40 {
DavidGilesHitex 0:5b7639d1f2c4 41 /* Communications module Setup */
DavidGilesHitex 0:5b7639d1f2c4 42 pc.printf("\nCommunications Board setup...\n\r");
DavidGilesHitex 0:5b7639d1f2c4 43 pc.printf(" Setting up the serial PCF8583 Real Time Clock IC\n\r");
DavidGilesHitex 0:5b7639d1f2c4 44 RSEDP_COM_setup_PCF8583(PCF8583_COMMS_MODULE,'C'); /* Setup the Real Time Clock for Clock mode on the Comms Module */
DavidGilesHitex 0:5b7639d1f2c4 45 }
DavidGilesHitex 0:5b7639d1f2c4 46
DavidGilesHitex 0:5b7639d1f2c4 47 if (DIGITAL_IO_MODULE_FITTED == YES)
DavidGilesHitex 0:5b7639d1f2c4 48 {
DavidGilesHitex 0:5b7639d1f2c4 49 /* Digital I/O module Setup */
DavidGilesHitex 0:5b7639d1f2c4 50 pc.printf("\nDigital I/O Module setup...\n\r");
DavidGilesHitex 0:5b7639d1f2c4 51 pc.printf(" Setting up the serial PCA9555 Digital Output Expander\n\r");
DavidGilesHitex 0:5b7639d1f2c4 52 RSEDP_DIO_setup_PCA9555(PCA9555_DIGITAL_IO_OUT, 0xff,0xff); /* Setup the Serial digital output latch on the digital I/O board */
DavidGilesHitex 0:5b7639d1f2c4 53 pc.printf(" Setting up the serial PCA9555 Digital Input Expander\n\r"); /* setup the serial digital input latch */
DavidGilesHitex 0:5b7639d1f2c4 54 RSEDP_DIO_setup_PCA9555(PCA9555_DIGITAL_IO_IN, 0xff,0xff); /* Setup the Serial I/O Expander on the digital I/O Board */
DavidGilesHitex 0:5b7639d1f2c4 55 }
DavidGilesHitex 0:5b7639d1f2c4 56
DavidGilesHitex 0:5b7639d1f2c4 57 if (ANALOGUE_MODULE_FITTED == YES)
DavidGilesHitex 0:5b7639d1f2c4 58 {
DavidGilesHitex 0:5b7639d1f2c4 59 /* Analogue Module setup */
DavidGilesHitex 0:5b7639d1f2c4 60 pc.printf("\nAnalogue Module setup...\n\r");
DavidGilesHitex 0:5b7639d1f2c4 61 pc.printf(" Setting up the ADC5263 serial Digital Potentiometer\n\r"); /* Digital Pot used in the input filter */
DavidGilesHitex 0:5b7639d1f2c4 62 RSEDP_AM_Init_AD5263(AD5263_ANALOGUE_DIGITAL_POT);
DavidGilesHitex 0:5b7639d1f2c4 63 pc.printf(" Setting up the MAX1x3x serial ADC\n\r"); /* Serial ADC Convter IC */
DavidGilesHitex 0:5b7639d1f2c4 64 RSEDP_AM_Init_MAX1x3x(MAX1X3X_ANALOGUE_ADC) ;
DavidGilesHitex 0:5b7639d1f2c4 65 }
DavidGilesHitex 0:5b7639d1f2c4 66
DavidGilesHitex 0:5b7639d1f2c4 67 if (MOTOR_MC1_MODULE_FITTED == YES)
DavidGilesHitex 0:5b7639d1f2c4 68 {
DavidGilesHitex 0:5b7639d1f2c4 69 /* Brushed DC MC1 Module Drive Module setup */
DavidGilesHitex 0:5b7639d1f2c4 70 pc.printf("\nMC1 Brushed DC Motor Drive Module setup...\n\r");
DavidGilesHitex 0:5b7639d1f2c4 71 pc.printf(" Setting up the PWM\n\r"); /* Set the PWM frequency */
DavidGilesHitex 0:5b7639d1f2c4 72 RSEDP_MC1_Setup();
DavidGilesHitex 0:5b7639d1f2c4 73 }
DavidGilesHitex 0:5b7639d1f2c4 74
DavidGilesHitex 0:5b7639d1f2c4 75 RSEDP_test_all(); /* Run the test and diagnostic facility for the board */
DavidGilesHitex 0:5b7639d1f2c4 76
DavidGilesHitex 0:5b7639d1f2c4 77
DavidGilesHitex 0:5b7639d1f2c4 78
DavidGilesHitex 0:5b7639d1f2c4 79 /* never get here */
DavidGilesHitex 0:5b7639d1f2c4 80 while(1)
DavidGilesHitex 0:5b7639d1f2c4 81 {
DavidGilesHitex 0:5b7639d1f2c4 82 ;
DavidGilesHitex 0:5b7639d1f2c4 83 }
DavidGilesHitex 0:5b7639d1f2c4 84 }
DavidGilesHitex 0:5b7639d1f2c4 85
DavidGilesHitex 0:5b7639d1f2c4 86
DavidGilesHitex 0:5b7639d1f2c4 87