tusb322.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef _TUSB_322_H_
  2. #define _TUSB_322_H_
  3. #include "mbed.h"
  4. #define TUSB322_ADDR 0x47
  5. typedef union {
  6. struct {
  7. uint8_t ACTIVE_CABLE : 1;
  8. uint8_t ACCESSORY : 3;
  9. uint8_t CURRENT_DETECT : 2;
  10. uint8_t CURRENT_ADVERTISE : 2;
  11. };
  12. uint8_t AS_BYTE;
  13. } CONN_STATUS1;
  14. typedef union {
  15. struct {
  16. uint8_t UFP_ACCESSORY : 1;
  17. uint8_t DRP_DUTY_CYCLE : 2;
  18. uint8_t VCONN_FAULT : 1;
  19. uint8_t INTERRUPT : 1;
  20. uint8_t CABLE_DIR : 1;
  21. uint8_t ATTACHED_STATE : 2;
  22. };
  23. uint8_t AS_BYTE;
  24. } CONN_STATUS2;
  25. typedef union {
  26. struct {
  27. uint8_t DISABLE_TERM : 1;
  28. uint8_t SOURCE_PERF : 2;
  29. uint8_t RESET : 1;
  30. uint8_t MODE_SELECT : 2;
  31. uint8_t DEBOUNCE : 2;
  32. };
  33. uint8_t AS_BYTE;
  34. } CTRL;
  35. typedef union {
  36. struct {
  37. uint8_t ID[8]; // +0x00
  38. CONN_STATUS1 Status1; // +0x08
  39. CONN_STATUS2 Status2; // +0x09
  40. CTRL Control; // +0x0A
  41. };
  42. uint8_t AS_BYTE[11];
  43. } TUSB322_REGS;
  44. #endif