mirror of
https://gitlab.com/hyperglitch/jellyfish.git
synced 2025-12-27 15:16:46 +00:00
39 lines
882 B
C
39 lines
882 B
C
/*
|
|
* SPDX-FileCopyrightText: 2025 Igor Brkic <igor@hyperglitch.com>
|
|
*
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
*/
|
|
|
|
#ifndef JF_ADC_H
|
|
#define JF_ADC_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
typedef enum {
|
|
JF_ADC_VSENSE_DC,
|
|
JF_ADC_VSENSE_USB0,
|
|
JF_ADC_VSENSE_USB1,
|
|
JF_ADC_NTC1,
|
|
JF_ADC_NTC2,
|
|
JF_ADC_AUX_ISENSE,
|
|
JF_ADC_AUX_VSENSE,
|
|
JF_ADC_TEMPERATURE,
|
|
JF_ADC_VREFINT,
|
|
JF_ADC_CHANNEL_COUNT
|
|
} jf_adc_channel_t;
|
|
|
|
typedef int32_t (*jf_adc_callback_t)(int32_t);
|
|
|
|
// NOTE: if changing make sure to also update the label array in jf_adc.c
|
|
extern const char jf_adc_channel_labels[JF_ADC_CHANNEL_COUNT][13];
|
|
|
|
void jf_adc_process(const uint32_t* adc_buff);
|
|
const int32_t* jf_adc_get_values();
|
|
|
|
// register custom callback to process the value
|
|
bool jf_adc_register_callback(jf_adc_channel_t channel, jf_adc_callback_t callback);
|
|
|
|
|
|
#endif //JF_ADC_H
|