MotorWare f2806x Driver API Documentation
Data Structures | Macros | Typedefs | Enumerations | Functions
COMP

Data Structures

struct  _COMP_Obj_
 Defines the comparator (COMP) object. More...
 

Macros

#define COMP1_BASE_ADDR   (0x00006400)
 Defines the base address of the comparator (COMP) registers. More...
 
#define COMP2_BASE_ADDR   (0x00006420)
 Defines the base address of the comparator (COMP) registers. More...
 
#define COMP3_BASE_ADDR   (0x00006440)
 Defines the base address of the comparator (COMP) registers. More...
 
#define COMP_COMPCTL_COMPDACE_BITS   (1 << 0)
 Defines the location of the COMPDACE bits in the COMPCTL register. More...
 
#define COMP_COMPCTL_COMPSOURCE_BITS   (1 << 1)
 Defines the location of the COMPSOURCE bits in the COMPCTL register. More...
 
#define COMP_COMPCTL_CMPINV_BITS   (1 << 2)
 Defines the location of the CMPINV bits in the COMPCTL register. More...
 
#define COMP_COMPCTL_QUALSEL_BITS   (31 << 3)
 Defines the location of the QUALSEL bits in the COMPCTL register. More...
 
#define COMP_COMPCTL_SYNCSEL_BITS   (1 << 8)
 Defines the location of the SYNCSEL bits in the COMPCTL register. More...
 
#define COMP_COMPSTS_COMPSTS_BITS   (1 << 0)
 Defines the location of the COMPSTS bits in the COMPSTS register. More...
 
#define COMP_DACCTL_DACSOURCE_BITS   (1 << 0)
 Defines the location of the DACSOURCE bits in the DACCTL register. More...
 
#define COMP_DACCTL_RAMPSOURCE_BITS   (15 << 1)
 Defines the location of the RAMPSOURCE bits in the DACCTL register. More...
 
#define COMP_DACCTL_FREESOFT_BITS   (3 << 14)
 Defines the location of the FREE:SOFT bits in the DACCTL register. More...
 

Typedefs

typedef struct _COMP_Obj_ COMP_Obj
 Defines the comparator (COMP) object. More...
 
typedef struct _COMP_Obj_COMP_Handle
 Defines the comparator (COMP) handle. More...
 

Enumerations

enum  COMP_QualSel_e {
  COMP_QualSel_Sync = (0 << 3), COMP_QualSel_Qual_2 = (1 << 3), COMP_QualSel_Qual_3 = (2 << 3), COMP_QualSel_Qual_4 = (3 << 3),
  COMP_QualSel_Qual_5 = (3 << 3), COMP_QualSel_Qual_6 = (4 << 3), COMP_QualSel_Qual_7 = (5 << 3), COMP_QualSel_Qual_8 = (6 << 3),
  COMP_QualSel_Qual_9 = (7 << 3), COMP_QualSel_Qual_10 = (8 << 3), COMP_QualSel_Qual_11 = (9 << 3), COMP_QualSel_Qual_12 = (10 << 3),
  COMP_QualSel_Qual_13 = (11 << 3), COMP_QualSel_Qual_14 = (12 << 3), COMP_QualSel_Qual_15 = (13 << 3), COMP_QualSel_Qual_16 = (14 << 3),
  COMP_QualSel_Qual_17 = (15 << 3), COMP_QualSel_Qual_18 = (16 << 3), COMP_QualSel_Qual_19 = (17 << 3), COMP_QualSel_Qual_20 = (18 << 3),
  COMP_QualSel_Qual_21 = (19 << 3), COMP_QualSel_Qual_22 = (20 << 3), COMP_QualSel_Qual_23 = (21 << 3), COMP_QualSel_Qual_24 = (22 << 3),
  COMP_QualSel_Qual_25 = (23 << 3), COMP_QualSel_Qual_26 = (24 << 3), COMP_QualSel_Qual_27 = (25 << 3), COMP_QualSel_Qual_28 = (26 << 3),
  COMP_QualSel_Qual_29 = (27 << 3), COMP_QualSel_Qual_30 = (28 << 3), COMP_QualSel_Qual_31 = (29 << 3), COMP_QualSel_Qual_32 = (30 << 3),
  COMP_QualSel_Qual_33 = (31 << 3)
}
 Enumeration to define the comparator (COMP) output qualification. More...
 
enum  COMP_RampSyncSrc_e { COMP_RampSyncSrc_PWMSYNC1 = (0 << 1), COMP_RampSyncSrc_PWMSYNC2 = (1 << 1), COMP_RampSyncSrc_PWMSYNC3 = (2 << 1), COMP_RampSyncSrc_PWMSYNC4 = (3 << 1) }
 Enumeration to define the comparator (COMP) ramp generator sync source. More...
 

Functions

void COMP_disable (COMP_Handle compHandle)
 Disables the comparator (COMP) More...
 
void COMP_disableDac (COMP_Handle compHandle)
 Disables the DAC. More...
 
void COMP_enable (COMP_Handle compHandle)
 Enables the comparator (COMP) More...
 
void COMP_enableDac (COMP_Handle compHandle)
 Enables the DAC. More...
 
COMP_Handle COMP_init (void *pMemory, const size_t numBytes)
 Initializes the comparator (COMP) object handle. More...
 
static void COMP_setDacValue (COMP_Handle compHandle, uint16_t dacValue)
 Sets the DAC's value. More...
 

Detailed Description


Data Structure Documentation

struct _COMP_Obj_

Defines the comparator (COMP) object.

Definition at line 173 of file comp.h.

Data Fields
volatile uint16_t COMPCTL COMP Control Register.
volatile uint16_t COMPSTS COMP Status Register.
volatile uint16_t DACCTL DAC Control Register.
volatile uint16_t DACVAL DAC Value Register.
volatile uint16_t RAMPDECVAL_ACTIVE Ramp Generator Decrement Value (Active)
volatile uint16_t RAMPDECVAL_SHADOW Ramp Generator Decrement Value (Shadow)
volatile uint16_t RAMPMAXREF_ACTIVE Ramp Generator Maxmimum Reference (Active)
volatile uint16_t RAMPMAXREF_SHADOW Ramp Generator Maximum Reference (Shadow)
volatile uint16_t RAMPSTS Ramp Generator Status.
volatile uint16_t rsvd_1 Reserved.
volatile uint16_t rsvd_2 Reserved.
volatile uint16_t rsvd_3 Reserved.
volatile uint16_t rsvd_4 Reserved.
volatile uint16_t rsvd_5 Reserved.
volatile uint16_t rsvd_6 Reserved.
volatile uint16_t rsvd_7 Reserved.
volatile uint16_t rsvd_8 Reserved.

Macro Definition Documentation

#define COMP1_BASE_ADDR   (0x00006400)

Defines the base address of the comparator (COMP) registers.

Definition at line 67 of file comp.h.

#define COMP2_BASE_ADDR   (0x00006420)

Defines the base address of the comparator (COMP) registers.

Definition at line 71 of file comp.h.

#define COMP3_BASE_ADDR   (0x00006440)

Defines the base address of the comparator (COMP) registers.

Definition at line 75 of file comp.h.

#define COMP_COMPCTL_CMPINV_BITS   (1 << 2)

Defines the location of the CMPINV bits in the COMPCTL register.

Definition at line 88 of file comp.h.

#define COMP_COMPCTL_COMPDACE_BITS   (1 << 0)

Defines the location of the COMPDACE bits in the COMPCTL register.

Definition at line 80 of file comp.h.

Referenced by COMP_disable(), and COMP_enable().

#define COMP_COMPCTL_COMPSOURCE_BITS   (1 << 1)

Defines the location of the COMPSOURCE bits in the COMPCTL register.

Definition at line 84 of file comp.h.

Referenced by COMP_disableDac(), and COMP_enableDac().

#define COMP_COMPCTL_QUALSEL_BITS   (31 << 3)

Defines the location of the QUALSEL bits in the COMPCTL register.

Definition at line 92 of file comp.h.

#define COMP_COMPCTL_SYNCSEL_BITS   (1 << 8)

Defines the location of the SYNCSEL bits in the COMPCTL register.

Definition at line 96 of file comp.h.

#define COMP_COMPSTS_COMPSTS_BITS   (1 << 0)

Defines the location of the COMPSTS bits in the COMPSTS register.

Definition at line 101 of file comp.h.

#define COMP_DACCTL_DACSOURCE_BITS   (1 << 0)

Defines the location of the DACSOURCE bits in the DACCTL register.

Definition at line 106 of file comp.h.

#define COMP_DACCTL_FREESOFT_BITS   (3 << 14)

Defines the location of the FREE:SOFT bits in the DACCTL register.

Definition at line 114 of file comp.h.

#define COMP_DACCTL_RAMPSOURCE_BITS   (15 << 1)

Defines the location of the RAMPSOURCE bits in the DACCTL register.

Definition at line 110 of file comp.h.

Typedef Documentation

typedef struct _COMP_Obj_* COMP_Handle

Defines the comparator (COMP) handle.

Definition at line 197 of file comp.h.

typedef struct _COMP_Obj_ COMP_Obj

Defines the comparator (COMP) object.

Enumeration Type Documentation

Enumeration to define the comparator (COMP) output qualification.

Enumerator
COMP_QualSel_Sync 

Synchronize comparator output.

COMP_QualSel_Qual_2 

Qualify comparator output with 2 cycles.

COMP_QualSel_Qual_3 

Qualify comparator output with 3 cycles.

COMP_QualSel_Qual_4 

Qualify comparator output with 4 cycles.

COMP_QualSel_Qual_5 

Qualify comparator output with 5 cycles.

COMP_QualSel_Qual_6 

Qualify comparator output with 6 cycles.

COMP_QualSel_Qual_7 

Qualify comparator output with 7 cycles.

COMP_QualSel_Qual_8 

Qualify comparator output with 8 cycles.

COMP_QualSel_Qual_9 

Qualify comparator output with 9 cycles.

COMP_QualSel_Qual_10 

Qualify comparator output with 10 cycles.

COMP_QualSel_Qual_11 

Qualify comparator output with 11 cycles.

COMP_QualSel_Qual_12 

Qualify comparator output with 12 cycles.

COMP_QualSel_Qual_13 

Qualify comparator output with 13 cycles.

COMP_QualSel_Qual_14 

Qualify comparator output with 14 cycles.

COMP_QualSel_Qual_15 

Qualify comparator output with 15 cycles.

COMP_QualSel_Qual_16 

Qualify comparator output with 16 cycles.

COMP_QualSel_Qual_17 

Qualify comparator output with 17 cycles.

COMP_QualSel_Qual_18 

Qualify comparator output with 18 cycles.

COMP_QualSel_Qual_19 

Qualify comparator output with 19 cycles.

COMP_QualSel_Qual_20 

Qualify comparator output with 20 cycles.

COMP_QualSel_Qual_21 

Qualify comparator output with 21 cycles.

COMP_QualSel_Qual_22 

Qualify comparator output with 22 cycles.

COMP_QualSel_Qual_23 

Qualify comparator output with 23 cycles.

COMP_QualSel_Qual_24 

Qualify comparator output with 24 cycles.

COMP_QualSel_Qual_25 

Qualify comparator output with 25 cycles.

COMP_QualSel_Qual_26 

Qualify comparator output with 26 cycles.

COMP_QualSel_Qual_27 

Qualify comparator output with 27 cycles.

COMP_QualSel_Qual_28 

Qualify comparator output with 28 cycles.

COMP_QualSel_Qual_29 

Qualify comparator output with 29 cycles.

COMP_QualSel_Qual_30 

Qualify comparator output with 30 cycles.

COMP_QualSel_Qual_31 

Qualify comparator output with 31 cycles.

COMP_QualSel_Qual_32 

Qualify comparator output with 32 cycles.

COMP_QualSel_Qual_33 

Qualify comparator output with 33 cycles.

Definition at line 122 of file comp.h.

Enumeration to define the comparator (COMP) ramp generator sync source.

Enumerator
COMP_RampSyncSrc_PWMSYNC1 

PWMSync1 used as Ramp Sync.

COMP_RampSyncSrc_PWMSYNC2 

PWMSync2 used as Ramp Sync.

COMP_RampSyncSrc_PWMSYNC3 

PWMSync3 used as Ramp Sync.

COMP_RampSyncSrc_PWMSYNC4 

PWMSync4 used as Ramp Sync.

Definition at line 162 of file comp.h.

Function Documentation

void COMP_disable ( COMP_Handle  compHandle)

Disables the comparator (COMP)

Parameters
[in]compHandleThe comparator (COMP) object handle

Definition at line 60 of file comp.c.

References COMP_COMPCTL_COMPDACE_BITS, _COMP_Obj_::COMPCTL, DISABLE_PROTECTED_REGISTER_WRITE_MODE, and ENABLE_PROTECTED_REGISTER_WRITE_MODE.

void COMP_disableDac ( COMP_Handle  compHandle)

Disables the DAC.

Parameters
[in]compHandleThe comparator (COMP) object handle

Definition at line 75 of file comp.c.

References COMP_COMPCTL_COMPSOURCE_BITS, _COMP_Obj_::COMPCTL, DISABLE_PROTECTED_REGISTER_WRITE_MODE, and ENABLE_PROTECTED_REGISTER_WRITE_MODE.

void COMP_enable ( COMP_Handle  compHandle)

Enables the comparator (COMP)

Parameters
[in]compHandleThe comparator (COMP) object handle

Definition at line 90 of file comp.c.

References COMP_COMPCTL_COMPDACE_BITS, _COMP_Obj_::COMPCTL, DISABLE_PROTECTED_REGISTER_WRITE_MODE, and ENABLE_PROTECTED_REGISTER_WRITE_MODE.

void COMP_enableDac ( COMP_Handle  compHandle)

Enables the DAC.

Parameters
[in]compHandleThe comparator (COMP) object handle

Definition at line 105 of file comp.c.

References COMP_COMPCTL_COMPSOURCE_BITS, _COMP_Obj_::COMPCTL, DISABLE_PROTECTED_REGISTER_WRITE_MODE, and ENABLE_PROTECTED_REGISTER_WRITE_MODE.

COMP_Handle COMP_init ( void *  pMemory,
const size_t  numBytes 
)

Initializes the comparator (COMP) object handle.

Parameters
[in]pMemoryA pointer to the base address of the COMP registers
[in]numBytesThe number of bytes allocated for the COMP object, bytes
Returns
The comparator (COMP) object handle

Definition at line 120 of file comp.c.

static void COMP_setDacValue ( COMP_Handle  compHandle,
uint16_t  dacValue 
)
inlinestatic

Sets the DAC's value.

Parameters
[in]compHandleThe comparator (COMP) object handle
[in]dacValueThe DAC's value

Definition at line 237 of file comp.h.

References _COMP_Obj_::DACVAL.