Loading...
Searching...
No Matches
furi_hal_adc.h
Go to the documentation of this file.
1
33#pragma once
34
35#include <furi.h>
36#include <stdbool.h>
37#include <stdint.h>
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
44
49
55
67
78
108
110void furi_hal_adc_init(void);
111
119
125
152
173 FuriHalAdcHandle* handle,
174 FuriHalAdcScale scale,
175 FuriHalAdcClock clock,
176 FuriHalAdcOversample oversample,
177 FuriHalAdcSamplingTime sampling_time);
178
186uint16_t furi_hal_adc_read(FuriHalAdcHandle* handle, FuriHalAdcChannel channel);
187
195float furi_hal_adc_convert_to_voltage(FuriHalAdcHandle* handle, uint16_t value);
196
205float furi_hal_adc_convert_vref(FuriHalAdcHandle* handle, uint16_t value);
206
215float furi_hal_adc_convert_temp(FuriHalAdcHandle* handle, uint16_t value);
216
225float furi_hal_adc_convert_vbat(FuriHalAdcHandle* handle, uint16_t value);
226
227#ifdef __cplusplus
228}
229#endif
float furi_hal_adc_convert_vref(FuriHalAdcHandle *handle, uint16_t value)
Convert sampled VREFINT value to voltage.
Definition furi_hal_adc.c:270
FuriHalAdcOversample
Definition furi_hal_adc.h:56
@ FuriHalAdcOversample128
ADC will take 128 samples per each value.
Definition furi_hal_adc.h:63
@ FuriHalAdcOversample4
ADC will take 4 samples per each value.
Definition furi_hal_adc.h:58
@ FuriHalAdcOversample8
ADC will take 8 samples per each value.
Definition furi_hal_adc.h:59
@ FuriHalAdcOversample16
ADC will take 16 samples per each value.
Definition furi_hal_adc.h:60
@ FuriHalAdcOversample256
ADC will take 256 samples per each value.
Definition furi_hal_adc.h:64
@ FuriHalAdcOversample32
ADC will take 32 samples per each value.
Definition furi_hal_adc.h:61
@ FuriHalAdcOversampleNone
disable oversampling
Definition furi_hal_adc.h:65
@ FuriHalAdcOversample2
ADC will take 2 samples per each value.
Definition furi_hal_adc.h:57
@ FuriHalAdcOversample64
ADC will take 64 samples per each value.
Definition furi_hal_adc.h:62
FuriHalAdcChannel
Definition furi_hal_adc.h:79
@ FuriHalAdcChannel14
Channel 14p or 13n.
Definition furi_hal_adc.h:96
@ FuriHalAdcChannel18
Internal channel, see FuriHalAdcChannelVBAT.
Definition furi_hal_adc.h:100
@ FuriHalAdcChannel7
Channel 7p or 6n.
Definition furi_hal_adc.h:89
@ FuriHalAdcChannel0
Internal channel, see FuriHalAdcChannelVREFINT.
Definition furi_hal_adc.h:81
@ FuriHalAdcChannel13
Channel 13p or 12n.
Definition furi_hal_adc.h:95
@ FuriHalAdcChannel2
Channel 2p or 1n.
Definition furi_hal_adc.h:83
@ FuriHalAdcChannelVREFINT
Special channel for VREFINT, used for calibration and self test.
Definition furi_hal_adc.h:102
@ FuriHalAdcChannel15
Channel 15p or 14n.
Definition furi_hal_adc.h:97
@ FuriHalAdcChannel10
Channel 10p or 9n.
Definition furi_hal_adc.h:92
@ FuriHalAdcChannel17
Internal channel, see FuriHalAdcChannelTEMPSENSOR.
Definition furi_hal_adc.h:99
@ FuriHalAdcChannel5
Channel 5p or 4n.
Definition furi_hal_adc.h:86
@ FuriHalAdcChannel1
Channel 1p.
Definition furi_hal_adc.h:82
@ FuriHalAdcChannel9
Channel 9p or 8n.
Definition furi_hal_adc.h:91
@ FuriHalAdcChannel11
Channel 11p or 10n.
Definition furi_hal_adc.h:93
@ FuriHalAdcChannel4
Channel 4p or 3n.
Definition furi_hal_adc.h:85
@ FuriHalAdcChannelNone
No channel.
Definition furi_hal_adc.h:106
@ FuriHalAdcChannelVBAT
Special channel for VBAT/3 voltage, requires at least 12us of sampling time.
Definition furi_hal_adc.h:104
@ FuriHalAdcChannel12
Channel 12p or 11n.
Definition furi_hal_adc.h:94
@ FuriHalAdcChannelTEMPSENSOR
Special channel for on-die temperature sensor, requires at least 5us of sampling time.
Definition furi_hal_adc.h:103
@ FuriHalAdcChannel3
Channel 3p or 2n.
Definition furi_hal_adc.h:84
@ FuriHalAdcChannel16
Channel 16p or 15n.
Definition furi_hal_adc.h:98
@ FuriHalAdcChannel8
Channel 8p or 7n.
Definition furi_hal_adc.h:90
@ FuriHalAdcChannel6
Channel 6p or 5n.
Definition furi_hal_adc.h:88
FuriHalAdcClock
Definition furi_hal_adc.h:50
@ FuriHalAdcClockSync16
16MHZ, synchronous
Definition furi_hal_adc.h:51
@ FuriHalAdcClockSync64
64MHz, synchronous
Definition furi_hal_adc.h:53
@ FuriHalAdcClockSync32
32MHZ, synchronous
Definition furi_hal_adc.h:52
float furi_hal_adc_convert_to_voltage(FuriHalAdcHandle *handle, uint16_t value)
Convert sampled value to voltage.
Definition furi_hal_adc.c:266
FuriHalAdcHandle * furi_hal_adc_acquire(void)
Acquire ADC handle.
Definition furi_hal_adc.c:95
FuriHalAdcScale
Definition furi_hal_adc.h:45
@ FuriHalAdcScale2048
2.048V scale
Definition furi_hal_adc.h:46
@ FuriHalAdcScale2500
2.5V scale
Definition furi_hal_adc.h:47
void furi_hal_adc_configure_ex(FuriHalAdcHandle *handle, FuriHalAdcScale scale, FuriHalAdcClock clock, FuriHalAdcOversample oversample, FuriHalAdcSamplingTime sampling_time)
Configure with extended parameters and enable ADC.
Definition furi_hal_adc.c:127
void furi_hal_adc_init(void)
Initialize ADC subsystem.
Definition furi_hal_adc.c:89
float furi_hal_adc_convert_temp(FuriHalAdcHandle *handle, uint16_t value)
Convert sampled TEMPSENSOR value to temperature.
Definition furi_hal_adc.c:275
void furi_hal_adc_configure(FuriHalAdcHandle *handle)
Configure with default parameters and enable ADC.
Definition furi_hal_adc.c:118
uint16_t furi_hal_adc_read(FuriHalAdcHandle *handle, FuriHalAdcChannel channel)
Read single ADC value.
Definition furi_hal_adc.c:247
float furi_hal_adc_convert_vbat(FuriHalAdcHandle *handle, uint16_t value)
Convert sampled VBAT value to voltage.
Definition furi_hal_adc.c:279
void furi_hal_adc_release(FuriHalAdcHandle *handle)
Release ADC handle.
Definition furi_hal_adc.c:105
FuriHalAdcSamplingTime
Definition furi_hal_adc.h:68
@ FuriHalAdcSamplingtime640_5
Sampling time 640.5 ADC clock.
Definition furi_hal_adc.h:76
@ FuriHalAdcSamplingtime24_5
Sampling time 24.5 ADC clock.
Definition furi_hal_adc.h:72
@ FuriHalAdcSamplingtime12_5
Sampling time 12.5 ADC clock.
Definition furi_hal_adc.h:71
@ FuriHalAdcSamplingtime2_5
Sampling time 2.5 ADC clock.
Definition furi_hal_adc.h:69
@ FuriHalAdcSamplingtime6_5
Sampling time 6.5 ADC clock.
Definition furi_hal_adc.h:70
@ FuriHalAdcSamplingtime247_5
Sampling time 247.5 ADC clock.
Definition furi_hal_adc.h:75
@ FuriHalAdcSamplingtime47_5
Sampling time 47.5 ADC clock.
Definition furi_hal_adc.h:73
@ FuriHalAdcSamplingtime92_5
Sampling time 92.5 ADC clock.
Definition furi_hal_adc.h:74
Definition furi_hal_adc.c:11