Universal Translator

Dependencies:   EthernetNetIf TextLCD mbed PS2 HTTPClient

Committer:
benglish6
Date:
Mon Feb 28 17:37:46 2011 +0000
Revision:
1:5ae213418d04
Parent:
0:c69af1faeb95

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
benglish6 0:c69af1faeb95 1 #include "mbed.h"
benglish6 0:c69af1faeb95 2 #include "UnivTrans.h"
benglish6 0:c69af1faeb95 3
benglish6 0:c69af1faeb95 4 TextLCD lcd(p14, p16, p17, p18, p19, p20); // rs, e, d4-d7
benglish6 0:c69af1faeb95 5 DigitalOut led1(LED1);
benglish6 0:c69af1faeb95 6 DigitalOut led2(LED2);
benglish6 0:c69af1faeb95 7 DigitalOut led3(LED3);
benglish6 0:c69af1faeb95 8 DigitalOut led4(LED4);
benglish6 0:c69af1faeb95 9
benglish6 0:c69af1faeb95 10 EthernetNetIf eth; // Ethernet Control
benglish6 0:c69af1faeb95 11 HTTPClient http; // HTTP Client Stack Library
benglish6 0:c69af1faeb95 12
benglish6 0:c69af1faeb95 13 VS1002 mp3( // Initialize MP3 Hardware Decoder class
benglish6 0:c69af1faeb95 14 p5, p6, p7, p8, "sd", // SD Card SPI Connections & Setup
benglish6 0:c69af1faeb95 15 p11, p12, p13, p10, // VS1053/1002 SPI Connections
benglish6 0:c69af1faeb95 16 p21, p22, p23, p15); // DREQ,DCS,VOL
benglish6 0:c69af1faeb95 17 // Due to the current TextLCD setup, the only Analog pin
benglish6 0:c69af1faeb95 18 // available is p15, thus it is used for volume control
benglish6 0:c69af1faeb95 19
benglish6 0:c69af1faeb95 20 int main() {
benglish6 0:c69af1faeb95 21 Serial pc(USBTX, USBRX);
benglish6 0:c69af1faeb95 22 PS2Keyboard KeyB(p29, p30); // CLK, DAT
benglish6 0:c69af1faeb95 23 Ticker tm; // Controls Blinking of LEDs/consistent ops
benglish6 0:c69af1faeb95 24
benglish6 0:c69af1faeb95 25 // Start Setting Up Hardware
benglish6 0:c69af1faeb95 26 printf("Setting up...\n");
benglish6 0:c69af1faeb95 27 EthernetErr ethErr = eth.setup();
benglish6 0:c69af1faeb95 28 if(ethErr) {
benglish6 0:c69af1faeb95 29 printf("Error %d in setup.\n", ethErr);
benglish6 0:c69af1faeb95 30 return -1;
benglish6 0:c69af1faeb95 31 }
benglish6 0:c69af1faeb95 32 printf("Setup OK\n");
benglish6 0:c69af1faeb95 33
benglish6 0:c69af1faeb95 34 // Initialize MP3 Hardware
benglish6 0:c69af1faeb95 35 #ifndef FS_ONLY
benglish6 0:c69af1faeb95 36 mp3._RST = 1;
benglish6 0:c69af1faeb95 37 mp3.cs_high(); //chip disabled
benglish6 0:c69af1faeb95 38 mp3.sci_initialise(); //initialise MBED
benglish6 0:c69af1faeb95 39 mp3.sci_write(0x00,(SM_SDINEW+SM_STREAM+SM_DIFF));
benglish6 0:c69af1faeb95 40 mp3.sci_write(0x03, 0x9800);
benglish6 0:c69af1faeb95 41 mp3.sdi_initialise();
benglish6 0:c69af1faeb95 42 #endif
benglish6 0:c69af1faeb95 43
benglish6 0:c69af1faeb95 44 //Blink now to signal successful hardware/internet setup
benglish6 0:c69af1faeb95 45 tm.attach(&blink,.5);
benglish6 0:c69af1faeb95 46
benglish6 0:c69af1faeb95 47 //Now let's get to the real code
benglish6 0:c69af1faeb95 48
benglish6 0:c69af1faeb95 49 char rowstring[6*16];
benglish6 0:c69af1faeb95 50 memset(rowstring,0,6*16);
benglish6 0:c69af1faeb95 51
benglish6 0:c69af1faeb95 52 while(true){
benglish6 0:c69af1faeb95 53 checkKeys(KeyB,rowstring);
benglish6 0:c69af1faeb95 54 Net::poll();
benglish6 0:c69af1faeb95 55 }
benglish6 0:c69af1faeb95 56
benglish6 0:c69af1faeb95 57 return 0;
benglish6 0:c69af1faeb95 58 }