Wim Huiskamp
/
SC16IS750_Test
Testsoftware for SC16IS750
main.cpp
- Committer:
- wim
- Date:
- 2014-01-22
- Revision:
- 0:d83a90125711
- Child:
- 1:f0d3984f2586
File content as of revision 0:d83a90125711:
#include "mbed.h" #include "SC16IS750.h" //SPI Version SPI spi(PTD2, PTD3, PTD1); //MOSI, MISO, SCK //DigitalOut CS(PTD0); //CS SC16IS750_SPI serial_spi(&spi, PTD0); //I2C Version I2C i2c(PTE0, PTE1); //SDA, SCL SC16IS750_I2C serial_i2c(&i2c, DEFAULT_SC16IS750_ADDR); DigitalOut myled1(LED_RED); DigitalOut myled2(LED_GREEN); //DigitalOut myled3(LED_BLUE); //same as PTD1 (SCK) Serial pc(USBTX,USBRX); int main() { pc.printf("\nHello World!\n"); myled1 = 1; // LED Off // CS = 1; spi.format(8, 0); // spi.frequency(100000); // spi.frequency(500000); spi.frequency(1000000); // spi.frequency(1500000); while(1) { // serial_spi.writeRegister(SC16IS750::IODIR, 0x81); // direct call to new method serial_spi.ioSetState(0x00); // indirect call to new method // wait(0.5); pc.putc('*'); } #if(0) while(1) { CS=0; spi.write(0xAA); spi.write(0x81); CS=1; wait_us(5); } #endif pc.printf("\nBye World!\n"); }