VoxelUSBProgrammer.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * TI Voxel Lib component.
  3. *
  4. * Copyright (c) 2014 Texas Instruments Inc.
  5. */
  6. #ifndef VOXEL_TI_VOXEL_USB_PROGRAMMER_H
  7. #define VOXEL_TI_VOXEL_USB_PROGRAMMER_H
  8. #include "USBIO.h"
  9. #include "VoxelProgrammerBase.h"
  10. namespace Voxel
  11. {
  12. namespace TI
  13. {
  14. class TI3DTOF_EXPORT VoxelUSBProgrammer: public VoxelProgrammerBase
  15. {
  16. public:
  17. struct RequestParams
  18. {
  19. uint8_t readRequestCode, writeRequestCode;
  20. uint8_t leftShiftBits;
  21. };
  22. typedef Map<uint, RequestParams> SlaveAddressToRequestParamsMap;
  23. protected:
  24. USBIOPtr _usbIO;
  25. SlaveAddressToRequestParamsMap _slaveAddressToRequestParamsMap;
  26. virtual bool _readRegister(uint16_t slaveAddress, uint16_t registerAddress, uint32_t &value, uint8_t length) const;
  27. virtual bool _writeRegister(uint16_t slaveAddress, uint16_t registerAddress, uint32_t value, uint8_t length);
  28. public:
  29. VoxelUSBProgrammer(const SlaveAddressToByteMap &map, const SlaveAddressToRequestParamsMap &slaveAddressToRequestParamsMap, USBIOPtr &usbIO, DevicePtr device);
  30. virtual bool isInitialized() const;
  31. virtual bool reset();
  32. inline USBIOPtr &getUSBIO() { return _usbIO; }
  33. virtual ~VoxelUSBProgrammer() {}
  34. };
  35. }
  36. }
  37. #endif // VOXEL_TI_VOXELXU_PROGRAMMER_H