Infineon Logo AIROC BTSDK v4.6 - Documentation
 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups

Data Structures

struct  QuadRegistration
 Interrupt handler registration structure. Internal. More...
 
struct  QuadratureData
 Quadrature driver data. More...
 
struct  QuadratureState
 Quadrature runtime state. More...
 

Typedefs

typedef struct QuadRegistration QuadRegistration
 Interrupt handler registration structure. Internal.
 

Enumerations

enum  { ENABLE_PORT_2_PINS_AS_QUAD_INPUT = 0, ENABLE_PORT_0_PINS_AS_QUAD_INPUT = 1 }
 Defines a quadrature driver provided by the 20732 core.
 
enum  { QUADRATURE_LED_CONFIG_OPEN_SOURCE = 0x00, QUADRATURE_LED_CONFIG_SOURCE = 0x01, QUADRATURE_LED_CONFIG_OPEN_DRAIN = 0x02, QUADRATURE_LED_CONFIG_DRAIN = 0x03 }
 
enum  { QFLAG_SIGN = 0x0100, MIA_QFLAG_OVERFLOW_X = 0x01, MIA_QFLAG_OVERFLOW_Y = 0x02, MIA_QFLAG_OVERFLOW_Z = 0x04 }
 
enum  { CTRL_CLR_KEYS = 0x0004 }
 
enum  {
  CH_XY_128_KHZ_FIXED_SAMPLE_RATE = 0x00, CH_XY_64_KHZ_FIXED_SAMPLE_RATE = 0x01, CH_XY_32_KHZ_FIXED_SAMPLE_RATE = 0x02, CH_XY_16_KHZ_FIXED_SAMPLE_RATE = 0x03,
  CH_XY_SEL_LHL_PWM_RATE = 0x00, CH_XY_SEL_FIXED_RATE = 0x04, CH_XY_DISABLE = 0x00, CH_XY_ENABLE = 0x08,
  CH_Z_SAMPLE_ONCE_PER_LHL_PWM = 0x00, CH_Z_SAMPLE_ONCE_PER_2_LHL_PWM = 0x10, CH_Z_SAMPLE_ONCE_PER_4_LHL_PWM = 0x20, CH_Z_SAMPLE_ONCE_PER_8_LHL_PWM = 0x30,
  CH_Z_SAMPLE_ONCE_PER_16_LHL_PWM = 0x40, CH_Z_SAMPLE_ONCE_PER_32_LHL_PWM = 0x50, CH_Z_SAMPLE_ONCE_PER_64_LHL_PWM = 0x60, CH_Z_SAMPLE_ONCE_PER_128_LHL_PWM = 0x70,
  CH_Z_DISABLE = 0x00, CH_Z_ENABLE = 0x80
}
 
enum  {
  CONTROL_DISABLE = 0x00, CONTROL_ENABLE = 0x01, HW_CTRL_QUAD_INTERRUPT_ENABLE = 0x02, WAKEUP_INT_DISABLE = 0x00,
  WAKEUP_INT_ENABLE = 0x02, SCROLL_WITH_NO_DETENT_DISABLE = 0x00, SCROLL_WITH_NO_DETENT_ENABLE = 0x08
}
 
enum  { QUAD_ENABLE_X_LHL = 0x0400, QUAD_ENABLE_Y_LHL = 0x0200, QUAD_ENABLE_Z_LHL = 0x0100 }
 
enum  { CH_SEL_FOR_QUAD_INPUT_PORT0 = 0x0000, CH_SEL_FOR_QUAD_INPUT_PORT2 = 0x0002 }
 
enum  { HW_MIA_STATUS_QUAD_SET_MASK = 0x00010, HW_MIA_STATUS_QUAD_INT_SET_MASK = 0x00020 }
 
enum  { GPIO_OUTPUT_MUX_TO_QOC = 0x0020 }
 
enum  { INTERRUPT_CONFIG_DISABLE = 0x00, INTERRUPT_CONFIG_ENABLE = 0x01 }
 
enum  {
  QUADRATURE_RESERVED42_X_CTL_BIT_MASK = 0x01, QUADRATURE_RESERVED42_Y_CTL_BIT_MASK = 0x02, QUADRATURE_RESERVED42_Z_CTL_BIT_MASK = 0x04, QUADRATURE_RESERVED42_ENABLE_X = 0x01,
  QUADRATURE_RESERVED42_ENABLE_Y = 0x02, QUADRATURE_RESERVED42_ENABLE_Z = 0x04, QUADRATURE_RESERVED42_DISABLE_X = 0x00, QUADRATURE_RESERVED42_DISABLE_Y = 0x00,
  QUADRATURE_RESERVED42_DISABLE_Z = 0x00, QUADRATURE_RESERVED42_MAGIC_CONFIG = 0xB3
}
 
enum  { QUADRATURE_CONFIG_RESERVED42_X_INDEX = 0, QUADRATURE_CONFIG_RESERVED42_Y_INDEX = 1, QUADRATURE_CONFIG_RESERVED42_Z_INDEX = 2 }
 
enum  { RESERVED42_PORT0_MUX = 0x0010, RESERVED42_PORT2_MUX = 0x0020 }
 

Functions

INT16 quad_getXMotion (void)
 Return previously accumulated motion for X axis. More...
 
INT16 quad_getYMotion (void)
 Return previously accumulated motion for Y axis. More...
 
INT16 quad_getZMotion (void)
 Return previously accumulated motion for Z axis. More...
 
void quad_getXYMotion (INT16 *x, INT16 *y)
 Adds any currently accumulated X/Y motion to the X/Y output variables. More...
 
void quad_disable (void)
 Disable the quadrature interface. More...
 
void quad_restoreActivity (void)
 Configures the quadrature interface enable/wakeup functionality to what has been configured.
 
void quad_flushHwEvents (void)
 Clears the HW queue.
 
void quad_miaFreezeCallBack (void)
 MIA clock freeze notification. More...
 
void quad_miaUnfreezeCallBack (void)
 MIA clock unfreeze notification. Internal.
 
void quad_hwInit (void)
 Initialize the quadrature HW based on the configuration.
 
void quad_enableInterrupt (void)
 Enables quadrature interrupt. Internal.
 
void quad_disableInterrupt (void)
 Disables quadrature interrupt. Internal.
 
void quad_quadInterrupt (void)
 Handle Quadrature Interrupt and Notify the relevant subscriber.
 
void quad_registerForEventNotification (void(*userfn)(void *), void *userdata)
 Allows the app to register a callback when an event is detected. More...
 
void quad_init (void)
 Initialize the quadrature driver based on the configuration. More...
 
void quad_enableEventDetection (void)
 Configures upstream interrupt.
 
void quad_configurePortPins (void)
 Configure the pins for the specified port for quadrature operation. More...
 

Detailed Description

Function Documentation

void quad_configurePortPins ( void  )

Configure the pins for the specified port for quadrature operation.

Also set the quadrature input select register to use the specified pins. Port and pin values taken from the config structure.

void quad_disable ( void  )

Disable the quadrature interface.

This disables the quadrature interface polling and also disables wakeups from the quadrature

INT16 quad_getXMotion ( void  )

Return previously accumulated motion for X axis.

Returns
Motion in X axis.
void quad_getXYMotion ( INT16 *  x,
INT16 *  y 
)

Adds any currently accumulated X/Y motion to the X/Y output variables.

Note that the motion is added to the variables, so the incoming value is important.

Parameters
xPointer to previously accumulated motion in X axis.
yPointer to previously accumulated motion in Y axis.
INT16 quad_getYMotion ( void  )

Return previously accumulated motion for Y axis.

Returns
Motion in Y axis.
INT16 quad_getZMotion ( void  )

Return previously accumulated motion for Z axis.

Returns
Motion in Z axis.
void quad_init ( void  )

Initialize the quadrature driver based on the configuration.

Will also initialize the HW if the last reset was because of a power up condition

void quad_miaFreezeCallBack ( void  )

MIA clock freeze notification.

Retrieves any pending events from the HW fifo. Internal.

void quad_registerForEventNotification ( void(*)(void *)  userfn,
void *  userdata 
)

Allows the app to register a callback when an event is detected.

Parameters
userfnPointer to the callback function.
dataA pointer to a user provided context that will be passed back to the callback.