MotorWare f2806x Module API Documentation
Data Structures | Typedefs | Enumerations | Functions
CAL

Data Structures

struct  _CAL_Obj_
 Defines the calibrator (CAL) object. More...
 

Typedefs

typedef struct _CAL_Obj_ CAL_Obj
 Defines the calibrator (CAL) object. More...
 
typedef struct _CAL_Obj_CAL_Handle
 Defines the CAL handle. More...
 
typedef struct _CAL_Obj_ CAL_Obj
 Defines the calibrator (CAL) object. More...
 
typedef struct _CAL_Obj_CAL_Handle
 Defines the CAL handle. More...
 

Enumerations

enum  CAL_State_e {
  CAL_State_Error = 0, CAL_State_Idle = 1, CAL_State_AdcOffset = 2, CAL_State_Done = 3,
  CAL_numStates = 4
}
 Defines the CAL states. More...
 

Functions

static void CAL_disable (CAL_Handle handle)
 Disables the calibrator (CAL) module. More...
 
static void CAL_enable (CAL_Handle handle)
 Enables the calibrator (CAL) module. More...
 
static uint_least32_t CAL_getCount_state (CAL_Handle handle)
 Gets the state count value. More...
 
static bool CAL_getFlag_enable (CAL_Handle handle)
 Gets the value of the enable flag. More...
 
static bool CAL_getFlag_enableAdcOffset (CAL_Handle handle)
 Gets the value of the enable ADC offset flag. More...
 
static OFFSET_HandleCAL_getOffsetHandleAddr_I (CAL_Handle handle)
 Gets the current offset handle address. More...
 
static OFFSET_HandleCAL_getOffsetHandleAddr_V (CAL_Handle handle)
 Gets the voltage offset handle address. More...
 
static _iq CAL_getOffsetValue_I (CAL_Handle handle, const uint_least8_t sensorNumber)
 Gets the current offset value. More...
 
static _iq CAL_getOffsetValue_V (CAL_Handle handle, const uint_least8_t sensorNumber)
 Gets the voltage offset value. More...
 
static CAL_State_e CAL_getState (CAL_Handle handle)
 Gets the calibration state. More...
 
static uint_least32_t CAL_getWaitTime (CAL_Handle handle, const CAL_State_e state)
 Gets the wait time for a given state. More...
 
static void CAL_incrCounter_state (CAL_Handle handle)
 Increments the state count value. More...
 
CAL_Handle CAL_init (void *pMemory, const size_t numBytes)
 Initializes the calibrator (CAL) module. More...
 
static bool CAL_isEnabled (CAL_Handle handle)
 Returns a boolean value denoting if the module is enabled (true) or not (false) More...
 
static bool CAL_isError (CAL_Handle handle)
 Determines if there is a calibrator error. More...
 
static bool CAL_isIdle (CAL_Handle handle)
 Determines if the calibrator is in the idle state. More...
 
static bool CAL_isNotIdle (CAL_Handle handle)
 Determines if the calibrator is not in the idle state. More...
 
void CAL_reset (CAL_Handle handle)
 Resets the calibrator. More...
 
static void CAL_resetCounter_state (CAL_Handle handle)
 Resets the state count value. More...
 
static void CAL_setCount_state (CAL_Handle handle, const uint_least32_t count)
 Sets the state count value. More...
 
static void CAL_setFlag_enable (CAL_Handle handle, const bool value)
 Sets the value of the enable flag. More...
 
static void CAL_setFlag_enableAdcOffset (CAL_Handle handle, const bool value)
 Sets the value of the enable ADC offset flag. More...
 
void CAL_setParams (CAL_Handle handle, const USER_Params *pUserParams)
 Sets the parameters. More...
 
static void CAL_setState (CAL_Handle handle, const CAL_State_e state)
 Sets the calibration state. More...
 
static void CAL_setWaitTime (CAL_Handle handle, const CAL_State_e state, const uint_least32_t waitTime)
 Sets the wait time for a given state. More...
 
void CAL_setWaitTimes (CAL_Handle handle, const uint_least32_t *pWaitTimes)
 Sets the wait times. More...
 
static void CAL_setup (CAL_Handle handle)
 Sets up the calibrator (CAL) module. More...
 
static void CAL_run (CAL_Handle handle, const HAL_AdcData_t *pAdcData)
 Runs the calibrator (CAL) module. More...
 
bool CAL_updateState (CAL_Handle handle)
 Updates the calibrator (CAL) state. More...
 
static void CAL_setCount_state (CAL_Handle handle, const int_least32_t count)
 Sets the state count value. More...
 
static void CAL_setWaitTime (CAL_Handle handle, const CAL_State_e state, const int_least32_t waitTime)
 Sets the wait time for a given state. More...
 
void CAL_setWaitTimes (CAL_Handle handle, const int_least32_t *pWaitTimes)
 Sets the wait times. More...
 

Detailed Description


Data Structure Documentation

struct _CAL_Obj_

Defines the calibrator (CAL) object.

Definition at line 54 of file 32b/cal.h.

Data Fields
uint_least32_t counter_state the state counter
int_least32_t counter_state the state counter
bool flag_enable the enable flag
bool flag_enableAdcOffset the enable ADC offset calibration flag
OFFSET_Obj offset_I[USER_NUM_CURRENT_SENSORS] the current offset objects
OFFSET_Obj offset_V[USER_NUM_VOLTAGE_SENSORS] the voltage offset objects
OFFSET_Handle offsetHandle_I[USER_NUM_CURRENT_SENSORS] the handles for the current offset estimators
OFFSET_Handle offsetHandle_V[USER_NUM_VOLTAGE_SENSORS] the handles for the voltage offset estimators
CAL_State_e state the current state
int_least32_t waitTimes[CAL_numStates] an array of wait times for each state, calibration clock counts
uint_least32_t waitTimes[CAL_numStates] an array of wait times for each state, calibration clock counts

Typedef Documentation

typedef struct _CAL_Obj_* CAL_Handle

Defines the CAL handle.

Definition at line 74 of file 32b/cal.h.

typedef struct _CAL_Obj_* CAL_Handle

Defines the CAL handle.

Definition at line 74 of file float/cal.h.

typedef struct _CAL_Obj_ CAL_Obj

Defines the calibrator (CAL) object.

typedef struct _CAL_Obj_ CAL_Obj

Defines the calibrator (CAL) object.

Enumeration Type Documentation

Defines the CAL states.

Enumerator
CAL_State_Error 

error state

CAL_State_Idle 

idle state

CAL_State_AdcOffset 

ADC offset calibration state.

CAL_State_Done 

done state

CAL_numStates 

the total number of states

Definition at line 46 of file cal_states.h.

Function Documentation

static void CAL_disable ( CAL_Handle  handle)
inlinestatic

Disables the calibrator (CAL) module.

Parameters
[in]handleThe calibrator (CAL) handle

Definition at line 86 of file 32b/cal.h.

References _CAL_Obj_::flag_enable.

static void CAL_enable ( CAL_Handle  handle)
inlinestatic

Enables the calibrator (CAL) module.

Parameters
[in]handleThe calibrator (CAL) handle

Definition at line 98 of file 32b/cal.h.

References _CAL_Obj_::flag_enable.

static uint_least32_t CAL_getCount_state ( CAL_Handle  handle)
inlinestatic

Gets the state count value.

Parameters
[in]handleThe calibrator (CAL) handle
Returns
The state count value

Definition at line 111 of file 32b/cal.h.

References _CAL_Obj_::counter_state.

Referenced by CAL_updateState().

static bool CAL_getFlag_enable ( CAL_Handle  handle)
inlinestatic

Gets the value of the enable flag.

Parameters
[in]handleThe calibrator (CAL) handle
Returns
The enable flag value

Definition at line 122 of file 32b/cal.h.

References _CAL_Obj_::flag_enable.

Referenced by CAL_updateState().

static bool CAL_getFlag_enableAdcOffset ( CAL_Handle  handle)
inlinestatic

Gets the value of the enable ADC offset flag.

Parameters
[in]handleThe calibrator (CAL) handle
Returns
The enable ADC offset flag value

Definition at line 133 of file 32b/cal.h.

References _CAL_Obj_::flag_enableAdcOffset.

Referenced by CAL_updateState().

static OFFSET_Handle* CAL_getOffsetHandleAddr_I ( CAL_Handle  handle)
inlinestatic

Gets the current offset handle address.

Parameters
[in]handleThe calibrator (CAL) handle
Returns
The current offset handle address

Definition at line 144 of file 32b/cal.h.

References _CAL_Obj_::offsetHandle_I.

static OFFSET_Handle* CAL_getOffsetHandleAddr_V ( CAL_Handle  handle)
inlinestatic

Gets the voltage offset handle address.

Parameters
[in]handleThe calibrator (CAL) handle
Returns
The voltage offset handle address

Definition at line 155 of file 32b/cal.h.

References _CAL_Obj_::offsetHandle_V.

static _iq CAL_getOffsetValue_I ( CAL_Handle  handle,
const uint_least8_t  sensorNumber 
)
inlinestatic

Gets the current offset value.

Parameters
[in]handleThe calibrator (CAL) handle
[in]sensorNumberThe sensor number
Returns
The offset value

Definition at line 167 of file 32b/cal.h.

References OFFSET_getOffset(), and _CAL_Obj_::offsetHandle_I.

static _iq CAL_getOffsetValue_V ( CAL_Handle  handle,
const uint_least8_t  sensorNumber 
)
inlinestatic

Gets the voltage offset value.

Parameters
[in]handleThe calibrator (CAL) handle
[in]sensorNumberThe sensor number
Returns
The offset value

Definition at line 182 of file 32b/cal.h.

References OFFSET_getOffset(), and _CAL_Obj_::offsetHandle_V.

static CAL_State_e CAL_getState ( CAL_Handle  handle)
inlinestatic

Gets the calibration state.

Parameters
[in]handleThe calibrator (CAL) handle
Returns
The calibration state

Definition at line 196 of file 32b/cal.h.

References _CAL_Obj_::state.

Referenced by CAL_isError(), CAL_isIdle(), CAL_isNotIdle(), CAL_run(), and CAL_updateState().

static uint_least32_t CAL_getWaitTime ( CAL_Handle  handle,
const CAL_State_e  state 
)
inlinestatic

Gets the wait time for a given state.

Parameters
[in]handleThe calibrator (CAL) handle
[in]stateThe state
Returns
The wait time, counts

Definition at line 208 of file 32b/cal.h.

References _CAL_Obj_::waitTimes.

Referenced by CAL_updateState().

static void CAL_incrCounter_state ( CAL_Handle  handle)
inlinestatic

Increments the state count value.

Parameters
[in]handleThe calibrator (CAL) handle

Definition at line 218 of file 32b/cal.h.

References _CAL_Obj_::counter_state.

Referenced by CAL_run().

CAL_Handle CAL_init ( void *  pMemory,
const size_t  numBytes 
)

Initializes the calibrator (CAL) module.

Parameters
[in]pMemoryA pointer to the memory for the object
[in]numBytesThe number of bytes allocated for the object, bytes
Returns
The calibrator (CAL) object handle

Definition at line 21 of file 32b/cal.c.

References _CAL_Obj_::offset_I, OFFSET_init(), _CAL_Obj_::offset_V, _CAL_Obj_::offsetHandle_I, and _CAL_Obj_::offsetHandle_V.

static bool CAL_isEnabled ( CAL_Handle  handle)
inlinestatic

Returns a boolean value denoting if the module is enabled (true) or not (false)

Parameters
[in]handleThe calibrator (CAL) handle
Returns
The boolean value

Definition at line 241 of file 32b/cal.h.

References _CAL_Obj_::flag_enable.

static bool CAL_isError ( CAL_Handle  handle)
inlinestatic

Determines if there is a calibrator error.

Parameters
[in]handleThe calibrator (CAL) handle
Returns
A boolean value denoting if there is a calibrator error (true) or not (false)

Definition at line 252 of file 32b/cal.h.

References CAL_getState(), CAL_State_Error, and _CAL_Obj_::state.

static bool CAL_isIdle ( CAL_Handle  handle)
inlinestatic

Determines if the calibrator is in the idle state.

Parameters
[in]handleThe calibrator (CAL) handle
Returns
A boolean value denoting if the calibrator is in the idle state (true) or not (false)

Definition at line 271 of file 32b/cal.h.

References CAL_getState(), CAL_State_Idle, and _CAL_Obj_::state.

static bool CAL_isNotIdle ( CAL_Handle  handle)
inlinestatic

Determines if the calibrator is not in the idle state.

Parameters
[in]handleThe calibrator (CAL) handle
Returns
A boolean value denoting if the calibrator is in the idle state (false) or not (true)

Definition at line 288 of file 32b/cal.h.

References CAL_getState(), CAL_State_Idle, and _CAL_Obj_::state.

Referenced by CAL_updateState().

void CAL_reset ( CAL_Handle  handle)

Resets the calibrator.

Parameters
[in]handleThe calibrator (CAL) handle

Definition at line 57 of file 32b/cal.c.

Referenced by CAL_updateState().

static void CAL_resetCounter_state ( CAL_Handle  handle)
inlinestatic

Resets the state count value.

Parameters
[in]handleThe calibrator (CAL) handle

Definition at line 309 of file 32b/cal.h.

References _CAL_Obj_::counter_state.

Referenced by CAL_updateState().

static void CAL_run ( CAL_Handle  handle,
const HAL_AdcData_t pAdcData 
)
inlinestatic

Runs the calibrator (CAL) module.

Parameters
[in]handleThe calibrator (CAL) handle

Definition at line 409 of file 32b/cal.h.

References CAL_getState(), CAL_incrCounter_state(), CAL_State_AdcOffset, _HAL_AdcData_t_::I_pu, OFFSET_run(), _CAL_Obj_::offsetHandle_I, _CAL_Obj_::offsetHandle_V, _CAL_Obj_::state, _HAL_AdcData_t_::V_pu, and _MATH_vec3_::value.

static void CAL_setCount_state ( CAL_Handle  handle,
const uint_least32_t  count 
)
inlinestatic

Sets the state count value.

Parameters
[in]handleThe calibrator (CAL) handle
[in]countThe desired state count value

Definition at line 322 of file 32b/cal.h.

References _CAL_Obj_::counter_state.

Referenced by CAL_setParams().

static void CAL_setCount_state ( CAL_Handle  handle,
const int_least32_t  count 
)
inlinestatic

Sets the state count value.

Parameters
[in]handleThe calibrator (CAL) handle
[in]countThe desired state count value

Definition at line 330 of file float/cal.h.

References _CAL_Obj_::counter_state.

static void CAL_setFlag_enable ( CAL_Handle  handle,
const bool  value 
)
inlinestatic

Sets the value of the enable flag.

Parameters
[in]handleThe calibrator (CAL) handle
[in]valueThe desired flag value

Definition at line 335 of file 32b/cal.h.

References _CAL_Obj_::flag_enable.

Referenced by CAL_setParams().

static void CAL_setFlag_enableAdcOffset ( CAL_Handle  handle,
const bool  value 
)
inlinestatic

Sets the value of the enable ADC offset flag.

Parameters
[in]handleThe calibrator (CAL) handle
[in]valueThe desired flag value

Definition at line 348 of file 32b/cal.h.

References _CAL_Obj_::flag_enableAdcOffset.

Referenced by CAL_setParams(), and CAL_updateState().

void CAL_setParams ( CAL_Handle  handle,
const USER_Params pUserParams 
)
static void CAL_setState ( CAL_Handle  handle,
const CAL_State_e  state 
)
inlinestatic

Sets the calibration state.

Parameters
[in]handleThe calibrator (CAL) handle
[in]stateThe calibration state

Definition at line 368 of file 32b/cal.h.

References _CAL_Obj_::state.

Referenced by CAL_setParams(), and CAL_updateState().

static void CAL_setup ( CAL_Handle  handle)
inlinestatic

Sets up the calibrator (CAL) module.

Parameters
[in]handleThe calibrator (CAL) handle

Definition at line 400 of file 32b/cal.h.

static void CAL_setWaitTime ( CAL_Handle  handle,
const CAL_State_e  state,
const uint_least32_t  waitTime 
)
inlinestatic

Sets the wait time for a given state.

Parameters
[in]handleThe calibrator (CAL) handle
[in]stateThe state
[in]waitTimeThe wait time, counts

Definition at line 382 of file 32b/cal.h.

References _CAL_Obj_::state, and _CAL_Obj_::waitTimes.

Referenced by CAL_setWaitTimes().

static void CAL_setWaitTime ( CAL_Handle  handle,
const CAL_State_e  state,
const int_least32_t  waitTime 
)
inlinestatic

Sets the wait time for a given state.

Parameters
[in]handleThe calibrator (CAL) handle
[in]stateThe state
[in]waitTimeThe wait time, counts

Definition at line 390 of file float/cal.h.

References _CAL_Obj_::state, and _CAL_Obj_::waitTimes.

void CAL_setWaitTimes ( CAL_Handle  handle,
const uint_least32_t *  pWaitTimes 
)

Sets the wait times.

Parameters
[in]handleThe calibrator (CAL) handle
[in]pWaitTimesA point to a vector of wait times

Definition at line 104 of file 32b/cal.c.

References CAL_numStates, and CAL_setWaitTime().

Referenced by CAL_setParams().

void CAL_setWaitTimes ( CAL_Handle  handle,
const int_least32_t *  pWaitTimes 
)

Sets the wait times.

Parameters
[in]handleThe calibrator (CAL) handle
[in]pWaitTimesA point to a vector of wait times

Definition at line 104 of file float/cal.c.

References CAL_numStates, and CAL_setWaitTime().

Referenced by CAL_setParams().

bool CAL_updateState ( CAL_Handle  handle)