Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. void get_bricklet_plugin(uint8_t com, const GetBrickletPlugin *data) {
  2. // TODO: select port
  3.  
  4. const uint16_t length = i2c_eeprom_master_read_plugin_length(TWI1);
  5.  
  6. const uint16_t plugin_length = length + sizeof(GetBrickletPluginReturn);
  7.  
  8. GetBrickletPluginReturn gbpr = {
  9. data->stack_address,
  10. TYPE_GET_BRICKLET_PLUGIN,
  11. plugin_length,
  12. length
  13. };
  14.  
  15. uint8_t plugin[plugin_length];
  16.  
  17. memcpy(plugin, &gbpr, sizeof(GetBrickletPluginReturn));
  18.  
  19. i2c_eeprom_master_read_plugin(TWI1,
  20. plugin + sizeof(GetBrickletPluginReturn),
  21. length);
  22.  
  23. send_blocking_with_timeout(plugin, plugin_length, com);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement