esp_hal/soc/esp32c6/
peripherals.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
//! # Peripheral Instances
//!
//! This module creates singleton instances for each of the various peripherals,
//! and re-exports them to allow users to access and use them in their
//! applications.
//!
//! Should be noted that that the module also re-exports the [Interrupt] enum
//! from the PAC, allowing users to handle interrupts associated with these
//! peripherals.

use esp32c6 as pac;
// We need to export this for users to use
pub use pac::Interrupt;

// We need to export this in the hal for the drivers to use
pub(crate) use self::peripherals::*;

// Note that certain are marked with `virtual` in the invocation of the
// `peripherals!` macro below. Basically, this indicates there's no physical
// peripheral (no `PSRAM`, `RADIO`, etc. peripheral in the PACs), so we're
// creating "virtual peripherals" for them.
crate::peripherals! {
    peripherals: [
        ADC1 <= virtual,
        AES <= AES,
        ASSIST_DEBUG <= ASSIST_DEBUG,
        ATOMIC <= ATOMIC,
        BT <= virtual,
        DMA <= DMA (DMA_IN_CH0,DMA_IN_CH1,DMA_IN_CH2,DMA_OUT_CH0,DMA_OUT_CH1,DMA_OUT_CH2),
        DS <= DS,
        ECC <= ECC,
        EFUSE <= EFUSE,
        EXTMEM <= EXTMEM,
        GPIO_SD <= GPIO_SD,
        HINF <= HINF,
        HMAC <= HMAC,
        HP_APM <= HP_APM,
        HP_SYS <= HP_SYS,
        I2C0 <= I2C0,
        I2S0 <= I2S0 (I2S0),
        IEEE802154 <= IEEE802154,
        INTERRUPT_CORE0 <= INTERRUPT_CORE0,
        INTPRI <= INTPRI,
        IO_MUX <= IO_MUX,
        LEDC <= LEDC,
        LPWR <= LP_CLKRST,
        LP_CORE <= virtual,
        LP_PERI <= LP_PERI,
        LP_ANA <= LP_ANA,
        LP_AON <= LP_AON,
        LP_APM <= LP_APM,
        LP_APM0 <= LP_APM0,
        LP_I2C0 <= LP_I2C0,
        LP_I2C_ANA_MST <= LP_I2C_ANA_MST,
        LP_IO <= LP_IO,
        LP_TEE <= LP_TEE,
        LP_TIMER <= LP_TIMER,
        LP_UART <= LP_UART,
        LP_WDT <= LP_WDT,
        MCPWM0 <= MCPWM0,
        MEM_MONITOR <= MEM_MONITOR,
        OTP_DEBUG <= OTP_DEBUG,
        PARL_IO <= PARL_IO (PARL_IO),
        PAU <= PAU,
        PCNT <= PCNT,
        PMU <= PMU,
        RADIO_CLK <= virtual,
        RMT <= RMT,
        RNG <= RNG,
        RSA <= RSA,
        SHA <= SHA,
        SLCHOST <= SLCHOST,
        SOC_ETM <= SOC_ETM,
        SPI0 <= SPI0,
        SPI1 <= SPI1,
        SPI2 <= SPI2 (SPI2),
        SYSTEM <= PCR,
        SYSTIMER <= SYSTIMER,
        SW_INTERRUPT <= virtual,
        TEE <= TEE,
        TIMG0 <= TIMG0,
        TIMG1 <= TIMG1,
        TRACE0 <= TRACE,
        TWAI0 <= TWAI0,
        TWAI1 <= TWAI1,
        UART0 <= UART0,
        UART1 <= UART1,
        UHCI0 <= UHCI0,
        USB_DEVICE <= USB_DEVICE,
        WIFI <= virtual,
        MEM2MEM1 <= virtual,
        MEM2MEM4 <= virtual,
        MEM2MEM5 <= virtual,
        MEM2MEM10 <= virtual,
        MEM2MEM11 <= virtual,
        MEM2MEM12 <= virtual,
        MEM2MEM13 <= virtual,
        MEM2MEM14 <= virtual,
        MEM2MEM15 <= virtual,
    ],
    pins: [
        (0, [Input, Output, Analog, RtcIo])
        (1, [Input, Output, Analog, RtcIo])
        (2, [Input, Output, Analog, RtcIo] (2 => FSPIQ) (2 => FSPIQ))
        (3, [Input, Output, Analog, RtcIo])
        (4, [Input, Output, Analog, RtcIo] (2 => FSPIHD) (0 => USB_JTAG_TMS 2 => FSPIHD))
        (5, [Input, Output, Analog, RtcIo] (2 => FSPIWP) (0 => USB_JTAG_TDI 2 => FSPIWP))
        (6, [Input, Output, Analog, RtcIo] (2 => FSPICLK) (0 => USB_JTAG_TCK 2 => FSPICLK_MUX))
        (7, [Input, Output, Analog, RtcIo] (2 => FSPID) (0 => USB_JTAG_TDO 2 => FSPID))
        (8, [Input, Output])
        (9, [Input, Output])
        (10, [Input, Output])
        (11, [Input, Output])
        (12, [Input, Output])
        (13, [Input, Output])
        (14, [Input, Output])
        (15, [Input, Output])
        (16, [Input, Output] (0 => U0RXD) (2 => FSPICS0))
        (17, [Input, Output] () (0 => U0TXD 2 => FSPICS1))
        (18, [Input, Output] () (2 => FSPICS2)) //  0 => SDIO_CMD but there are no signals since it's a fixed pin
        (19, [Input, Output] () (2 => FSPICS3)) //  0 => SDIO_CLK but there are no signals since it's a fixed pin
        (20, [Input, Output] () (2 => FSPICS4)) // 0 => SDIO_DATA0 but there are no signals since it's a fixed pin
        (21, [Input, Output] () (2 => FSPICS5)) // 0 => SDIO_DATA1 but there are no signals since it's a fixed pin
        (22, [Input, Output] () ()) // 0 => SDIO_DATA2 but there are no signals since it's a fixed pin
        (23, [Input, Output] () ()) // 0 => SDIO_DATA3 but there are no signals since it's a fixed pin
        (24, [Input, Output] () (0 => SPICS0))
        (25, [Input, Output] (0 => SPIQ) (0 => SPIQ))
        (26, [Input, Output] (0 => SPIWP) (0 => SPIWP))
        (27, [Input, Output])
        (28, [Input, Output] (0 => SPIHD) (0 => SPIHD))
        (29, [Input, Output] () (0 => SPICLK_MUX))
        (30, [Input, Output] (0 => SPID) (0 => SPID))
    ]
}