|
5 | 5 | // or copy at http://www.boost.org/LICENSE_1_0.txt) |
6 | 6 | // |
7 | 7 |
|
8 | | -#ifndef MCAL_PORT_2025_02_22_H |
9 | | - #define MCAL_PORT_2025_02_22_H |
| 8 | +#ifndef MCAL_PORT_2025_03_15_H |
| 9 | + #define MCAL_PORT_2025_03_15_H |
10 | 10 |
|
11 | 11 | #include <mcal_reg.h> |
12 | 12 |
|
|
16 | 16 | { |
17 | 17 | typedef void config_type; |
18 | 18 |
|
19 | | - void init(const config_type*); |
| 19 | + inline auto init(const config_type*) -> void { } |
20 | 20 |
|
21 | 21 | template<const std::uint32_t bpos> |
22 | 22 | class port_pin |
23 | 23 | { |
24 | 24 | private: |
25 | | - static constexpr std::uint32_t bit_pos { bpos }; |
| 25 | + static constexpr std::uint32_t gpio_base { mcal::reg::gpio::rtc_gpio_base }; |
| 26 | + static constexpr std::uint32_t gpio_pinxx_reg { gpio_base + std::uint32_t { (UINT32_C(10) + bpos) * UINT32_C(4) } }; |
| 27 | + static constexpr std::uint32_t io_rtc_padxx_reg { gpio_base + std::uint32_t { UINT32_C(0x5C) + (UINT32_C(10) + bpos) * UINT32_C(4) } }; |
26 | 28 |
|
27 | 29 | public: |
28 | | - static void set_direction_output() |
| 30 | + static auto set_direction_output() -> void |
29 | 31 | { |
30 | | - mcal::reg::reg_access_static<std::uint32_t, std::uint32_t, mcal::reg::gpio::out, bit_pos>::bit_clr(); |
31 | | - mcal::reg::reg_access_static<std::uint32_t, std::uint32_t, mcal::reg::gpio::out1, bit_pos>::bit_clr(); |
32 | | - mcal::reg::reg_access_static<std::uint32_t, std::uint32_t, mcal::reg::gpio::enable_w1ts, bit_pos>::bit_set(); |
33 | | - mcal::reg::reg_access_static<std::uint32_t, std::uint32_t, mcal::reg::gpio::enable1_w1ts, bit_pos>::bit_set(); |
| 32 | + //RTC_IO_RTC_PAD17_REG |= (1ul << 19); |
| 33 | + //RTC_GPIO_PIN17_REG = 0; |
| 34 | + //RTC_GPIO_ENABLE_REG |= (1ul << (10 + 17)); |
| 35 | + |
| 36 | + mcal::reg::reg_access_static<std::uint32_t, std::uint32_t, io_rtc_padxx_reg, UINT32_C(19)>::bit_set(); |
| 37 | + mcal::reg::reg_access_static<std::uint32_t, std::uint32_t, gpio_pinxx_reg, UINT32_C(0)>::reg_set(); |
| 38 | + mcal::reg::reg_access_static<std::uint32_t, std::uint32_t, mcal::reg::gpio::rtc_gpio_enable_reg, std::uint32_t { UINT32_C(10) + bpos }>::bit_set(); |
34 | 39 | } |
35 | 40 |
|
36 | | - static void set_direction_input() |
| 41 | + static auto set_direction_input() -> void |
37 | 42 | { |
38 | 43 | } |
39 | 44 |
|
40 | | - static void set_pin_high() |
| 45 | + static auto set_pin_high() -> void |
41 | 46 | { |
42 | | - mcal::reg::reg_access_static<std::uint32_t, std::uint32_t, mcal::reg::gpio::out, bit_pos>::bit_set(); |
| 47 | + mcal::reg::reg_access_static<std::uint32_t, std::uint32_t, mcal::reg::gpio::rtc_gpio_out_reg, std::uint32_t { UINT32_C(10) + bpos }>::bit_set(); |
43 | 48 | } |
44 | 49 |
|
45 | | - static void set_pin_low() |
| 50 | + static auto set_pin_low() -> void |
46 | 51 | { |
47 | | - mcal::reg::reg_access_static<std::uint32_t, std::uint32_t, mcal::reg::gpio::out, bit_pos>::bit_clr(); |
| 52 | + mcal::reg::reg_access_static<std::uint32_t, std::uint32_t, mcal::reg::gpio::rtc_gpio_out_reg, std::uint32_t { UINT32_C(10) + bpos }>::bit_set(); |
48 | 53 | } |
49 | 54 |
|
50 | | - static bool read_input_value() |
| 55 | + static auto read_input_value() -> bool |
51 | 56 | { |
52 | 57 | return false; |
53 | 58 | } |
54 | 59 |
|
55 | | - static void toggle_pin() |
| 60 | + static auto toggle_pin() -> void |
56 | 61 | { |
57 | | - mcal::reg::reg_access_static<std::uint32_t, std::uint32_t, mcal::reg::gpio::out, bit_pos>::bit_not(); |
| 62 | + mcal::reg::reg_access_static<std::uint32_t, std::uint32_t, mcal::reg::gpio::rtc_gpio_out_reg, std::uint32_t { UINT32_C(10) + bpos }>::bit_not(); |
58 | 63 | } |
59 | 64 | }; |
60 | 65 | } |
61 | 66 | } |
62 | 67 |
|
63 | | -#endif // MCAL_PORT_2025_02_22_H |
| 68 | +#endif // MCAL_PORT_2025_03_15_H |
0 commit comments