/* ==================================================================================
File name:      F280XHALL3_GPIO.H                     
Target	 : 		F2803x family             
=====================================================================================

-------------------------------------------------------------------------------------
 Hall logics are always read, not only when Hall edges are detected. 
 All Hall bits are also read at once instead of individual Hall bit be read. 
 This Hall drive use GPIOs only for Piccolo instead of eCAP
-----------------------------------------------------------------------------------*/

#ifndef __F2803X_HALL3_GPIO_STRUCT_H__
#define __F2803X_HALL3_GPIO_STRUCT_H__




typedef struct { Uint16 CmtnTrigHall;    // Output: Commutation trigger for Mod6cnt input (0 or 0x7FFF)
                 Uint16 CapCounter;      // Variable: Running count of detected edges on ECAP1,2,3
                 Uint16 DebounceCount;   // Variable: Counter/debounce delay current value
                 Uint16 DebounceAmount;  // Parameter: Counter delay amount to validate/debounce GPIO readings
                 Uint16 HallGpio;        // Variable: Most recent logic level on ECAP/GPIO
                 Uint16 HallGpioBuffer;  // Variable: Buffer of last logic level on ECAP/GPIO while being debounced
                 Uint16 HallGpioAccepted;// Variable: Debounced logic level on ECAP/GPIO
                 Uint16 EdgeDebounced;   // Variable: Trigger from Debounce function to Hall_Drv, if = 0x7FFF edge is debounced
                 Uint16 HallMap[6];      // Variable: ECAP/GPIO logic levels for HallMapPointer = 0-5
                 Uint16 CapFlag;         // Variable: ECAP flags, indicating which ECAP detected the edge
                 Uint16 StallCount;      // Variable: If motor stalls, this counter overflow triggers 
                                         // commutation to start rotation. Rotation is defined as
                                         // an edge detection of a hall signal.
                 Uint16 HallMapPointer;  // Input/Output (see note below): During hall map creation, this variable points to the 
                                         // current commutation state.  After map creation, it 
                                         // points to the next commutation state.
                 int16 Revolutions;      // Parameter: Running counter, with a revolution defined as 1-cycle 
                                         // of the 6 hall states
                 Uint16 Stall_status; //一个hall状态呆了足够长的时间
} HALL3;


#endif // __F2803X_HALL3_H__ 






