Exemplo n.º 1
0
 bool read_data(boost::system::error_code & ec)
 {
     if(context_.check_wc<false>(MSG_DATA, ec))
     {
         return write_ack(ec);
     }
     return false;
 }
Exemplo n.º 2
0
 /// read from a connected I2C slave device
 //
 /// This function reads n bytes of data from the device with address a
 /// that is connected to the I2C bus.
 void read( fast_byte a, byte data[], fast_byte n ) override {
    write_start();
    write_byte( ( a << 1 ) | 0x01 );    
    read_ack();
    for( fast_byte i = 0; i < n; i++ ){
       if( i > 0 ){
          write_ack();
       }   
       data[ i ] = read_byte();
    }               
    write_stop();      
 }