类型定义 | |
| typedef aos_dev_ref_t | aos_adc_ref_t |
枚举 | |
| enum | aos_adc_mode_t { AOS_ADC_MODE_SINGLE , AOS_ADC_MODE_CONTINUE } |
函数 | |
| aos_status_t | aos_adc_get (aos_adc_ref_t *ref, uint32_t id) |
| void | aos_adc_put (aos_adc_ref_t *ref) |
| aos_status_t | aos_adc_set_sample_time (aos_adc_ref_t *ref, int32_t channel, uint32_t time) |
| aos_status_t | aos_adc_set_mode (aos_adc_ref_t *ref, aos_adc_mode_t mode) |
| aos_status_t | aos_adc_get_resolution (aos_adc_ref_t *ref, uint32_t *resolution) |
| aos_status_t | aos_adc_get_range (aos_adc_ref_t *ref, int32_t channel, uint32_t *range) |
| aos_status_t | aos_adc_read (aos_adc_ref_t *ref, int32_t channel, int32_t *data) |
| aos_status_t | aos_adc_read_voltage (aos_adc_ref_t *ref, int32_t channel, int32_t *data) |
给应用提供ADC操作的AOS API。
| typedef aos_dev_ref_t aos_adc_ref_t |
| enum aos_adc_mode_t |
| aos_status_t aos_adc_get | ( | aos_adc_ref_t * | ref, |
| uint32_t | id | ||
| ) |
获取一个ADC设备的引用
| [out] | ref | ADC设备的引用 |
| [in] | id | ADC设备ID |
| aos_status_t aos_adc_get_range | ( | aos_adc_ref_t * | ref, |
| int32_t | channel, | ||
| uint32_t * | range | ||
| ) |
获取ADC设备的电压量程(单位:mV)
| [in] | ref | ADC设备的引用 |
| [in] | channel | >=0: 一个通道的ID -1: ADC设备的所有通道(相同的量程) |
| [out] | range | ADC设备的电压量程(单位:mV) |
| aos_status_t aos_adc_get_resolution | ( | aos_adc_ref_t * | ref, |
| uint32_t * | resolution | ||
| ) |
获取ADC设备的分辨率
| [in] | ref | ADC设备的引用 |
| [out] | resolution | ADC设备的分辨率 (单位:bits) |
| void aos_adc_put | ( | aos_adc_ref_t * | ref | ) |
释放一个ADC设备的引用
| [in] | ref | ADC设备的引用 |
| aos_status_t aos_adc_read | ( | aos_adc_ref_t * | ref, |
| int32_t | channel, | ||
| int32_t * | data | ||
| ) |
从ADC设备的一个通道读取原始数据 (同步方式)
| [in] | ref | ADC设备的引用 |
| [in] | channel | 通道ID |
| [out] | data | 输出的ADC原始数据 |
| aos_status_t aos_adc_read_voltage | ( | aos_adc_ref_t * | ref, |
| int32_t | channel, | ||
| int32_t * | data | ||
| ) |
从ADC设备的一个通道读取转换后的电压值(单位: mV) (同步方式)
| [in] | ref | ADC设备的引用 |
| [in] | channel | 通道ID |
| [out] | data | 输出的ADC转换后电压值(单位: mV) |
| aos_status_t aos_adc_set_mode | ( | aos_adc_ref_t * | ref, |
| aos_adc_mode_t | mode | ||
| ) |
设置ADC设备的工作模式
| [in] | ref | ADC设备的引用 |
| [in] | mode | 工作模式, 当前支持的模式: AOS_ADC_MODE_SINGLE: 单次采样模式 AOS_ADC_MODE_CONTINUE: 连续采样模式 |
| aos_status_t aos_adc_set_sample_time | ( | aos_adc_ref_t * | ref, |
| int32_t | channel, | ||
| uint32_t | time | ||
| ) |
设置ADC设备的一个通道的采样时间
| [in] | ref | ADC设备的引用 |
| [in] | channel | >=0: 一个通道的ID -1: ADC设备的所有通道 |
| [in] | time | 采样时间(单位:us) |