test version 0.2
Dependents: SC18IS606_Hello SC18IS606_EEPROM_access_test SC18IS606_OS6_Hello
Diff: SC18IS606.cpp
- Revision:
- 2:4e64923032ad
- Parent:
- 1:b44f801ac9f2
- Child:
- 3:47f1f22747cc
--- a/SC18IS606.cpp Tue Jul 13 10:45:46 2021 +0000 +++ b/SC18IS606.cpp Wed Jul 14 03:00:18 2021 +0000 @@ -35,24 +35,27 @@ return 0; // dummy } - -int SC18IS606::transfer( char *send_data_ptr, char *receive_data_ptr, int length ) +int SC18IS606::transfer( int slave_select_num, char *send_data_ptr, int length ) { char *p; p = new char[ length + 1 ]; - *p = SPI_read_and_write; + *p = SPI_read_and_write | (0x1 << slave_select_num); memcpy( p + 1, send_data_ptr, length ); i2c.write( device_address, p, length + 1 ); delete[] p; - + + return 0; // dummy +} + +int SC18IS606::read_buffer( char *receive_data_ptr, int length ) +{ if ( receive_data_ptr ) i2c.read( device_address, receive_data_ptr, length ); return 0; // dummy } - int SC18IS606::config( FunctionID fid, char data ) { char s[ 2 ]; @@ -70,3 +73,12 @@ return 0; // dummy } + +#if 0 +void SC18IS606::wait_transfer_done( void ) +{ + char func_id = 0x01; + while ( i2c.write( device_address, &func_id, 1 ) ) + ; +} +#endif