Guest User

Untitled

a guest
Dec 13th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. /* first send the master write cmd to slave */
  2. master_write_req = MASTER_WRITE_CMD;
  3.  
  4. hal_i2c_master_tx(&i2c_handle,SLAVE_ADDRESS_WRITE,(uint8_t*)&master_write_req,1);
  5. while(i2c_handle.State != HAL_I2C_STATE_READY);
  6.  
  7. master_write_req = WRITE_LEN;
  8. /* Now send the number of bytes to be written */
  9. hal_i2c_master_tx(&i2c_handle,SLAVE_ADDRESS_WRITE,(uint8_t*)&master_write_req,1);
  10.  
  11. while(i2c_handle.State != HAL_I2C_STATE_READY);
  12.  
  13. /* NOW send the data stream */
  14. hal_i2c_master_tx(&i2c_handle,SLAVE_ADDRESS_WRITE,master_tx_buffer,WRITE_LEN);
  15.  
  16. while(i2c_handle.State != HAL_I2C_STATE_READY);
Add Comment
Please, Sign In to add comment