#ifndef _TUSB_322_H_ #define _TUSB_322_H_ #include "mbed.h" #include "main.h" #define TUSB322_ADDR 0x47 typedef union { struct { uint8_t ACTIVE_CABLE : 1; uint8_t ACCESSORY : 3; uint8_t CURRENT_DETECT : 2; uint8_t CURRENT_ADVERTISE : 2; }; uint8_t AS_BYTE; } CONN_STATUS1; typedef union { struct { uint8_t UFP_ACCESSORY : 1; uint8_t DRP_DUTY_CYCLE : 2; uint8_t VCONN_FAULT : 1; uint8_t INTERRUPT : 1; uint8_t CABLE_DIR : 1; uint8_t ATTACHED_STATE : 2; }; uint8_t AS_BYTE; } CONN_STATUS2; typedef union { struct { uint8_t DISABLE_TERM : 1; uint8_t SOURCE_PERF : 2; uint8_t RESET : 1; uint8_t MODE_SELECT : 2; uint8_t DEBOUNCE : 2; }; uint8_t AS_BYTE; } CTRL; typedef union { struct { uint8_t ID[8]; // +0x00 CONN_STATUS1 Status1; // +0x08 CONN_STATUS2 Status2; // +0x09 CTRL Control; // +0x0A }; uint8_t AS_BYTE[11]; } TUSB322_REGS; void TUSB322_Init(void); #endif