Skip to content

Commit 66a0d8e

Browse files
Merge branch 'main' into fixed_r4wifi
2 parents 0c33dc3 + b55b0d6 commit 66a0d8e

File tree

3 files changed

+103
-2
lines changed

3 files changed

+103
-2
lines changed

.github/workflows/render-documentation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121
render-docs:
2222
permissions:
2323
contents: write
24-
uses: arduino/render-docs-github-action/.github/workflows/render-docs.yml@deps-install-fix
24+
uses: arduino/render-docs-github-action/.github/workflows/render-docs.yml@main
2525
with:
2626
source-path: './src'
2727
target-path: './docs/api.md'
28-
fail-on-warnings: true
28+
fail-on-warnings: true

docs/api.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Summary
2+
3+
Members | Descriptions
4+
--------------------------------|---------------------------------------------
5+
`class ` [`CapacitiveTouch`](#class_capacitive_touch) | A user-friendly class for capacitive touch sensing.
6+
7+
# class `CapacitiveTouch` <a id="class_capacitive_touch" class="anchor"></a>
8+
9+
A user-friendly class for capacitive touch sensing.
10+
11+
Create an instance with: <br/>[CapacitiveTouch](#class_capacitive_touch) ct = [CapacitiveTouch(LOVE_BUTTON)](#class_capacitive_touch);
12+
13+
## Summary
14+
15+
Members | Descriptions
16+
--------------------------------|---------------------------------------------
17+
| [`CapacitiveTouch`](#class_capacitive_touch_1ac22af64579b04c74118d037b1a8715f2) | Constructs a capacitive touch sensor for the given pin. |
18+
| [`begin`](#class_capacitive_touch_1a0cce24fac4a98cecf7840ebf435a5d9c) | Initializes the sensor. |
19+
| [`read`](#class_capacitive_touch_1a5c7b56cc0ad47963fa0b97abe2909aba) | Reads the raw sensor value. |
20+
| [`isTouched`](#class_capacitive_touch_1aab0faf01526c57e1f0f57aa19919d9fa) | Checks if the sensor is touched. |
21+
| [`setThreshold`](#class_capacitive_touch_1a5f773cd9472164c698811962070f903c) | Sets the detection threshold. |
22+
| [`getThreshold`](#class_capacitive_touch_1a64a1533e5ea3109c2ff15a3abf22bbba) | Retrieves the current detection threshold. |
23+
24+
## Members
25+
26+
### `CapacitiveTouch` <a id="class_capacitive_touch_1ac22af64579b04c74118d037b1a8715f2" class="anchor"></a>
27+
28+
```cpp
29+
CapacitiveTouch(uint8_t pin)
30+
```
31+
32+
Constructs a capacitive touch sensor for the given pin.
33+
34+
#### Parameters
35+
* `pin` The Arduino pin number (such as LOVE_BUTTON).
36+
<hr />
37+
38+
### `begin` <a id="class_capacitive_touch_1a0cce24fac4a98cecf7840ebf435a5d9c" class="anchor"></a>
39+
40+
```cpp
41+
void begin()
42+
```
43+
44+
Initializes the sensor.
45+
46+
Configures the pin and initializes the CTSU/DTC hardware.
47+
<hr />
48+
49+
### `read` <a id="class_capacitive_touch_1a5c7b56cc0ad47963fa0b97abe2909aba" class="anchor"></a>
50+
51+
```cpp
52+
int read()
53+
```
54+
55+
Reads the raw sensor value.
56+
57+
Initiates a measurement cycle and returns the raw value.
58+
#### Returns
59+
int The raw sensor value.
60+
<hr />
61+
62+
### `isTouched` <a id="class_capacitive_touch_1aab0faf01526c57e1f0f57aa19919d9fa" class="anchor"></a>
63+
64+
```cpp
65+
bool isTouched()
66+
```
67+
68+
Checks if the sensor is touched.
69+
70+
Compares the raw value to the set threshold.
71+
#### Returns
72+
true if the sensor is touched, false otherwise.
73+
<hr />
74+
75+
### `setThreshold` <a id="class_capacitive_touch_1a5f773cd9472164c698811962070f903c" class="anchor"></a>
76+
77+
```cpp
78+
void setThreshold(int threshold)
79+
```
80+
81+
Sets the detection threshold.
82+
83+
#### Parameters
84+
* `threshold` The new threshold value.
85+
<hr />
86+
87+
### `getThreshold` <a id="class_capacitive_touch_1a64a1533e5ea3109c2ff15a3abf22bbba" class="anchor"></a>
88+
89+
```cpp
90+
int getThreshold()
91+
```
92+
93+
Retrieves the current detection threshold.
94+
95+
#### Returns
96+
int The current threshold value.
97+
<hr />
98+

src/CapacitiveTouch.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
// Define a symbolic constant for the LOVE button (special pin).
1616
#define LOVE_BUTTON 20
17+
1718
/**
1819
* @struct CapTouchPinMapping
1920
* @brief Defines the mapping between an Arduino pin and its capacitive touch hardware settings.
@@ -29,6 +30,8 @@ struct CapTouchPinMapping {
2930
uint8_t chac_val; ///< Bit mask used to enable the sensor channel.
3031
};
3132

33+
/// @endcond
34+
3235
#if defined(ARDUINO_UNOR4_MINIMA)
3336
static const CapTouchPinMapping capTouchMappings[] = {
3437
{0, true, 9, 1, (1 << 1)},

0 commit comments

Comments
 (0)