1idf_build_get_property(target IDF_TARGET)
2
3set(srcs
4    "gpio.c"
5    "i2c.c"
6    "i2s.c"
7    "ledc.c"
8    "pcnt.c"
9    "periph_ctrl.c"
10    "rmt.c"
11    "rtc_io.c"
12    "rtc_module.c"
13    "sdspi_crc.c"
14    "sdspi_host.c"
15    "sdspi_transaction.c"
16    "sigmadelta.c"
17    "spi_common.c"
18    "spi_master.c"
19    "spi_slave.c"
20    "spi_bus_lock.c"
21    "timer.c"
22    "twai.c"
23    "uart.c")
24
25set(includes "include" "${target}/include")
26
27if(${target} STREQUAL "esp32")
28    # SDMMC and MCPWM are in ESP32 only.
29    list(APPEND srcs "adc_common.c"
30                     "dac_common.c"
31                     "mcpwm.c"
32                     "sdio_slave.c"
33                     "sdmmc_host.c"
34                     "sdmmc_transaction.c"
35                     "touch_sensor_common.c"
36                     "esp32/touch_sensor.c"
37                     "adc.c"
38                     "esp32/adc.c"
39                     "adc_deprecated.c"
40                     "esp32/dac.c")
41endif()
42
43if(IDF_TARGET STREQUAL "esp32s2")
44    list(APPEND srcs "adc_common.c"
45                     "dac_common.c"
46                     "dedic_gpio.c"
47                     "spi_slave_hd.c"
48                     "touch_sensor_common.c"
49                     "esp32s2/rtc_tempsensor.c"
50                     "esp32s2/touch_sensor.c"
51                     "esp32s2/adc.c"
52                     "adc.c"
53                     "adc_deprecated.c"
54                     "esp32s2/adc2_init_cal.c"
55                     "esp32s2/dac.c")
56endif()
57
58if(${target} STREQUAL "esp32s3")
59    list(APPEND srcs "adc_common.c"
60                     "adc.c"
61                     "dedic_gpio.c"
62                     "gdma.c"
63                     "sdmmc_host.c"
64                     "sdmmc_transaction.c"
65                     "mcpwm.c"
66                     "usb_serial_jtag.c"
67                     "spi_slave_hd.c"
68                     "touch_sensor_common.c"
69                     "esp32s3/touch_sensor.c"
70                    )
71endif()
72
73if(IDF_TARGET STREQUAL "esp32c3")
74    list(APPEND srcs "gdma.c"
75                     "spi_slave_hd.c"
76                     "adc_common.c"
77                     "dedic_gpio.c"
78                     "usb_serial_jtag.c"
79                     "adc.c"
80                     "esp32c3/adc2_init_cal.c"
81                     "esp32c3/rtc_tempsensor.c")
82endif()
83
84if(IDF_TARGET STREQUAL "esp32h2")
85    list(APPEND srcs "gdma.c"
86                     "spi_slave_hd.c"
87                     "adc_common.c"
88                     "dedic_gpio.c"
89                     "adc.c"
90                     "esp32h2/rtc_tempsensor.c")
91endif()
92
93idf_component_register(SRCS "${srcs}"
94                    INCLUDE_DIRS ${includes}
95                    PRIV_INCLUDE_DIRS "include/driver"
96                    PRIV_REQUIRES efuse esp_timer esp_ipc
97                    REQUIRES esp_pm esp_ringbuf freertos soc hal esp_hw_support
98                    LDFRAGMENTS linker.lf)
99# (REQUIRES cannot hide soc headers, since many arguments in the driver headers are chip-dependent)
100
101# uses C11 atomic feature
102set_source_files_properties(spi_master.c PROPERTIES COMPILE_FLAGS -std=gnu11)
103