Testsoftware for SC16IS750
Dependencies: SC16IS750 USBDevice mbed
Fork of SC16IS750_Test by
Diff: main.cpp
- Revision:
- 6:b3a16b127073
- Parent:
- 5:c75ddfd44ae3
--- a/main.cpp Mon Dec 22 19:16:45 2014 +0000 +++ b/main.cpp Wed Dec 24 08:30:30 2014 +0000 @@ -54,23 +54,35 @@ //SPI Version -SPI spi(D_MOSI, D_MISO, D_SCLK); //MOSI, MISO, SCK +//SPI spi(D_MOSI, D_MISO, D_SCLK); //MOSI, MISO, SCK //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 +//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); +#define DEFAULT_SC16IS750_ADDR 0x4D +#define I2C_FREQ 100000 +I2C i2c(I2C_SDA, I2C_SCL); +SC16IS750_I2C serial_bridge(&i2c, DEFAULT_SC16IS750_ADDR); //SC16IS750_I2C serial_bridge(&i2c, DEFAULT_SC16IS750_ADDR, D_RST); -DigitalOut myled1(LED_RED); +//DigitalOut myled1(LED_RED); //DigitalOut myled2(LED_GREEN); //DigitalOut myled3(LED_BLUE); // Same as PTD1 (SCK) -DigitalOut heartbeatLED(LED_GREEN); +//DigitalOut heartbeatLED(LED_GREEN); -Serial pc(D_TX,D_RX); +//Serial pc(D_TX,D_RX); +#define DEBUG + +#ifdef DEBUG +#include "USBSerial.h" // To use USB virtual serial, a driver is needed, check http://mbed.org/handbook/USBSerial +#define LOG(args...) pc.printf(args) +USBSerial pc; +#else +#define LOG(args...) +#endif void show_menu() { pc.printf("0: Exit\n\r"); @@ -108,7 +120,7 @@ // Heartbeat monitor void pulse() { - heartbeatLED = !heartbeatLED; + //heartbeatLED = !heartbeatLED; } void heartbeat_start() { @@ -139,7 +151,7 @@ heartbeat_start(); - myled1 = 1; // LED Off + //myled1 = 1; // LED Off // We need to enable flow control or we overflow buffers and // lose data when used with the WiFly. Note that flow control