![]() |
MT2523 API Reference
LinkIt SDK v4
|
This section describes the programming interfaces of accessory detector (ACCDET) HAL driver. More...
This section describes the programming interfaces of accessory detector (ACCDET) HAL driver.
The hardware ACCDET detects the status of an earphone (plug-in/plug-out/hook-key), based on the suggested circuit. The de-bounce scheme is also supported to resist uncertain input noises. When the state is stable, the Pulse Width Modulation (PWM) unit of ACCDET enables the voltage of the comparator periodically to detect the plugging state. Very low-power consumption can be achieved if the detection feature is enabled and the PWM settings are defined according to the needs of the hardware being controlled. In order to compensate the delay between the detection login and comparator, the delay enabling scheme is adopted. Given the suitable delay number compared to the rising edge of PWM high pulse, the stable plugging state can be prorogated to digital detection logic. Then the correct plugging state can be detected and reported.
The following provides descriptions to the terms commonly used in the ACCDET driver and how to use its various functions.
| Terms | Details |
|---|---|
| ACCDET | Accessory detector is designed to detect the status of earphone (plug-in/plug-out/hook-key). |
| PWM | Pulse Width Modulation (PWM) is a modulation technique that encodes a message into a pulsing signal. The main use is to allow the control of the power supplied to electrical devices, especially to inertial loads such as motors. For more information, please refer to introduction to PWM in Wikipedia. |
For PWM, the term duty cycle describes the proportion of 'on' time to the regular interval or 'period' of time; a low duty cycle corresponds to low power, because the power is off for most of the time. Duty cycle is expressed in percent, 100% being fully on.
As described above, to perform an accurate detection, the debounce time and proper PWM settings are supported. The supported features of ACCDET driver are listed below:
Functions | |
| hal_accdet_status_t | hal_accdet_init (void) |
| ACCDET initialize function. More... | |
| hal_accdet_status_t | hal_accdet_deinit (void) |
| ACCDET deinitialization function. More... | |
| hal_accdet_status_t | hal_accdet_enable (void) |
| ACCDET enable function. More... | |
| hal_accdet_status_t | hal_accdet_disable (void) |
| ACCDET disable function. More... | |
| hal_accdet_status_t | hal_accdet_register_callback (hal_accdet_callback_t accdet_callback, void *user_data) |
| register callback function for ACCDET interrupt. More... | |
| hal_accdet_status_t | hal_accdet_set_debounce_time (const hal_accdet_debounce_time_t *debounce_time) |
| set debounce time for the ACCDET. More... | |
Modules | |
| Enum | |
| Struct | |
| Typedef | |
| hal_accdet_status_t hal_accdet_deinit | ( | void | ) |
ACCDET deinitialization function.
| hal_accdet_status_t hal_accdet_disable | ( | void | ) |
ACCDET disable function.
Disable the ACCDET module.
| hal_accdet_status_t hal_accdet_enable | ( | void | ) |
ACCDET enable function.
Enable the ACCDET module.
| hal_accdet_status_t hal_accdet_init | ( | void | ) |
ACCDET initialize function.
| hal_accdet_status_t hal_accdet_register_callback | ( | hal_accdet_callback_t | accdet_callback, |
| void * | user_data | ||
| ) |
register callback function for ACCDET interrupt.
| [in] | accdet_callback | is the pointer to the ACCDET callback function. |
| [in] | user_data | is the user data of callback function. |
| hal_accdet_status_t hal_accdet_set_debounce_time | ( | const hal_accdet_debounce_time_t * | debounce_time | ) |
set debounce time for the ACCDET.
| [in] | debounce_time | is pointer of the debounce value structure of ACCDET, the unit of debounce is millisecond. |