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

Enumerations

enum  { ENABLE_PORT_2_PINS_AS_QUAD_INPUT = 0, ENABLE_PORT_0_PINS_AS_QUAD_INPUT = 1 }
 Defines the quadrature driver that can detect and decode scroll wheel movement in X, Y, Z axis.
 
enum  { QUADRATURE_LED_CONFIG_OPEN_SOURCE = 0x00, QUADRATURE_LED_CONFIG_SOURCE = 0x01, QUADRATURE_LED_CONFIG_OPEN_DRAIN = 0x02, QUADRATURE_LED_CONFIG_DRAIN = 0x03 }
 
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
}
 

Functions

void wiced_hal_quadrature_configure (uint16_t QOC_LEDs_output_polarity, uint16_t quadratureInputGpioConfig, uint8_t port0PinsUsedAsQuadratureInput, wiced_bool_t configureP26AsQOC0, wiced_bool_t configureP27AsQOC1, wiced_bool_t configureP28AsQOC2, wiced_bool_t configureP29AsQOC3, uint8_t channelEnableAndSamplingRate, wiced_bool_t pollXAxis, wiced_bool_t pollYAxis, wiced_bool_t pollZAxis)
 configure quadrature driver More...
 
void wiced_hal_quadrature_init (void)
 Initialize the quadrature driver. More...
 
void wiced_hal_quadrature_turnOff (void)
 Disable the quadrature interface including wakeups. More...
 
int16_t wiced_hal_quadrature_get_X_motion (void)
 Returns currently accumulated motion for the X axis. More...
 
int16_t wiced_hal_quadrature_get_Y_motion (void)
 Returns currently accumulated motion for the Y axis. More...
 
int16_t wiced_hal_quadrature_get_Z_motion (void)
 Returns currently accumulated motion for the Z axis. More...
 
int16_t wiced_hal_quadrature_get_scroll_count (void)
 Returns currently accumulated motion for the active axis (X, Y or Z). More...
 
void wiced_hal_quadrature_register_for_event_notification (void(*userfn)(void *), void *userdata)
 Register for notification of changes. More...
 

Detailed Description

Function Documentation

void wiced_hal_quadrature_configure ( uint16_t  QOC_LEDs_output_polarity,
uint16_t  quadratureInputGpioConfig,
uint8_t  port0PinsUsedAsQuadratureInput,
wiced_bool_t  configureP26AsQOC0,
wiced_bool_t  configureP27AsQOC1,
wiced_bool_t  configureP28AsQOC2,
wiced_bool_t  configureP29AsQOC3,
uint8_t  channelEnableAndSamplingRate,
wiced_bool_t  pollXAxis,
wiced_bool_t  pollYAxis,
wiced_bool_t  pollZAxis 
)

configure quadrature driver

Application use this to configure Quadradure driver

Parameters
QOC_LEDs_output_polarity- QOC LEDs (QOC0, QOC1, QOC2, and QOC3) output polarity
quadratureInputGpioConfig- Configuration value used for each GPIO pin used for quadrature input. This allows configuration of pull up/down, etc. just like a GPIO.
port0PinsUsedAsQuadratureInput- if set to ENABLE_PORT_0_PINS_AS_QUAD_INPUT, Port 0 selected as quadrature input port (P2 as qdx0, P3 as qdx1, P4 as qdy0, P5 as qdy1, P6 as qdz0,P7 as qdz1). if set to ENABLE_PORT_2_PINS_AS_QUAD_INPUT, Port 2 selected as quadrature input port (P32 as qdx0, P33 as qdx1, P34 as qdy0, P35 as qdy1, P36 as qdz0, P37 as qdz1)
configureP26AsQOC0- if set to WICED_TRUE, P26 should be configured as QOC LED 0. if set to WICED_FALSE, P26 config is not modified.
configureP27AsQOC1- if set to WICED_TRUE, P27 should be configured as QOC LED 1. if set to WICED_FALSE, P27 config is not modified.
configureP28AsQOC2- if set to WICED_TRUE, P28 should be configured as QOC LED 2. if set to WICED_FALSE, P28 config is not modified.
configureP29AsQOC3- if set to WICED_TRUE, P29 should be configured as QOC LED 3. if set to WICED_FALSE, P29 config is not modified.
channelEnableAndSamplingRate-Configuration for QD XY and Z enable and sampling rate control
pollXAxis-if set to WICED_TRUE, enable X Axis Data Polling. Otherwise, disable X Axis Data Polling
pollYAxis-if set to WICED_TRUE, enable Y Axis Data Polling. Otherwise, disable Y Axis Data Polling
pollZAxis-if set to WICED_TRUE, enable Z Axis Data Polling. Otherwise, disable Z Axis Data Polling
Returns
- none
int16_t wiced_hal_quadrature_get_scroll_count ( void  )

Returns currently accumulated motion for the active axis (X, Y or Z).

It assumes only one of the three, pollXAxis/pollYAxis/pollZAxis, is enabled.

Returns
accumulated motion in the active axis(X, Y, or Z)
int16_t wiced_hal_quadrature_get_X_motion ( void  )

Returns currently accumulated motion for the X axis.

The internally accumulated motion value is set to 0.

Returns
X axis accumulated motion
int16_t wiced_hal_quadrature_get_Y_motion ( void  )

Returns currently accumulated motion for the Y axis.

The internally accumulated motion value is set to 0.

Returns
Y axis accumulated motion
int16_t wiced_hal_quadrature_get_Z_motion ( void  )

Returns currently accumulated motion for the Z axis.

The internally accumulated motion value is set to 0.

Returns
Z axis accumulated motion
void wiced_hal_quadrature_init ( void  )

Initialize the quadrature driver.

The quadrature HW is also initialized if the last reset was because of power up. Clears out any accumulated motion. This must be invoked once at power up before using any quadrature HW services and this call MUST be after mia driver has been initialized.

void wiced_hal_quadrature_register_for_event_notification ( void(*)(void *)  userfn,
void *  userdata 
)

Register for notification of changes.

Once registered, you CAN NOT UNREGISTER; registration is meant to be a startup activity.

Parameters
userfnpoints to the function to call when the interrupt comes and matches one of the masks (if you pass a method, it must be static). The function does not need to clear the interrupt status; this will be done by KeyscanDriver::lhlInterrupt(). The function will be called ONCE per interrupt.
userdatawill be passed back to userfn as-is; it can be used to carry the "this", for example.
void wiced_hal_quadrature_turnOff ( void  )

Disable the quadrature interface including wakeups.

Also clears any accumulated motion