tusb322.h 1.1 KB

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