test version 0.2

Dependents:   SC18IS606_Hello SC18IS606_EEPROM_access_test SC18IS606_OS6_Hello

Files at this revision

API Documentation at this revision

Comitter:
okano
Date:
Sun Jul 25 08:30:08 2021 +0000
Parent:
3:47f1f22747cc
Child:
5:436b2c7854e8
Commit message:
transfer complete wait function implemented

Changed in this revision

SC18IS606.cpp Show annotated file Show diff for this revision Revisions of this file
SC18IS606.h Show annotated file Show diff for this revision Revisions of this file
--- a/SC18IS606.cpp	Fri Jul 23 05:06:06 2021 +0000
+++ b/SC18IS606.cpp	Sun Jul 25 08:30:08 2021 +0000
@@ -32,6 +32,9 @@
 
 int SC18IS606::init( void )
 {
+    wait_transfer_completion    = NULL;
+    clear_interrupt();
+    
     return 0;   //  dummy
 }
 
@@ -44,6 +47,9 @@
     memcpy( p + 1, send_data_ptr, length );
     i2c.write( device_address, p, length + 1 );
     delete[]    p;
+    
+    if ( NULL != wait_transfer_completion )
+        (*wait_transfer_completion)();
 
     return 0;   //  dummy
 }
--- a/SC18IS606.h	Fri Jul 23 05:06:06 2021 +0000
+++ b/SC18IS606.h	Sun Jul 25 08:30:08 2021 +0000
@@ -58,6 +58,11 @@
      */
     ~SC18IS606();
 
+    void install_wait_func( void (*block)( void ) )
+    {
+        wait_transfer_completion    = block;
+        }
+
     /** Transfer (send data)
      *
      *  @param slave_select_num SPI slave select number (0 ~ 2)
@@ -94,11 +99,12 @@
         DEFAULT_I2C_SLAVE_ADDRESS   = 0x50
     };
 
-    int     init( void );
+    int     init( void);
 
     I2C     *i2c_p;
     I2C     &i2c;
     char    device_address;
+    void    (*wait_transfer_completion)( void );
 };
 
 #endif  // end of "#ifndef MBED_SC18IS606"