Wim Huiskamp
/
SC16IS750_Test
Testsoftware for SC16IS750
Diff: main.cpp
- Revision:
- 4:c75ddfd44ae3
- Parent:
- 3:3d4269319b51
diff -r 3d4269319b51 -r c75ddfd44ae3 main.cpp --- a/main.cpp Thu Feb 20 19:45:33 2014 +0000 +++ b/main.cpp Mon Dec 22 19:16:45 2014 +0000 @@ -9,6 +9,7 @@ #define D_SCLK p7 #define D_CS p8 #define D_INTR p15 +#define D_RST p16 // Serial for LPC1768 #define D_TX USBTX @@ -23,7 +24,8 @@ #define D_MISO PTD3 #define D_SCLK PTD1 #define D_CS PTD0 -//#define D_INTR p15 +//#define D_INTR PTA13 +#define D_RST PTD5 // I2C for KL25Z #define D_SCL PTE1 @@ -41,6 +43,7 @@ #define D_SCLK P0_12 #define D_CS P0_13 //#define D_INTR P0_7 +//#define D_RST P0_8 // Serial for LPC812 #define D_TX P0_4 @@ -51,15 +54,16 @@ //SPI Version -//SPI spi(PTD2, PTD3, PTD1); //MOSI, MISO, SCK SPI spi(D_MOSI, D_MISO, D_SCLK); //MOSI, MISO, SCK -//DigitalOut CS(PTD0); //CS -//SC16IS750_SPI serial_bridge(&spi, PTD0); -SC16IS750_SPI serial_bridge(&spi, D_CS); +//SC16IS750_SPI serial_bridge(&spi, D_CS); +//SC16IS750_SPI serial_bridge(&spi, D_CS, D_RST); // version with Hardware Reset pin +SC16IS752_SPI serial_bridge(&spi, D_CS, D_RST, SC16IS750::Channel_A); // Dual UART version with Hardware Reset pin +SC16IS752_SPI serial_bridge_B(&spi, D_CS, D_RST, SC16IS750::Channel_B); // Dual UART version with Hardware Reset pin //I2C Version //I2C i2c(D_SDA, D_SCL); //SDA, SCL //SC16IS750_I2C serial_bridge(&i2c, DEFAULT_SC16IS750_ADDR); +//SC16IS750_I2C serial_bridge(&i2c, DEFAULT_SC16IS750_ADDR, D_RST); DigitalOut myled1(LED_RED); //DigitalOut myled2(LED_GREEN); @@ -165,7 +169,10 @@ break; case '2' : - pc.printf("Init\n\r"); + pc.printf("Hardware Reset\n\r"); + serial_bridge.hwReset(); //test + + pc.printf("Init\n\r"); serial_bridge._init(); break; @@ -284,31 +291,6 @@ } //switch } //if } //while - - - - -#if(0) - - -// CS = 1; - - spi.format(8, 0); -// spi.frequency(100000); -// spi.frequency(500000); - spi.frequency(1000000); -// spi.frequency(1500000); - - - - while(1) { - CS=0; - spi.write(0xAA); - spi.write(0x81); - CS=1; - wait_us(5); - } -#endif - + pc.printf("\nBye World!\n"); }