M5UnitUnified 0.0.5 git rev:3b942a7
Loading...
Searching...
No Matches
pin.hpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD
3 *
4 * SPDX-License-Identifier: MIT
5 */
11#ifndef M5_UNIT_COMPONENT_PIN_HPP
12#define M5_UNIT_COMPONENT_PIN_HPP
13#include <cstdint>
14
15namespace m5 {
16namespace unit {
17namespace gpio {
18
19// From M5GFX
21public:
22 explicit pin_backup_t(int pin_num = 1);
23 inline void setPin(int pin_num)
24 {
25 _pin_num = pin_num;
26 }
27 inline int8_t getPin(void) const
28 {
29 return _pin_num;
30 }
31 void backup(void);
32 void restore(void);
33
34private:
35 uint32_t _io_mux_gpio_reg{};
36 uint32_t _gpio_pin_reg{};
37 uint32_t _gpio_func_out_reg{};
38 uint32_t _gpio_func_in_reg{};
39 int16_t _in_func_num{-1};
40 int8_t _pin_num{-1}; // GPIO_NUM_NC
41 bool _gpio_enable{};
42};
43
44} // namespace gpio
45} // namespace unit
46} // namespace m5
47#endif
Definition pin.hpp:20
Top level namespace of M5stack.
Definition test_helper.hpp:18
Unit-related namespace.