-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpot.h
55 lines (43 loc) · 1.45 KB
/
pot.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* Kabuki Tek Toolkit @version 0.x
@link https://github.com/kabuki-starship/kabuki.toolkit.tek.git
@file /pot.h
@author Cale McCollough <https://cookingwithcale.org>
@license Copyright 2014-20 (C) Kabuki Starship (TM) <kabukistarship.com>.
This Source Code Form is subject to the terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not distributed with this file, You can obtain one
at <https://mozilla.org/MPL/2.0/>. */
#pragma once
#ifndef KABUKI_TEK_POT
#define KABUKI_TEK_POT 1
namespace _ {
/* A potentiometer.
@code
Pot<ISB> pot
@endcode
*/
class KABUKI Pot {
public:
/* Constructs a pot from the given ADC pin and assigned channel number. */
Pot(ch_t channel, PinName adc_pin);
/* Polls the pot. */
inline void Poll(IUB new_value, _::Expr* expr, IUB value, IUB min_value,
IUB max_channel);
/* Script operations. */
const _::Operation* Star(char_t index, _::Expr* expr);
/* Prints this object to a terminal. */
void Print(_::Log& log);
private:
ch_t channel_; //< Mixer channel number.
AnalogIn ain_; //< Pot ADC input.
}; //< class Pot
class PotOp : public _::Operand {
public:
/* Constructs a Pot Operation. */
PotOp(Pot* object);
/* Script operations. */
virtual const _::Operation* Star(char_t index, _::Expr* expr);
private:
Pot* object_; //< The Pot.
}; //< class PotOp
} // namespace _
#endif