1# -*- coding: utf-8 -*- 2# 3# Common (non-language-specific) configuration for Sphinx 4# 5# This file is imported from a language-specific conf.py (ie en/conf.py or 6# zh_CN/conf.py) 7 8# type: ignore 9# pylint: disable=wildcard-import 10# pylint: disable=undefined-variable 11 12from __future__ import print_function, unicode_literals 13 14import os.path 15 16from esp_docs.conf_docs import * # noqa: F403,F401 17 18if os.environ.get('IDF_PATH') is None: 19 raise RuntimeError('IDF_PATH should be set, run export.sh before building docs') 20 21BT_DOCS = ['api-guides/blufi.rst', 22 'api-guides/esp-ble-mesh/**', 23 'api-reference/bluetooth/bt_le.rst', 24 'api-reference/bluetooth/esp_bt_defs.rst', 25 'api-reference/bluetooth/esp_bt_device.rst', 26 'api-reference/bluetooth/esp_bt_main.rst', 27 'api-reference/bluetooth/bt_common.rst', 28 'api-reference/bluetooth/controller_vhci.rst', 29 'api-reference/bluetooth/esp_gap_ble.rst', 30 'api-reference/bluetooth/esp_gatt_defs.rst', 31 'api-reference/bluetooth/esp_gatts.rst', 32 'api-reference/bluetooth/esp_gattc.rst', 33 'api-reference/bluetooth/esp_blufi.rst', 34 'api-reference/bluetooth/esp-ble-mesh.rst', 35 'api-reference/bluetooth/index.rst', 36 'api-reference/bluetooth/nimble/index.rst'] 37 38CLASSIC_BT_DOCS = ['api-reference/bluetooth/classic_bt.rst', 39 'api-reference/bluetooth/esp_a2dp.rst', 40 'api-reference/bluetooth/esp_avrc.rst', 41 'api-reference/bluetooth/esp_hf_defs.rst', 42 'api-reference/bluetooth/esp_hf_client.rst', 43 'api-reference/bluetooth/esp_hf_ag.rst', 44 'api-reference/bluetooth/esp_spp.rst', 45 'api-reference/bluetooth/esp_gap_bt.rst'] 46 47SDMMC_DOCS = ['api-reference/peripherals/sdmmc_host.rst', 48 'api-reference/peripherals/sd_pullup_requirements.rst'] 49 50SDIO_SLAVE_DOCS = ['api-reference/peripherals/sdio_slave.rst', 51 'api-reference/protocols/esp_sdio_slave_protocol.rst'] 52 53MCPWM_DOCS = ['api-reference/peripherals/mcpwm.rst'] 54 55DEDIC_GPIO_DOCS = ['api-reference/peripherals/dedic_gpio.rst'] 56 57PCNT_DOCS = ['api-reference/peripherals/pcnt.rst'] 58 59DAC_DOCS = ['api-reference/peripherals/dac.rst'] 60 61TEMP_SENSOR_DOCS = ['api-reference/peripherals/temp_sensor.rst'] 62 63TOUCH_SENSOR_DOCS = ['api-reference/peripherals/touch_pad.rst'] 64 65SPIRAM_DOCS = ['api-guides/external-ram.rst'] 66 67LEGACY_DOCS = ['api-guides/build-system-legacy.rst', 68 'gnu-make-legacy.rst', 69 'api-guides/ulp-legacy.rst', 70 'api-guides/unit-tests-legacy.rst', 71 'get-started-legacy/**'] 72 73USB_DOCS = ['api-reference/peripherals/usb_device.rst', 74 'api-reference/peripherals/usb_host.rst', 75 'api-guides/usb-otg-console.rst', 76 'api-guides/dfu.rst'] 77 78FTDI_JTAG_DOCS = ['api-guides/jtag-debugging/configure-ft2232h-jtag.rst'] 79 80USB_SERIAL_JTAG_DOCS = ['api-guides/jtag-debugging/configure-builtin-jtag.rst', 81 'api-guides/usb-serial-jtag-console.rst'] 82 83ULP_DOCS = ['api-guides/ulp.rst', 'api-guides/ulp_macros.rst'] 84 85RISCV_COPROC_DOCS = ['api-guides/ulp-risc-v.rst',] 86 87XTENSA_DOCS = ['api-guides/hlinterrupts.rst', 88 'api-reference/system/perfmon.rst'] 89 90RISCV_DOCS = [] # type: list[str] 91 92ESP32_DOCS = ['api-guides/ulp_instruction_set.rst', 93 'api-reference/system/himem.rst', 94 'api-guides/romconsole.rst', 95 'api-reference/system/ipc.rst', 96 'security/secure-boot-v1.rst', 97 'api-reference/peripherals/secure_element.rst', 98 'api-reference/peripherals/dac.rst', 99 'hw-reference/esp32/**'] + LEGACY_DOCS + FTDI_JTAG_DOCS 100 101ESP32S2_DOCS = ['hw-reference/esp32s2/**', 102 'api-guides/ulps2_instruction_set.rst', 103 'api-guides/usb-console.rst', 104 'api-reference/peripherals/ds.rst', 105 'api-reference/peripherals/spi_slave_hd.rst', 106 'api-reference/peripherals/temp_sensor.rst', 107 'api-reference/system/async_memcpy.rst', 108 'api-reference/peripherals/touch_element.rst'] + FTDI_JTAG_DOCS 109 110ESP32S3_DOCS = ['hw-reference/esp32s3/**', 111 'api-reference/system/ipc.rst', 112 'api-guides/flash_psram_config.rst'] 113 114# No JTAG docs for this one as it gets gated on SOC_USB_SERIAL_JTAG_SUPPORTED down below. 115ESP32C3_DOCS = ['hw-reference/esp32c3/**'] 116 117# format: {tag needed to include: documents to included}, tags are parsed from sdkconfig and peripheral_caps.h headers 118conditional_include_dict = {'SOC_BT_SUPPORTED':BT_DOCS, 119 'SOC_CLASSIC_BT_SUPPORTED':CLASSIC_BT_DOCS, 120 'SOC_SDMMC_HOST_SUPPORTED':SDMMC_DOCS, 121 'SOC_SDIO_SLAVE_SUPPORTED':SDIO_SLAVE_DOCS, 122 'SOC_MCPWM_SUPPORTED':MCPWM_DOCS, 123 'SOC_USB_OTG_SUPPORTED':USB_DOCS, 124 'SOC_USB_SERIAL_JTAG_SUPPORTED':USB_SERIAL_JTAG_DOCS, 125 'SOC_DEDICATED_GPIO_SUPPORTED':DEDIC_GPIO_DOCS, 126 'SOC_SPIRAM_SUPPORTED':SPIRAM_DOCS, 127 'SOC_PCNT_SUPPORTED':PCNT_DOCS, 128 'SOC_DAC_SUPPORTED':DAC_DOCS, 129 'SOC_TOUCH_SENSOR_NUM':TOUCH_SENSOR_DOCS, 130 'SOC_ULP_SUPPORTED':ULP_DOCS, 131 'SOC_RISCV_COPROC_SUPPORTED':RISCV_COPROC_DOCS, 132 'SOC_DIG_SIGN_SUPPORTED':['api-reference/peripherals/ds.rst'], 133 'SOC_HMAC_SUPPORTED':['api-reference/peripherals/hmac.rst'], 134 'SOC_ASYNC_MEMCPY_SUPPORTED':['api-reference/system/async_memcpy.rst'], 135 'CONFIG_IDF_TARGET_ARCH_XTENSA':XTENSA_DOCS, 136 'CONFIG_IDF_TARGET_ARCH_RISCV':RISCV_DOCS, 137 'SOC_TEMP_SENSOR_SUPPORTED':TEMP_SENSOR_DOCS, 138 'esp32':ESP32_DOCS, 139 'esp32s2':ESP32S2_DOCS, 140 'esp32s3':ESP32S3_DOCS, 141 'esp32c3':ESP32C3_DOCS} 142 143extensions += ['sphinx_copybutton', 144 # Note: order is important here, events must 145 # be registered by one extension before they can be 146 # connected to another extension 147 'esp_docs.idf_extensions.build_system', 148 'esp_docs.idf_extensions.esp_err_definitions', 149 'esp_docs.idf_extensions.gen_toolchain_links', 150 'esp_docs.idf_extensions.gen_defines', 151 'esp_docs.idf_extensions.gen_version_specific_includes', 152 'esp_docs.idf_extensions.kconfig_reference', 153 'esp_docs.idf_extensions.gen_idf_tools_links', 154 'esp_docs.esp_extensions.run_doxygen', 155 ] 156 157# link roles config 158github_repo = 'espressif/esp-idf' 159 160# context used by sphinx_idf_theme 161html_context['github_user'] = 'espressif' 162html_context['github_repo'] = 'esp-idf' 163 164# Extra options required by sphinx_idf_theme 165project_slug = 'esp-idf' 166versions_url = 'https://dl.espressif.com/dl/esp-idf/idf_versions.js' 167 168idf_targets = ['esp32', 'esp32s2', 'esp32s3', 'esp32c3'] 169languages = ['en', 'zh_CN'] 170 171google_analytics_id = os.environ.get('CI_GOOGLE_ANALYTICS_ID', None) 172 173project_homepage = 'https://github.com/espressif/esp-idf' 174 175# Custom added feature to allow redirecting old URLs 176with open('../page_redirects.txt') as f: 177 lines = [re.sub(' +', ' ', line.strip()) for line in f.readlines() if line.strip() != '' and not line.startswith('#')] 178 for line in lines: # check for well-formed entries 179 if len(line.split(' ')) != 2: 180 raise RuntimeError('Invalid line in page_redirects.txt: %s' % line) 181html_redirect_pages = [tuple(line.split(' ')) for line in lines] 182