Serial Wombat Arduino Library
SerialWombat18CapTouch.h
Go to the documentation of this file.
1 #pragma once
2 /*
3 Copyright 2021 Broadwell Consulting Inc.
4 
5 "Serial Wombat" is a registered trademark of Broadwell Consulting Inc. in
6 the United States. See SerialWombat.com for usage guidance.
7 
8 Permission is hereby granted, free of charge, to any person obtaining a
9  * copy of this software and associated documentation files (the "Software"),
10  * to deal in the Software without restriction, including without limitation
11  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12  * and/or sell copies of the Software, and to permit persons to whom the
13  * Software is furnished to do so, subject to the following conditions:
14 
15 The above copyright notice and this permission notice shall be included in
16  * all copies or substantial portions of the Software.
17 
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
22  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24  * OTHER DEALINGS IN THE SOFTWARE.
25 */
26 
27 #include <stdint.h>
28 #include "SerialWombat.h"
29 #include "limits.h"
30 
84 {
85 public:
86 
89 
90 
100  int16_t begin(uint8_t pin, uint16_t chargeTime, uint16_t delay = 10);
101 
110  int16_t makeDigital(uint16_t touchLimit, uint16_t noTouchLimit);
111 
122  int16_t makeDigital(uint16_t touchLimit, uint16_t noTouchLimit, uint16_t touchValue, uint16_t noTouchValue, bool invert,uint16_t debounceCount);
123  int16_t makeAnalog();
124 
131  bool digitalRead();
132 
138  uint16_t readDurationInTrueState_mS();
144  uint16_t readDurationInFalseState_mS();
145 
147  uint16_t transitions = 0;
148 
156  bool readTransitionsState();
157 
158 
159 
160 private:
161 
162  uint16_t _trueOutput = 1;
163  uint16_t _falseOutput = 1;
164 };
SerialWombat18CapTouch::readDurationInFalseState_mS
uint16_t readDurationInFalseState_mS()
return the number of mS that the debounced input has been in false state
Definition: SerialWombat18CapTouch.cpp:88
SerialWombatChip
Class for a Serial Wombat chip. Each Serial Wombat chip on a project should have its own instance.
Definition: SerialWombat.h:265
SerialWombat18CapTouch::digitalRead
bool digitalRead()
Returns the debounced state of the input.
Definition: SerialWombat18CapTouch.cpp:59
SerialWombat18CapTouch::readTransitionsState
bool readTransitionsState()
Queries the number of transistions that have occured on the debounced input.
Definition: SerialWombat18CapTouch.cpp:106
SerialWombat18CapTouch::begin
int16_t begin(uint8_t pin, uint16_t chargeTime, uint16_t delay=10)
Initialize the SerialWombat18CapTouch instance with a given charge Time in uS.
Definition: SerialWombat18CapTouch.cpp:10
SerialWombat18CapTouch::makeDigital
int16_t makeDigital(uint16_t touchLimit, uint16_t noTouchLimit)
Make a cap touch behave like a digital button.
Definition: SerialWombat18CapTouch.cpp:20
SerialWombat.h
SerialWombat18CapTouch
A class that controls a Cap Touch Pin on the Serial Wombat 18AB chip.
Definition: SerialWombat18CapTouch.h:83
SerialWombatPin
Describes a Serial Wombat Pin. Is base class for other pin modes.
Definition: SerialWombat.h:719
SerialWombat18CapTouch::readDurationInTrueState_mS
uint16_t readDurationInTrueState_mS()
return the number of mS that the debounced input has been in true state
Definition: SerialWombat18CapTouch.cpp:71
SerialWombat18CapTouch::transitions
uint16_t transitions
Number of transitions returned by last call to readTransitionsState()
Definition: SerialWombat18CapTouch.h:147
SerialWombatPin::pin
uint8_t pin()
Returns the current SW pin number. Used primarily for virtual calls by derived classes.
Definition: SerialWombat.h:781
SerialWombat18CapTouch::makeAnalog
int16_t makeAnalog()
Definition: SerialWombat18CapTouch.cpp:53
SerialWombat18CapTouch::SerialWombat18CapTouch
SerialWombat18CapTouch(SerialWombatChip &serialWombat)
Instantiate a SerialWombat18CapTouch class on a specified Serial Wombat Chip.
Definition: SerialWombat18CapTouch.cpp:3
SerialWombatAbstractButton
SerialWombat18CapTouch, SerialWombatDebouncedInput and SerialWombatMatrixButton inherit from this cla...
Definition: SerialWombatAbstractButton.h:38