57 lines
No EOL
1.1 KiB
C
57 lines
No EOL
1.1 KiB
C
/*
|
|
* @file adc.h
|
|
* @brief
|
|
*
|
|
* Created: 27.09.2025 05:06:42
|
|
* Author: ThePetrovich
|
|
*
|
|
* Copyright YKSA - Sakha Aerospace Systems, LLC.
|
|
* See the LICENSE file for details.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
|
|
#ifndef ADC_H_
|
|
#define ADC_H_
|
|
|
|
#include <stdint.h>
|
|
|
|
/**
|
|
* @brief Enable ADC for fast radiation detection
|
|
*/
|
|
void adc_enable_fast(void);
|
|
|
|
/**
|
|
* @brief Restore ADC to default settings
|
|
*/
|
|
void adc_restore_default(void);
|
|
|
|
/**
|
|
* @brief Convert ADC reading to temperature in 0.1°C
|
|
* @param adc_value 12-bit ADC reading
|
|
* @return Temperature in 0.1°C
|
|
*/
|
|
int16_t adc_to_temperature_c(uint16_t adc_value);
|
|
|
|
/**
|
|
* @brief Convert ADC reading to voltage in mV
|
|
* @param adc_value ADC reading
|
|
* @return Voltage in mV
|
|
*/
|
|
uint16_t adc_to_voltage_mv(uint16_t adc_value);
|
|
|
|
/**
|
|
* @brief Read ADC with oversampling
|
|
* @param pin Analog pin to read
|
|
* @param samples Number of samples for oversampling
|
|
* @return Averaged ADC value
|
|
*/
|
|
uint16_t adc_read_oversampled(uint8_t pin, uint8_t samples);
|
|
|
|
/**
|
|
* @brief Command to calibrate ADC and read reference values
|
|
*/
|
|
void adc_cmd_calibrate(void);
|
|
|
|
#endif // ADC_H_
|