mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
909f5a070f
Add hw-adc gem with analog-to-digital conversion support: - Common Ruby API with read, read_raw, and read_voltage - ports/esp32/ using ESP-IDF ADC oneshot driver - ports/rp2040/ using Pico SDK ADC hardware Based on picoruby-adc by HASUMI Hitoshi. Co-authored-by: Claude <noreply@anthropic.com>
20 lines
341 B
C
20 lines
341 B
C
#ifndef MRUBY_ADC_H
|
|
#define MRUBY_ADC_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* HAL functions - implemented in ports/<platform>/adc.c */
|
|
int mrb_adc_init(uint8_t pin);
|
|
uint32_t mrb_adc_read_raw(uint8_t input);
|
|
float mrb_adc_read_voltage(uint8_t input);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* MRUBY_ADC_H */
|