test code

Dependencies:   mbed SC18IS606

Sample code for SC18IS606 class library

The SC18IS606 : I2C-bus to SPI bridge

Hello program operation sample on Mbed OS6 is available.

Import programSC18IS606_OS6_Hello

operation test on Mbed OS6

This is a "Hello" code for SC18IS606 class library. Showing how to send/receive data to/from SPI bus through this bridge chip. https://os.mbed.com/media/uploads/okano/screenshot_2021-07-14_13.13.55.png

How to wire the SC18IS606 (using evaluation board) https://os.mbed.com/media/uploads/okano/untitled.png

Revision:
2:6d65d24e55ed
Parent:
1:f0126d924ff8
Child:
4:2759b8e6d5ec
--- a/main.cpp	Tue Jul 13 08:34:17 2021 +0000
+++ b/main.cpp	Tue Jul 13 10:46:24 2021 +0000
@@ -1,3 +1,14 @@
+/*
+ *  SC18IS606 library
+ *
+ *  @author     Akifumi (Tedd) OKANO, NXP Semiconductors
+ *  @version    0.1
+ *  @date       13-July-2021
+ *
+ *  SC18IS606 is an "I2C-bus to SPI bridge"
+ *  http://www.nxp.com/ (product infomation page will be updated later)
+ */
+
 #include "mbed.h"
 #include "SC18IS606.h"
 
@@ -5,6 +16,8 @@
 InterruptIn int_line( p21 );
 SC18IS606   bridge( i2c );
 
+#define WAIT_INTERVAL_mS    2
+
 volatile int    int_flag    = false;
 
 void int_handler()
@@ -14,11 +27,13 @@
 
 int main()
 {
+    printf( "SC18IS606 Hello\r\n" );
+    
     int_line.mode( PullUp );
     int_line.fall( &int_handler );
     i2c.frequency( 400 * 1000 );
 
-    s[ 256 ]
+    char    s[ 256 ];
 
     for ( int i = 0; i < 256; i++ ) {
         s[ i ]  = i;
@@ -30,11 +45,9 @@
         while ( !int_flag )
             ;
             
-//        i2c.write( TARG_ADDRESS, &int_clear, sizeof( int_clear ) );
-        char    dummy;
-        bridge.config( Clear_Interrupt, dummy );
+        bridge.clear_interrupt();
         int_flag    = false;
 
-        wait_ms( 2 );
+        wait_ms( WAIT_INTERVAL_mS );
     }
 }