Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 1:f0126d924ff8
- Parent:
- 0:45ec5ead6731
- Child:
- 2:6d65d24e55ed
diff -r 45ec5ead6731 -r f0126d924ff8 main.cpp --- a/main.cpp Tue Jul 13 07:20:21 2021 +0000 +++ b/main.cpp Tue Jul 13 08:34:17 2021 +0000 @@ -1,14 +1,9 @@ #include "mbed.h" +#include "SC18IS606.h" I2C i2c( p28, p27 ); -InterruptIn int_signal( p21 ); - - -#define TARG_ADDRESS 0x50 -#define FuncID_WRITE_BUFFER 0x00 -#define FuncID_ClearIntrrupt 0xF1 - -#define SS_BITMAP 0x01 +InterruptIn int_line( p21 ); +SC18IS606 bridge( i2c ); volatile int int_flag = false; @@ -19,27 +14,25 @@ int main() { - char s[ 256 + 1 ]; - char int_clear = FuncID_ClearIntrrupt; - - int_signal.mode( PullUp ); - int_signal.fall( &int_handler ); + int_line.mode( PullUp ); + int_line.fall( &int_handler ); i2c.frequency( 400 * 1000 ); - s[ 0 ] = FuncID_WRITE_BUFFER | SS_BITMAP; + s[ 256 ] for ( int i = 0; i < 256; i++ ) { - *(s + i + 1) = i; + s[ i ] = i; } - while(1) { - i2c.write( TARG_ADDRESS, s, sizeof( s ) ); + bridge.transfer( s, NULL, sizeof( s ) ); while ( !int_flag ) ; - i2c.write( TARG_ADDRESS, &int_clear, sizeof( int_clear ) ); +// i2c.write( TARG_ADDRESS, &int_clear, sizeof( int_clear ) ); + char dummy; + bridge.config( Clear_Interrupt, dummy ); int_flag = false; wait_ms( 2 );