gossamer 0.0.0
a very lightweight app framework for SAMD and SAML chips
Loading...
Searching...
No Matches
ptc.h
Go to the documentation of this file.
1
5/*
6 * FreeTouch, a QTouch-compatible library - tested on ATSAMD21 only!
7 * The MIT License (MIT)
8 *
9 * Copyright (c) 2017 Limor 'ladyada' Fried for Adafruit Industries
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27 * THE SOFTWARE.
28 */
29
30#pragma once
31
32#include <stdbool.h>
33#include <stdint.h>
34#include "sam.h"
35
36#ifdef _SAMD21_
37#include "component/samd21_ptc_component.h"
38#define HAS_PTC 1
39#endif
40
41#ifdef _SAMD11_
42#include "component/samd11_ptc_component.h"
43#define HAS_PTC 1
44#endif
45
46#ifdef HAS_PTC
47
48/* Touch library oversampling (filter) setting */
49typedef enum tag_oversample_level_t {
50 OVERSAMPLE_1,
51 OVERSAMPLE_2,
52 OVERSAMPLE_4,
53 OVERSAMPLE_8,
54 OVERSAMPLE_16,
55 OVERSAMPLE_32,
56 OVERSAMPLE_64
57} ptc_oversample_t;
58
59/* Touch library series resistor setting */
60typedef enum tag_series_resistor_t {
61 RESISTOR_0,
62 RESISTOR_20K,
63 RESISTOR_50K,
64 RESISTOR_100K,
65} ptc_series_resistor_t;
66
67typedef enum tag_freq_mode_t {
68 FREQ_MODE_NONE,
69 FREQ_MODE_HOP,
70 FREQ_MODE_SPREAD,
71 FREQ_MODE_SPREAD_MEDIAN
72} ptc_freq_mode_t;
73
74typedef enum tag_freq_hop_t {
75 FREQ_HOP_1,
76 FREQ_HOP_2,
77 FREQ_HOP_3,
78 FREQ_HOP_4,
79 FREQ_HOP_5,
80 FREQ_HOP_6,
81 FREQ_HOP_7,
82 FREQ_HOP_8,
83 FREQ_HOP_9,
84 FREQ_HOP_10,
85 FREQ_HOP_11,
86 FREQ_HOP_12,
87 FREQ_HOP_13,
88 FREQ_HOP_14,
89 FREQ_HOP_15,
90 FREQ_HOP_16
91} ptc_freq_hop_t;
92
96void ptc_init(void);
97
104void ptc_enable(uint8_t channel);
105
111uint16_t ptc_get_value(uint8_t channel);
112
113#endif