Sygaldry
Loading...
Searching...
No Matches
sygse-adc.hpp
1#pragma once
2/*
3Copyright 2023 Travis J. West, https://traviswest.ca, Input Devices and Music
4Interaction Laboratory (IDMIL), Centre for Interdisciplinary Research in Music
5Media and Technology (CIRMMT), McGill University, Montréal, Canada, and Univ.
6Lille, Inria, CNRS, Centrale Lille, UMR 9189 CRIStAL, F-59000 Lille, France
7
8SPDX-License-Identifier: MIT
9*/
10
11#include "sygah-endpoints.hpp"
12#include "sygah-metadata.hpp"
13#include "syghe-pins.hpp"
14
15namespace sygaldry { namespace sygse {
16
19
21
24 slider<"raw", "raw binary representation of the analog voltage measured by the ADC"
25 , int, 0, 4096, 0 // esp32 technical reference manual V5 section 29.3 says 12 bit max resolution
26 > raw;
27};
28
29namespace detail {
31{
33 void * pimpl;
34 void init(int gpio_num, outputs_t& outputs);
35 void main(outputs_t& outputs);
36};
37}
38
49template<syghe::AdcChannel gpio_num>
51: name_<"ESP32 Oneshot ADC">
52, author_<"Travis J. West">
53, copyright_<"Copyright 2023 Sygaldry Contributors">
54, license_<"SPDX-License-Identifier: MIT">
55{
57 outputs_t outputs;
59
61 void init() {pimpl.init(gpio_num, outputs);}
62
64 void main() {pimpl.main(outputs);}
65};
66
69
70} }
Document the author of an entity, e.g. a component or binding.
Definition sygah-metadata.hpp:39
Document the copyright statement of an entity, e.g. a component or binding.
Definition sygah-metadata.hpp:47
Document the copyright license of an entity, e.g. a component or binding.
Definition sygah-metadata.hpp:45
Document the name of an entity, e.g. an endpoint, component, or binding.
Definition sygah-metadata.hpp:33
A numeric endpoint with user customizeable range and persistent value semantics.
Definition sygah-endpoints.hpp:348
Output endpoints for OneshotAdc.
Definition sygse-adc.hpp:23
Driver component for the analog-digital converter.
Definition sygse-adc.hpp:55
void main()
Poll the current value of the given ADC1 channel.
Definition sygse-adc.hpp:64
void init()
Configure the ADC1 channel for the given gpio_num in oneshot read mode.
Definition sygse-adc.hpp:61
Definition sygse-adc.hpp:31