|
| 1 | +/* |
| 2 | + * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: Apache-2.0 |
| 5 | + */ |
| 6 | + |
| 7 | +#pragma once |
| 8 | + |
| 9 | +#include "port/esp_lcd_touch_cst9217.h" |
| 10 | +#include "esp_panel_touch_conf_internal.h" |
| 11 | +#include "esp_panel_touch.hpp" |
| 12 | + |
| 13 | +namespace esp_panel::drivers { |
| 14 | + |
| 15 | +/** |
| 16 | + * @brief CST9217 touch controller |
| 17 | + * |
| 18 | + * This class provides implementation for CST9217 touch controller, inheriting from |
| 19 | + * the base Touch class to provide common touch functionality |
| 20 | + */ |
| 21 | +class TouchCST9217 : public Touch { |
| 22 | +public: |
| 23 | + /** |
| 24 | + * @brief Default basic attributes for CST9217 |
| 25 | + */ |
| 26 | + static constexpr BasicAttributes BASIC_ATTRIBUTES_DEFAULT = { |
| 27 | + .name = "CST9217", |
| 28 | + .max_points_num = 1, |
| 29 | + }; |
| 30 | + |
| 31 | + /** |
| 32 | + * @brief Construct a touch device instance with individual configuration parameters |
| 33 | + * |
| 34 | + * @param bus Bus interface for communicating with the touch device |
| 35 | + * @param width Panel width in pixels |
| 36 | + * @param height Panel height in pixels |
| 37 | + * @param rst_io Reset GPIO pin number (-1 if unused) |
| 38 | + * @param int_io Interrupt GPIO pin number (-1 if unused) |
| 39 | + */ |
| 40 | + TouchCST9217(Bus *bus, uint16_t width, uint16_t height, int rst_io = -1, int int_io = -1): |
| 41 | + Touch(BASIC_ATTRIBUTES_DEFAULT, bus, width, height, rst_io, int_io) |
| 42 | + { |
| 43 | + } |
| 44 | + |
| 45 | + /** |
| 46 | + * @brief Construct a touch device instance with configuration |
| 47 | + * |
| 48 | + * @param[in] bus Pointer to the bus interface for communicating with the touch device |
| 49 | + * @param[in] config Configuration structure containing device settings and parameters |
| 50 | + */ |
| 51 | + TouchCST9217(Bus *bus, const Config &config): Touch(BASIC_ATTRIBUTES_DEFAULT, bus, config) {} |
| 52 | + |
| 53 | + /** |
| 54 | + * @brief Construct a touch device instance with bus configuration and device configuration |
| 55 | + * |
| 56 | + * @param[in] bus_config Bus configuration |
| 57 | + * @param[in] touch_config Touch configuration |
| 58 | + * @note This constructor creates a new bus instance using the provided bus configuration |
| 59 | + */ |
| 60 | + TouchCST9217(const BusFactory::Config &bus_config, const Config &touch_config): |
| 61 | + Touch(BASIC_ATTRIBUTES_DEFAULT, bus_config, touch_config) |
| 62 | + { |
| 63 | + } |
| 64 | + |
| 65 | + /** |
| 66 | + * @brief Destruct touch device |
| 67 | + */ |
| 68 | + ~TouchCST9217() override; |
| 69 | + |
| 70 | + /** |
| 71 | + * @brief Startup the touch device |
| 72 | + * |
| 73 | + * @return `true` if success, otherwise false |
| 74 | + * |
| 75 | + * @note This function should be called after `init()` |
| 76 | + */ |
| 77 | + bool begin() override; |
| 78 | +}; |
| 79 | + |
| 80 | +} // namespace esp_panel::drivers |
0 commit comments