#pragma once
#include "sygah-metadata.hpp"
#include "sygah-endpoints.hpp"
namespace sygaldry { namespace sygsr {
static constexpr unsigned int ADC_CHANNEL_0 = 0;
static constexpr unsigned int ADC_CHANNEL_1 = 1;
static constexpr unsigned int ADC_CHANNEL_2 = 2;
static constexpr unsigned int ADC_CHANNEL_3 = 3;
static constexpr unsigned int ADC_GPIO[] = {26,27,28,29};
template<unsigned int input_number>
struct OneshotAdc
: name_<"ADC">
, description_<"Oneshot analog-digital converter">
, author_<"Travis J. West">
, copyright_<"Copyright 2023 Sygaldry Contributors">
, license_<"SPDX-License-Identifier: MIT">
, version_<"0.0.0">
{
static_assert(ADC_CHANNEL_0 <= input_number && input_number <= ADC_CHANNEL_3);
struct outputs_t {
slider<"raw", "raw binary representation of the analog voltage measured by the ADC"
, int, 0, 4096, 0
> raw;
} outputs;
void init();
void main();
};
extern template struct OneshotAdc<ADC_CHANNEL_0>;
extern template struct OneshotAdc<ADC_CHANNEL_1>;
extern template struct OneshotAdc<ADC_CHANNEL_2>;
extern template struct OneshotAdc<ADC_CHANNEL_3>;
} }