├── .gitignore
├── .gitlab-ci.yml
├── .readthedocs.yml
├── LICENSE
├── README.md
├── components
├── blufi
│ ├── CMakeLists.txt
│ ├── blufi.c
│ ├── blufi_security.c
│ └── include
│ │ └── blufi.h
├── led_rgb
│ ├── CMakeLists.txt
│ ├── include
│ │ └── led_rgb.h
│ └── led_rgb.c
├── moonlight_board
│ ├── CMakeLists.txt
│ ├── Kconfig.projbuild
│ ├── idf_component.yml
│ ├── include
│ │ └── board_moonlight.h
│ └── src
│ │ ├── board_esp32_moonlight.c
│ │ └── board_esp32s3_moonlight.c
└── sensor
│ ├── CMakeLists.txt
│ ├── component.mk
│ ├── include
│ └── sensor.h
│ └── sensor.c
├── docs
├── _static
│ ├── ESP-Moonlight_back.png
│ ├── ESP-Moonlight_front.png
│ ├── app_structure.png
│ ├── band1.jpg
│ ├── cloud_connectivity.png
│ ├── cover_book.png
│ ├── cover_page.jpg
│ ├── cover_page.png
│ ├── cover_page.svg
│ ├── cover_page_pdf.jpg
│ ├── dev_setup.png
│ ├── espressif-logo.svg
│ ├── flash_partitions_intro.png
│ ├── flash_partitions_upgrade.png
│ ├── idf_comp.png
│ ├── jumpstart-outlet-blocks.png
│ ├── moonlight2.jpg
│ ├── moonlight_cover.jpg
│ ├── network_config.png
│ ├── ota_workflow.png
│ ├── phone-device.png
│ ├── remote_lan.png
│ ├── theme_overrides.css
│ ├── upgrade_flow.png
│ └── wechat_mini.jpg
├── conf_common.py
├── convert_to_rst.sh
├── en
│ ├── Makefile
│ ├── conf.py
│ ├── drivers.rst
│ ├── firmwareupgrade.rst
│ ├── gettingstarted.rst
│ ├── index.rst
│ ├── introduction.rst
│ ├── networkconfig.rst
│ ├── remotecontrol_lan.rst
│ ├── speech_recognition.rst
│ └── wifi.rst
├── link-roles.py
├── local_util.py
├── requirements.txt
└── zh_CN
│ ├── Makefile
│ ├── conf.py
│ ├── drivers.rst
│ ├── firmwareupgrade.rst
│ ├── gettingstarted.rst
│ ├── index.rst
│ ├── introduction.rst
│ ├── networkconfig.rst
│ ├── remotecontrol_lan.rst
│ ├── speech_recognition.rst
│ └── wifi.rst
├── examples
├── 1_hello_world
│ ├── CMakeLists.txt
│ └── main
│ │ ├── CMakeLists.txt
│ │ ├── app_main.c
│ │ └── idf_component.yml
├── 2_drivers
│ ├── CMakeLists.txt
│ └── main
│ │ ├── CMakeLists.txt
│ │ ├── app_main.c
│ │ └── idf_component.yml
├── 3_wifi_connection
│ ├── CMakeLists.txt
│ └── main
│ │ ├── CMakeLists.txt
│ │ ├── Kconfig.projbuild
│ │ ├── app_main.c
│ │ └── idf_component.yml
├── 4_network_config
│ ├── CMakeLists.txt
│ ├── main
│ │ ├── CMakeLists.txt
│ │ ├── app_main.c
│ │ └── idf_component.yml
│ ├── partitions.csv
│ └── sdkconfig.defaults
├── 5_app_control
│ ├── CMakeLists.txt
│ ├── main
│ │ ├── CMakeLists.txt
│ │ ├── Kconfig.projbuild
│ │ ├── app_main.c
│ │ └── idf_component.yml
│ ├── partitions.csv
│ └── sdkconfig.defaults
├── 6_ota
│ ├── CMakeLists.txt
│ ├── https_server
│ │ ├── ca_cert.pem
│ │ ├── ca_key.pem
│ │ └── moonlight.bin
│ ├── main
│ │ ├── CMakeLists.txt
│ │ ├── Kconfig.projbuild
│ │ ├── app_main.c
│ │ ├── idf_component.yml
│ │ ├── ota.c
│ │ └── ota.h
│ ├── partitions.csv
│ └── sdkconfig.defaults
└── 7_recognition
│ ├── CMakeLists.txt
│ ├── main
│ ├── CMakeLists.txt
│ ├── app_main.c
│ ├── app_speech_rec.c
│ ├── idf_component.yml
│ └── include
│ │ └── app_speech_if.h
│ ├── partitions_esp32.csv
│ ├── partitions_esp32s3.csv
│ ├── sdkconfig.defaults
│ ├── sdkconfig.defaults.esp32
│ ├── sdkconfig.defaults.esp32s3
│ └── spiffs
│ ├── echo_cn_end.wav
│ ├── echo_cn_ok.wav
│ └── echo_cn_wake.wav
├── hardware
├── ESP-Moonlight_V2.0_N_XX_20200421_V0.3
│ ├── 01_Schematic
│ │ ├── SCH_ESP-MOONLIGHT_V2_0_20200421A.DSN
│ │ └── SCH_ESP-MOONLIGHT_V2_0_20200421A.pdf
│ ├── 02_PCB Layout
│ │ ├── PCB_ESP-Moonlight_V2.0_20200421.pcb
│ │ └── PCB_ESP-Moonlight_V2.0_20200421.pdf
│ └── 03_Gerber
│ │ ├── Main Board
│ │ ├── 01_top.pho
│ │ ├── 01_top.rep
│ │ ├── Bottom_pastemask.pho
│ │ ├── Bottom_pastemask.rep
│ │ ├── Bottom_silkscreen.pho
│ │ ├── Bottom_silkscreen.rep
│ │ ├── Bottom_soldermask.pho
│ │ ├── Bottom_soldermask.rep
│ │ ├── Top_pastemask.pho
│ │ ├── Top_pastemask.rep
│ │ ├── Top_silkscreen.pho
│ │ ├── Top_silkscreen.rep
│ │ ├── Top_soldermask.pho
│ │ ├── Top_soldermask.rep
│ │ ├── bottom.pho
│ │ ├── bottom.rep
│ │ ├── drilldrawing.pho
│ │ ├── drilldrawing.rep
│ │ ├── ncdrill.drl
│ │ ├── ncdrill.lst
│ │ └── ncdrill.rep
│ │ ├── Sub Board 01
│ │ ├── 01_top.pho
│ │ ├── 01_top.rep
│ │ ├── Bottom_pastemask.pho
│ │ ├── Bottom_pastemask.rep
│ │ ├── Bottom_silkscreen.pho
│ │ ├── Bottom_silkscreen.rep
│ │ ├── Bottom_soldermask.pho
│ │ ├── Bottom_soldermask.rep
│ │ ├── Top_pastemask.pho
│ │ ├── Top_pastemask.rep
│ │ ├── Top_silkscreen.pho
│ │ ├── Top_silkscreen.rep
│ │ ├── Top_soldermask.pho
│ │ ├── Top_soldermask.rep
│ │ ├── bottom.pho
│ │ ├── bottom.rep
│ │ ├── drilldrawing.pho
│ │ ├── drilldrawing.rep
│ │ ├── ncdrill.drl
│ │ ├── ncdrill.lst
│ │ └── ncdrill.rep
│ │ └── Sub Board 02
│ │ ├── 01_top.pho
│ │ ├── 01_top.rep
│ │ ├── Bottom_pastemask.pho
│ │ ├── Bottom_pastemask.rep
│ │ ├── Bottom_silkscreen.pho
│ │ ├── Bottom_silkscreen.rep
│ │ ├── Bottom_soldermask.pho
│ │ ├── Bottom_soldermask.rep
│ │ ├── Top_pastemask.pho
│ │ ├── Top_pastemask.rep
│ │ ├── Top_silkscreen.pho
│ │ ├── Top_silkscreen.rep
│ │ ├── Top_soldermask.pho
│ │ ├── Top_soldermask.rep
│ │ ├── bottom.pho
│ │ ├── bottom.rep
│ │ ├── drilldrawing.pho
│ │ ├── drilldrawing.rep
│ │ ├── ncdrill.drl
│ │ ├── ncdrill.lst
│ │ └── ncdrill.rep
└── ESP-Moonlight_datasheet
│ ├── 051-Buck-Silergy-SY8089-(High_Efficiency_2A_continuous_3A_peak_1MHz_Synchronous_Step_Down_Regulator)-(SOT23-5).pdf
│ ├── DMIC MSM261S4030H0R.pdf
│ ├── PowerCharge-Chipown-AP5056-(output4.2V_1Amax).pdf
│ ├── SMD5050 灯珠RGB 共阳 .PDF
│ └── 震动传感器 SW-58010TP颖鑫.pdf
├── model_3d
├── ESP-Moonlight-bottom_V2.0.stl
└── esp-moonlight-bottom-V2.1.stl
└── tools
└── build_apps.py
/.gitignore:
--------------------------------------------------------------------------------
1 | .config
2 | *.o
3 | *.pyc
4 |
5 | # VS Code Settings
6 | .vscode/
7 |
8 | # Example project files
9 | examples/**/sdkconfig
10 | examples/**/sdkconfig.old
11 | examples/**/build
12 |
13 | # Doc build artifacts
14 | docs/**/_build/
15 | docs/**/doxygen-warning-log.txt
16 | docs/**/sphinx-warning-log.txt
17 | docs/**/sphinx-warning-log-sanitized.txt
18 | docs/*/xml/
19 | docs/*/xml_in/
20 | docs/*/man/
21 | docs/*/*.pyc
22 | docs/doxygen_sqlite3.db
23 |
24 | # lock files for examples and components
25 | dependencies.lock
26 |
27 | # managed_components for examples
28 | managed_components
--------------------------------------------------------------------------------
/.gitlab-ci.yml:
--------------------------------------------------------------------------------
1 | stages:
2 | - build
3 | - deploy
4 |
5 | variables:
6 | BATCH_BUILD: "1"
7 | V: "0"
8 | MAKEFLAGS: "-j5 --no-keep-going"
9 | IDF_CI_BUILD: "1"
10 |
11 | before_script:
12 | # add gitlab ssh key
13 | - mkdir -p ~/.ssh
14 | - chmod 700 ~/.ssh
15 | - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
16 | - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
17 | - chmod 600 ~/.ssh/id_rsa
18 | - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
19 | - git --version
20 | - git submodule update --init --recursive
21 |
22 | .build_examples_template: &build_examples_template
23 | stage: build
24 | tags:
25 | - build
26 | image: ${IMAGE}
27 | artifacts:
28 | when: always
29 | paths:
30 | - "**/build*/size.json"
31 | - "**/build*/build_log.txt"
32 | - "**/build*/*.bin"
33 | # upload to s3 server to save the artifacts size
34 | - "**/build*/*.map"
35 | - "**/build*/*.elf"
36 | - "**/build*/flasher_args.json"
37 | - "**/build*/flash_project_args"
38 | - "**/build*/config/sdkconfig.json"
39 | - "**/build*/bootloader/*.bin"
40 | - "**/build*/bootloader/*.elf"
41 | - "**/build*/partition_table/*.bin"
42 | - size_info.txt
43 | expire_in: 1 week
44 | variables:
45 | # Enable ccache for all build jobs. See configure_ci_environment.sh for more ccache related settings.
46 | IDF_CCACHE_ENABLE: "1"
47 | BATCH_BUILD: "1"
48 | V: "0"
49 | WARNING_STR: ""
50 | IDF_CI_BUILD: "1"
51 | # By configuring this macro, you can append the compiled configuration file.
52 | # For example, using "sdkconf.etc=default" specifies the default sdkconfig file.
53 | EXAMPLE_CONFIG: "="
54 | script:
55 | - pip install --upgrade idf-component-manager
56 | - pip install idf_build_apps
57 | - python tools/build_apps.py ${EXAMPLE_DIR} --config ${EXAMPLE_CONFIG} -t all --default-build-targets esp32,esp32s3 -vv
58 |
59 | build_demo:
60 | extends:
61 | - .build_examples_template
62 | parallel:
63 | matrix:
64 | - IMAGE: espressif/idf:release-v4.4
65 | - IMAGE: espressif/idf:release-v5.0
66 | variables:
67 | EXAMPLE_DIR: examples
68 |
69 | build_docs:
70 | stage: build
71 | image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
72 | tags:
73 | - build_docs
74 | artifacts:
75 | when: always
76 | paths:
77 | # English version of documentation
78 | - docs/en/sphinx-warning-log.txt
79 | - docs/en/_build/html
80 | # Chinese version of documentation
81 | - docs/zh_CN/sphinx-warning-log.txt
82 | - docs/zh_CN/_build/html
83 | expire_in: 1 week
84 | before_script:
85 | - echo "skip default before_script"
86 | script:
87 | - cd docs
88 | # make English version of documentation
89 | - cd en/
90 | - make clean && make html
91 | - cd ../
92 | # make Chinese version of documentation
93 | - cd zh_CN/
94 | - make clean && make html
95 | - cd ../
96 |
97 | push_master_to_github:
98 | stage: deploy
99 | only:
100 | - master
101 | - /^release\/v/
102 | # when: on_success
103 | image: $CI_DOCKER_REGISTRY/esp32-ci-env
104 | variables:
105 | GIT_STRATEGY: clone
106 | GITHUB_PUSH_REFS: refs/remotes/origin/release refs/remotes/origin/master
107 | before_script:
108 | - echo "skip default before_script"
109 | script:
110 | - mkdir -p ~/.ssh
111 | - chmod 700 ~/.ssh
112 | - echo -n $GH_PUSH_KEY >> ~/.ssh/id_rsa_base64
113 | - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
114 | - chmod 600 ~/.ssh/id_rsa
115 | - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
116 | - git remote add github git@github.com:espressif/esp-moonlight.git
117 | # What the next line of script does: goes through the list of refs for all branches we push to github,
118 | # generates a snippet of shell which is evaluated. The snippet checks CI_BUILD_REF against the SHA
119 | # (aka objectname) at tip of each branch, and if any SHAs match then it checks out the local branch
120 | # and then pushes that ref to a corresponding github branch
121 | #
122 | # NB: In gitlab 9.x, CI_BUILD_REF was deprecated. New name is CI_COMMIT_SHA. If below command suddenly
123 | # generates bash syntax errors, this is probably why.
124 | - eval $(git for-each-ref --shell bash --format 'if [ $CI_COMMIT_SHA == %(objectname) ]; then git checkout -B %(refname:strip=3); git push --follow-tags github %(refname:strip=3); fi;' $GITHUB_PUSH_REFS)
125 |
126 |
--------------------------------------------------------------------------------
/.readthedocs.yml:
--------------------------------------------------------------------------------
1 | # .readthedocs.yml
2 | # Read the Docs configuration file
3 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4 |
5 | # Required
6 | version: 2
7 |
8 | build:
9 | os: ubuntu-22.04
10 | tools:
11 | python: "3.7"
12 |
13 | # Optionally build your docs in additional formats such as PDF and ePub
14 | formats:
15 | - htmlzip
16 | - pdf
17 |
18 | # Optionally set the version of Python and requirements required to build your docs
19 | python:
20 | install:
21 | - requirements: docs/requirements.txt
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ESP-Moonlight 支持政策
2 |
3 | 自 2023 年 11 月起,我们仅提供有限的支持,但是 Pull Request 仍然是被欢迎的!
4 |
5 | ## 支持的版本和芯片
6 | -----------------
7 |
8 | | ESP-Moonlight | Dependent ESP-IDF | Target | Support State |
9 | | ------------- | ----------------- | ------------- | --------------- |
10 | | master | >=release/v4.4 | ESP32 ESP32S3 | Limited Support |
11 |
12 | # ESP-MoonLight
13 |
14 | [](https://docs.espressif.com/projects/espressif-esp-moonlight/zh_CN/latest/)
15 |
16 | 中文文档: [https://docs.espressif.com/projects/espressif-esp-moonlight/zh_CN/latest/introduction.html](https://docs.espressif.com/projects/espressif-esp-moonlight/zh_CN/latest/introduction.html)
17 |
18 | |
|
19 | | ------------------------------------------------------------ |
20 | |
|
21 |
22 | ESP-Moonlight 是乐鑫推出的基于 ESP32 开发的月球灯示例项目,内含使用 ESP-IDF 开发的完整步骤。
23 |
24 | ## 概述
25 |
26 | 本项目以快速开发为特点,硬件结构简单,代码架构清晰完善,方便功能扩展,可实现驱动 LED 灯、局域网内使用小程序端控制灯的亮度和色彩等参数,可用于教育领域。
27 |
28 |
29 |
30 |  |
31 |  |
32 |
33 |
34 |
35 |
36 | ## 硬件
37 |
38 | 本项目使用的开发板为 ESP32-Moonlight ,集成了以下组件:
39 |
40 |
46 |
47 | - [ESP32-Moonlight 原理图 (PDF)](hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/01_Schematic/SCH_ESP-MOONLIGHT_V2_0_20200421A.pdf)
48 |
49 | - 月球灯开发板具有以下功能:
50 | - 板载自动下载电路
51 | - 电池充电
52 | - 支持手机进行配网
53 | - 支持手机控制
54 | - 支持触碰控制
55 | - 支持 OTA 升级
56 | - 支持语音控制
57 |
58 |
59 | ## 视频教程
60 |
61 | - [ESP-IDF 环境搭建 Windows](https://www.bilibili.com/video/BV1Ke411s7Go)
62 |
63 | - [ESP-IDF 环境搭建 Mac OS](https://www.bilibili.com/video/BV17K4y1k7Ht)
64 |
65 | - [ESP32 驱动 LED RGB5050 及震动控制](https://www.bilibili.com/video/BV1JK411s7ZA)
66 |
67 | - [ESP32 驱动 LED WS2812](https://www.bilibili.com/video/BV1jC4y1W7CZ)
68 |
69 | - [ESP32 进行 Wi-Fi 连接、配网及手机控制 LED 灯](https://www.bilibili.com/video/BV1nQ4y1N7ZC)
70 |
71 | - [ESP32 OTA(Over The Air) 升级介绍](https://www.bilibili.com/video/BV155411Y7VJ)
72 |
73 |
--------------------------------------------------------------------------------
/components/blufi/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(component_srcs "blufi.c"
2 | "blufi_security.c")
3 |
4 | idf_component_register(SRCS "${component_srcs}"
5 | INCLUDE_DIRS "include"
6 | REQUIRES nvs_flash bt mbedtls
7 | )
--------------------------------------------------------------------------------
/components/blufi/include/blufi.h:
--------------------------------------------------------------------------------
1 | // Copyright 2019 Espressif Systems (Shanghai) PTE LTD
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #pragma once
16 |
17 | #include "esp_err.h"
18 | #include "esp_blufi_api.h"
19 |
20 | #define BLUFI_EXAMPLE_TAG "Blufi"
21 | #define BLUFI_INFO(fmt, ...) ESP_LOGI(BLUFI_EXAMPLE_TAG, fmt, ##__VA_ARGS__)
22 | #define BLUFI_ERROR(fmt, ...) ESP_LOGE(BLUFI_EXAMPLE_TAG, fmt, ##__VA_ARGS__)
23 |
24 | typedef enum
25 | {
26 | BLUFI_STATUS_DISABLE = 0x00,
27 | BLUFI_STATUS_BT_CONNECTED = 0x01,
28 | BLUFI_STATUS_STA_CONNECTED = 0x02,
29 |
30 | }blufi_status_t;
31 |
32 | typedef void (*recv_handle_t)(esp_blufi_cb_event_t event, void* param);
33 |
34 | void blufi_dh_negotiate_data_handler(uint8_t *data, int len, uint8_t **output_data, int *output_len, bool *need_free);
35 | int blufi_aes_encrypt(uint8_t iv8, uint8_t *crypt_data, int crypt_len);
36 | int blufi_aes_decrypt(uint8_t iv8, uint8_t *crypt_data, int crypt_len);
37 | uint16_t blufi_crc_checksum(uint8_t iv8, uint8_t *data, int len);
38 |
39 | int blufi_security_init(void);
40 | void blufi_security_deinit(void);
41 |
42 | esp_err_t blufi_start(void);
43 | esp_err_t blufi_stop(void);
44 | esp_err_t blufi_network_init(void);
45 | esp_err_t blufi_wait_connection(TickType_t xTicksToWait);
46 | esp_err_t blufi_get_status(blufi_status_t *status);
47 | esp_err_t blufi_is_configured(bool *configured);
48 | esp_err_t blufi_install_recv_handle(recv_handle_t fn);
49 | esp_err_t blufi_set_wifi_info(const char *ssid, const char *pswd);
50 |
--------------------------------------------------------------------------------
/components/led_rgb/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(component_srcs "led_rgb.c")
2 |
3 | idf_component_register(SRCS "${component_srcs}"
4 | INCLUDE_DIRS "include"
5 | REQUIRES driver)
6 |
7 |
--------------------------------------------------------------------------------
/components/led_rgb/include/led_rgb.h:
--------------------------------------------------------------------------------
1 | // Copyright 2019 Espressif Systems (Shanghai) PTE LTD
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #pragma once
16 |
17 | #ifdef __cplusplus
18 | extern "C" {
19 | #endif
20 |
21 | #include "esp_err.h"
22 | #include "driver/ledc.h"
23 |
24 | /**
25 | * @brief LED rgb Type
26 | *
27 | */
28 | typedef struct led_rgb_s led_rgb_t;
29 |
30 |
31 | /**
32 | * @brief Declare of LED rgb Type
33 | *
34 | */
35 | struct led_rgb_s {
36 | /**
37 | * @brief Set RGB for LED
38 | *
39 | * @param led_rgb: Pointer of led_rgb struct
40 | * @param red: red part of color
41 | * @param green: green part of color
42 | * @param blue: blue part of color
43 | *
44 | * @return
45 | * - ESP_OK: Set RGB successfully
46 | * - ESP_ERR_INVALID_ARG: Set RGB failed because of invalid parameters
47 | * - ESP_FAIL: Set RGB failed because other error occurred
48 | */
49 | esp_err_t (*set_rgb)(led_rgb_t *led_rgb, uint32_t red, uint32_t green, uint32_t blue);
50 |
51 | /**
52 | * @brief Set HSV for LED
53 | *
54 | * @param led_rgb: Pointer of led_rgb struct
55 | * @param hue: hue part of color
56 | * @param saturation: saturation part of color
57 | * @param value: value part of color
58 | *
59 | * @return
60 | * - ESP_OK: Set HSV successfully
61 | * - ESP_ERR_INVALID_ARG: Set HSV failed because of invalid parameters
62 | * - ESP_FAIL: Set HSV failed because other error occurred
63 | */
64 | esp_err_t (*set_hsv)(led_rgb_t *led_rgb, uint32_t hue, uint32_t saturation, uint32_t value);
65 |
66 | /**
67 | * @brief Get RGB for LED
68 | *
69 | * @param led_rgb: Pointer of led_rgb struct
70 | * @param red: red part of color
71 | * @param green: green part of color
72 | * @param blue: blue part of color
73 | *
74 | * @return
75 | * - ESP_OK: Get RGB successfully
76 | */
77 | esp_err_t (*get_rgb)(led_rgb_t *led_rgb, uint8_t *red, uint8_t *green, uint8_t *blue);
78 |
79 | /**
80 | * @brief Get HSV for LED
81 | *
82 | * @param led_rgb: Pointer of led_rgb struct
83 | * @param hue: hue part of color
84 | * @param saturation: saturation part of color
85 | * @param value: value part of color
86 | *
87 | * @return
88 | * - ESP_OK: Get HSV successfully
89 | */
90 | esp_err_t (*get_hsv)(led_rgb_t *led_rgb, uint32_t *hue, uint32_t *saturation, uint32_t *value);
91 |
92 | /**
93 | * @brief Clear LED rgb (turn off LED)
94 | *
95 | * @param led_rgb: Pointer of led_rgb struct
96 | *
97 | * @return
98 | * - ESP_OK: Clear LEDs successfully
99 | * - ESP_ERR_TIMEOUT: Clear LEDs failed because of timeout
100 | * - ESP_FAIL: Clear LEDs failed because some other error occurred
101 | */
102 | esp_err_t (*clear)(led_rgb_t *led_rgb);
103 |
104 | /**
105 | * @brief Free LED rgb resources
106 | *
107 | * @param led_rgb: Pointer of led_rgb struct
108 | *
109 | * @return
110 | * - ESP_OK: Free resources successfully
111 | * - ESP_FAIL: Free resources failed because error occurred
112 | */
113 | esp_err_t (*del)(led_rgb_t *led_rgb);
114 | };
115 |
116 | /**
117 | * @brief LED rgb Configuration Type
118 | *
119 | */
120 | typedef struct {
121 | ledc_mode_t speed_mode; /*!< LEDC speed speed_mode, high-speed mode or low-speed mode */
122 | ledc_timer_t timer_sel; /*!< Select the timer source of channel (0 - 3) */
123 |
124 | int32_t red_gpio_num; /*!< Red LED pwm gpio number */
125 | int32_t green_gpio_num; /*!< Green LED pwm gpio number */
126 | int32_t blue_gpio_num; /*!< Blue LED pwm gpio number */
127 | ledc_channel_t red_ledc_ch; /*!< Red LED LEDC channel */
128 | ledc_channel_t green_ledc_ch; /*!< Green LED LEDC channel */
129 | ledc_channel_t blue_ledc_ch; /*!< Blue LED LEDC channel */
130 |
131 | uint32_t freq;
132 | uint32_t resolution;
133 | } led_rgb_config_t;
134 |
135 |
136 | #define LED_RGB_DEFAULT_CONFIG(red_gpio, green_gpio, blue_gpio) { \
137 | .red_gpio_num = (red_gpio), \
138 | .green_gpio_num = (green_gpio), \
139 | .blue_gpio_num = (blue_gpio), \
140 | .red_ledc_ch = LEDC_CHANNEL_0, \
141 | .green_ledc_ch = LEDC_CHANNEL_1, \
142 | .blue_ledc_ch = LEDC_CHANNEL_2, \
143 | .speed_mode = LEDC_LOW_SPEED_MODE, \
144 | .timer_sel = LEDC_TIMER_0, \
145 | .freq = 20000, \
146 | .resolution = LEDC_TIMER_8_BIT, \
147 | }
148 |
149 | /**
150 | * @brief Create a new LED driver (based on LEDC peripheral)
151 | *
152 | * @param config: Pointer of led_rgb_config_t struct
153 | * @return
154 | * LED instance or NULL
155 | */
156 | led_rgb_t *led_rgb_create(const led_rgb_config_t *cfg);
157 |
158 |
159 |
160 |
161 |
162 | #ifdef __cplusplus
163 | }
164 | #endif
165 |
--------------------------------------------------------------------------------
/components/moonlight_board/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | if(CONFIG_ESP32_MOONLIGHT_BOARD)
2 | set(srcs
3 | "src/board_esp32_moonlight.c"
4 | )
5 | elseif(CONFIG_ESP32_S3_MOONLIGHT_BOARD)
6 | set(srcs
7 | "src/board_esp32s3_moonlight.c"
8 | )
9 | endif()
10 |
11 | idf_component_register(SRCS ${srcs}
12 | INCLUDE_DIRS "include"
13 | REQUIRES nvs_flash
14 | )
15 |
16 |
--------------------------------------------------------------------------------
/components/moonlight_board/Kconfig.projbuild:
--------------------------------------------------------------------------------
1 | menu "SELECT BOARD"
2 | config ESP32_MOONLIGHT_BOARD
3 | bool "Select ESP32_MOONLIGHT_BOARD"
4 | default "y" if IDF_TARGET_ESP32
5 | help
6 | Select ESP32_MOONLIGHT_BOARD.
7 |
8 | config ESP32_S3_MOONLIGHT_BOARD
9 | bool "Select ESP32_S3_MOONLIGHT_BOARD"
10 | default "y" if IDF_TARGET_ESP32S3
11 | help
12 | Select ESP32_S3_MOONLIGHT_BOARD.
13 | endmenu
--------------------------------------------------------------------------------
/components/moonlight_board/idf_component.yml:
--------------------------------------------------------------------------------
1 | ## IDF Component Manager Manifest File
2 | dependencies:
3 | espressif/button: "^3.0.1"
4 | led_rgb:
5 | override_path: ../led_rgb
6 | sensor:
7 | override_path: ../sensor
8 | ## Required IDF version
9 | idf:
10 | version: ">=4.1.0"
11 |
--------------------------------------------------------------------------------
/components/moonlight_board/include/board_moonlight.h:
--------------------------------------------------------------------------------
1 | // Copyright 2019 Espressif Systems (Shanghai) PTE LTD
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #pragma once
16 | #include "sdkconfig.h"
17 | #include "esp_log.h"
18 | #include "esp_err.h"
19 | #include "esp_random.h"
20 | #include "esp_check.h"
21 | #include "esp_idf_version.h"
22 | #include "nvs_flash.h"
23 | #include "led_rgb.h"
24 | #include "iot_button.h"
25 | #include "sensor.h"
26 |
27 | #ifdef CONFIG_IDF_TARGET_ESP32S2
28 |
29 | #define BOARD_BAT_ADC_CHANNEL 3
30 | #define BOARD_GPIO_SENSOR_INT 5
31 | #define BOARD_DMIC_I2S_SCK 15
32 | #define BOARD_DMIC_I2S_WS 16
33 | #define BOARD_DMIC_I2S_SDO 17
34 | #define BOARD_GPIO_LED_R 36
35 | #define BOARD_GPIO_LED_G 35
36 | #define BOARD_GPIO_LED_B 37
37 | #define BOARD_GPIO_BAT_CHRG 6
38 | #define BOARD_GPIO_BAT_STBY 7
39 |
40 | #elif defined CONFIG_IDF_TARGET_ESP32
41 |
42 | #define BOARD_BAT_ADC_CHANNEL 0
43 | #define BOARD_GPIO_SENSOR_INT 39
44 | #define BOARD_DMIC_I2S_SCK 32
45 | #define BOARD_DMIC_I2S_WS 33
46 | #define BOARD_DMIC_I2S_SDO 25
47 | #define BOARD_GPIO_LED_R 16
48 | #define BOARD_GPIO_LED_G 4
49 | #define BOARD_GPIO_LED_B 17
50 | #define BOARD_GPIO_BAT_CHRG 34
51 | #define BOARD_GPIO_BAT_STBY 35
52 |
53 | #elif defined CONFIG_IDF_TARGET_ESP32S3
54 |
55 | #define BOARD_BAT_ADC_CHANNEL 7
56 | #define BOARD_GPIO_SENSOR_INT 9
57 | #define BOARD_DMIC_I2S_SCK 39
58 | #define BOARD_DMIC_I2S_WS 38
59 | #define BOARD_DMIC_I2S_SDO 40
60 | #define BOARD_GPIO_LED_R 1
61 | #define BOARD_GPIO_LED_G 2
62 | #define BOARD_GPIO_LED_B 16
63 | #define BOARD_GPIO_BAT_CHRG -1
64 | #define BOARD_GPIO_BAT_STBY -1
65 | #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
66 | #define BOARD_SUPPORT_SPEAKER 1
67 | #endif
68 | #define BOARD_DSPEAKER_I2S_WS 45
69 | #define BOARD_DSPEAKER_I2S_BCK 48
70 | #define BOARD_DSPEAKER_I2S_SDO 47
71 |
72 | #endif
73 |
74 | #define BOARD_GPIO_BUTTON 0 /**< button gpio number */
75 |
76 | led_rgb_t *board_rgb_init(void);
77 | void board_led_rgb_ctrl(led_rgb_t *led_rgb, uint8_t led_mode);
78 | void breath_light_task(void *arg);
79 | button_handle_t board_button_init(void);
80 | esp_err_t board_sensor_init(vibration_isr_t fn);
81 | esp_err_t board_nvs_flash_init(void);
82 |
--------------------------------------------------------------------------------
/components/moonlight_board/src/board_esp32_moonlight.c:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 | #include "board_moonlight.h"
7 |
8 | static const char *TAG = "esp32_moonlight";
9 |
10 | led_rgb_t *board_rgb_init(void)
11 | {
12 | /**< configure led driver */
13 | led_rgb_config_t rgb_config = LED_RGB_DEFAULT_CONFIG(BOARD_GPIO_LED_R, BOARD_GPIO_LED_G, BOARD_GPIO_LED_B);
14 | led_rgb_t *led_rgb = led_rgb_create(&rgb_config);
15 |
16 | if (!led_rgb) {
17 | ESP_LOGE(TAG, "install LED driver failed");
18 | }
19 | return led_rgb;
20 | }
21 |
22 | void board_led_rgb_ctrl(led_rgb_t *led_rgb, uint8_t led_mode)
23 | {
24 | static uint32_t hue = 0;
25 | if (!led_mode) {
26 | /**< Write HSV values to LED */
27 | esp_err_t ret = led_rgb->set_hsv(led_rgb, hue, 100, 100);
28 | ESP_RETURN_ON_FALSE(ret == ESP_OK, , TAG, "set rgb hsv failed");
29 | vTaskDelay(pdMS_TO_TICKS(30));
30 | hue++;
31 |
32 | if (hue > 360) {/**< The maximum value of hue in HSV color space is 360 */
33 | hue = 0;
34 | }
35 | } else {
36 | vTaskDelay(pdMS_TO_TICKS(100));
37 | }
38 | }
39 |
40 | void breath_light_task(void *arg)
41 | {
42 | led_rgb_t *led_rgb = (led_rgb_t*)arg;
43 | uint8_t value = 0;
44 | uint8_t dir = 0;
45 |
46 | while (1) {
47 | esp_err_t ret = led_rgb->set_hsv(led_rgb, 60, 100, value);
48 | ESP_RETURN_ON_FALSE(ret == ESP_OK, , TAG, "set rgb hsv failed");
49 | vTaskDelay(pdMS_TO_TICKS(20));
50 |
51 | if (dir) {
52 | value--;
53 |
54 | if (value < 2) {
55 | dir = 0;
56 | }
57 | } else {
58 | value++;
59 |
60 | if (value >= 100) {
61 | dir = 1;
62 | }
63 | }
64 | }
65 | }
66 |
67 | button_handle_t board_button_init(void)
68 | {
69 | ESP_LOGI(TAG, "esp32");
70 | button_config_t cfg = {
71 | .type = BUTTON_TYPE_GPIO,
72 | .gpio_button_config = {
73 | .gpio_num = 0,
74 | .active_level = 0,
75 | },
76 | };
77 | button_handle_t button = iot_button_create(&cfg);
78 | ESP_RETURN_ON_FALSE(button != NULL, NULL, TAG, "Button initialization failed.");
79 | return button;
80 | }
81 |
82 | esp_err_t board_sensor_init(vibration_isr_t fn)
83 | {
84 | esp_err_t ret = sensor_battery_init(BOARD_BAT_ADC_CHANNEL, BOARD_GPIO_BAT_CHRG, BOARD_GPIO_BAT_STBY);
85 | if (ret != ESP_OK) {
86 | ESP_LOGE(TAG, "Initialize adc for measure battery voltage failed.");
87 | }
88 | ret = sensor_vibration_init(BOARD_GPIO_SENSOR_INT);
89 | if (ret != ESP_OK) {
90 | ESP_LOGE(TAG, "Initialize vabration sensors failed.");
91 | }
92 | ret = sensor_vibration_triggered_register(fn, NULL);
93 | if (ret != ESP_OK) {
94 | ESP_LOGE(TAG, "Register vabration sensor triggered handler failed.");
95 | }
96 | return ret;
97 | }
98 |
99 | esp_err_t board_nvs_flash_init(void)
100 | {
101 | esp_err_t ret = nvs_flash_init();
102 |
103 | if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
104 | ret = nvs_flash_erase();
105 | ESP_RETURN_ON_FALSE(ret == ESP_OK, ESP_FAIL, TAG, "nvs flash erase failed");
106 | ret = nvs_flash_init();
107 | }
108 | return ret;
109 | }
110 |
111 |
--------------------------------------------------------------------------------
/components/moonlight_board/src/board_esp32s3_moonlight.c:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 | #include "board_moonlight.h"
7 |
8 | static const char *TAG = "esp32s3_moonlight";
9 |
10 | led_rgb_t *board_rgb_init(void)
11 | {
12 | /**< configure led driver */
13 | led_rgb_config_t rgb_config = LED_RGB_DEFAULT_CONFIG(BOARD_GPIO_LED_R, BOARD_GPIO_LED_G, BOARD_GPIO_LED_B);
14 | led_rgb_t *led_rgb = led_rgb_create(&rgb_config);
15 |
16 | if (!led_rgb) {
17 | ESP_LOGE(TAG, "install LED driver failed");
18 | }
19 | return led_rgb;
20 | }
21 |
22 | void board_led_rgb_ctrl(led_rgb_t *led_rgb, uint8_t led_mode)
23 | {
24 | static uint32_t hue = 0;
25 | if (!led_mode) {
26 | /**< Write HSV values to LED */
27 | esp_err_t ret = led_rgb->set_hsv(led_rgb, hue, 100, 100);
28 | ESP_RETURN_ON_FALSE(ret == ESP_OK, , TAG, "set rgb hsv failed");
29 | vTaskDelay(pdMS_TO_TICKS(30));
30 | hue++;
31 |
32 | if (hue > 360) {/**< The maximum value of hue in HSV color space is 360 */
33 | hue = 0;
34 | }
35 | } else {
36 | vTaskDelay(pdMS_TO_TICKS(100));
37 | }
38 | }
39 |
40 | void breath_light_task(void *arg)
41 | {
42 | led_rgb_t *led_rgb = (led_rgb_t*)arg;
43 | uint8_t value = 0;
44 | uint8_t dir = 0;
45 |
46 | while (1) {
47 | esp_err_t ret = led_rgb->set_hsv(led_rgb, 60, 100, value);
48 | ESP_RETURN_ON_FALSE(ret == ESP_OK, , TAG, "set rgb hsv failed");
49 | vTaskDelay(pdMS_TO_TICKS(20));
50 |
51 | if (dir) {
52 | value--;
53 |
54 | if (value < 2) {
55 | dir = 0;
56 | }
57 | } else {
58 | value++;
59 |
60 | if (value >= 100) {
61 | dir = 1;
62 | }
63 | }
64 | }
65 | }
66 |
67 | button_handle_t board_button_init(void)
68 | {
69 | ESP_LOGI(TAG, "esp32s3");
70 | button_config_t cfg = {
71 | .type = BUTTON_TYPE_GPIO,
72 | .gpio_button_config = {
73 | .gpio_num = 0,
74 | .active_level = 0,
75 | },
76 | };
77 | button_handle_t button = iot_button_create(&cfg);
78 | ESP_RETURN_ON_FALSE(button != NULL, NULL, TAG, "Button initialization failed.");
79 | return button;
80 | }
81 |
82 | esp_err_t board_sensor_init(vibration_isr_t fn)
83 | {
84 | esp_err_t ret = sensor_battery_init(BOARD_BAT_ADC_CHANNEL, BOARD_GPIO_BAT_CHRG, BOARD_GPIO_BAT_STBY);
85 | if (ret != ESP_OK) {
86 | ESP_LOGE(TAG, "Initialize adc for measure battery voltage failed.");
87 | }
88 | ret = sensor_vibration_init(BOARD_GPIO_SENSOR_INT);
89 | if (ret != ESP_OK) {
90 | ESP_LOGE(TAG, "Initialize vabration sensors failed.");
91 | }
92 | ret = sensor_vibration_triggered_register(fn, NULL);
93 | if (ret != ESP_OK) {
94 | ESP_LOGE(TAG, "Register vabration sensor triggered handler failed.");
95 | }
96 | return ret;
97 | }
98 |
99 | esp_err_t board_nvs_flash_init(void)
100 | {
101 | esp_err_t ret = nvs_flash_init();
102 |
103 | if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
104 | ret = nvs_flash_erase();
105 | ESP_RETURN_ON_FALSE(ret == ESP_OK, ESP_FAIL, TAG, "nvs flash erase failed");
106 | ret = nvs_flash_init();
107 | }
108 | return ret;
109 | }
110 |
--------------------------------------------------------------------------------
/components/sensor/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(component_srcs "sensor.c")
2 |
3 | if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_GREATER_EQUAL "5.0")
4 | list(APPEND REQ esp_adc)
5 | else()
6 | list(APPEND REQ esp_adc_cal)
7 | endif()
8 |
9 | idf_component_register(SRCS "${component_srcs}"
10 | INCLUDE_DIRS "include"
11 | REQUIRES driver esp_timer ${REQ}
12 | )
13 |
14 |
--------------------------------------------------------------------------------
/components/sensor/component.mk:
--------------------------------------------------------------------------------
1 | COMPONENT_ADD_INCLUDEDIRS := include
2 |
3 | COMPONENT_SRCDIRS := .
4 |
--------------------------------------------------------------------------------
/components/sensor/include/sensor.h:
--------------------------------------------------------------------------------
1 | // Copyright 2019 Espressif Systems (Shanghai) PTE LTD
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 |
16 | #ifndef SENSOR_H
17 | #define SENSOR_H
18 |
19 | #include "stdint.h"
20 | #include "freertos/FreeRTOS.h"
21 | #include "freertos/task.h"
22 | #include "freertos/queue.h"
23 | #include "esp_err.h"
24 |
25 |
26 | typedef void (*vibration_isr_t)(void *);
27 |
28 | typedef enum {
29 | CHRG_STATE_UNKNOW = 0x00,
30 | CHRG_STATE_CHARGING,
31 | CHRG_STATE_FULL,
32 | } chrg_state_t;
33 |
34 |
35 | /**
36 | * @brief initialize adc for measure battery voltage
37 | *
38 | * @param adc_channel ADC channel connected to voltage divider
39 | * @param chrg_num Connected to battery charge chip CHRG pin
40 | * @param stby_num Connected to battery charge chip STBY pin
41 | *
42 | * @return
43 | * - ESP_OK Success
44 | * - ESP_FAIL error
45 | */
46 | esp_err_t sensor_battery_init(int32_t adc_channel, int32_t chrg_num, int32_t stby_num);
47 |
48 | /**
49 | * @brief Get battery info, include voltage and charge state
50 | *
51 | * @param voltage battery voltage(mv)
52 | * @param chrg_state charge state
53 | *
54 | * @return
55 | * - ESP_OK Success
56 | */
57 | esp_err_t sensor_battery_get_info(int32_t *voltage, uint8_t *chrg_state);
58 |
59 | /**
60 | * @brief Get battery simple info , include battery level and charge state
61 | *
62 | * @param level battery level (0 ~ 100)
63 | * @param state charge state, see struct chrg_state_t
64 | *
65 | * @return
66 | * - ESP_OK Success
67 | */
68 | esp_err_t sensor_battery_get_info_simple(int32_t *level, chrg_state_t *state);
69 |
70 | /**
71 | * @brief initialize vabration sensors
72 | *
73 | * @param gpio_num vibration sensor gpio number
74 | *
75 | * @return
76 | * - ESP_OK Success
77 | * - ESP_FAIL error
78 | */
79 | esp_err_t sensor_vibration_init(int32_t gpio_num);
80 |
81 | /**
82 | * @brief Register vabration sensor triggered handler function. Call this function when a vibration is detected
83 | *
84 | * @param fn Triggered handler function.
85 | * @param arg Parameter for handler function
86 | *
87 | * @return
88 | * - ESP_OK Success ;
89 | * - ESP_ERR_INVALID_ARG pointer fn error
90 | */
91 | esp_err_t sensor_vibration_triggered_register(vibration_isr_t fn, void *arg);
92 |
93 |
94 | #endif
--------------------------------------------------------------------------------
/docs/_static/ESP-Moonlight_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/docs/_static/ESP-Moonlight_back.png
--------------------------------------------------------------------------------
/docs/_static/ESP-Moonlight_front.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/docs/_static/ESP-Moonlight_front.png
--------------------------------------------------------------------------------
/docs/_static/app_structure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/docs/_static/app_structure.png
--------------------------------------------------------------------------------
/docs/_static/band1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/docs/_static/band1.jpg
--------------------------------------------------------------------------------
/docs/_static/cloud_connectivity.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/docs/_static/cloud_connectivity.png
--------------------------------------------------------------------------------
/docs/_static/cover_book.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/docs/_static/cover_book.png
--------------------------------------------------------------------------------
/docs/_static/cover_page.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/docs/_static/cover_page.jpg
--------------------------------------------------------------------------------
/docs/_static/cover_page.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/docs/_static/cover_page.png
--------------------------------------------------------------------------------
/docs/_static/cover_page.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/docs/_static/cover_page_pdf.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/docs/_static/cover_page_pdf.jpg
--------------------------------------------------------------------------------
/docs/_static/dev_setup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/docs/_static/dev_setup.png
--------------------------------------------------------------------------------
/docs/_static/espressif-logo.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
78 |
--------------------------------------------------------------------------------
/docs/_static/flash_partitions_intro.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/docs/_static/flash_partitions_intro.png
--------------------------------------------------------------------------------
/docs/_static/flash_partitions_upgrade.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/docs/_static/flash_partitions_upgrade.png
--------------------------------------------------------------------------------
/docs/_static/idf_comp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/docs/_static/idf_comp.png
--------------------------------------------------------------------------------
/docs/_static/jumpstart-outlet-blocks.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/docs/_static/jumpstart-outlet-blocks.png
--------------------------------------------------------------------------------
/docs/_static/moonlight2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/docs/_static/moonlight2.jpg
--------------------------------------------------------------------------------
/docs/_static/moonlight_cover.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/docs/_static/moonlight_cover.jpg
--------------------------------------------------------------------------------
/docs/_static/network_config.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/docs/_static/network_config.png
--------------------------------------------------------------------------------
/docs/_static/ota_workflow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/docs/_static/ota_workflow.png
--------------------------------------------------------------------------------
/docs/_static/phone-device.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/docs/_static/phone-device.png
--------------------------------------------------------------------------------
/docs/_static/remote_lan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/docs/_static/remote_lan.png
--------------------------------------------------------------------------------
/docs/_static/theme_overrides.css:
--------------------------------------------------------------------------------
1 | /* override table width restrictions */
2 | @media screen and (min-width: 767px) {
3 |
4 | .wy-table-responsive table td {
5 | /* !important prevents the common CSS stylesheets from overriding
6 | this as on RTD they are loaded after this stylesheet */
7 | white-space: normal !important;
8 | }
9 |
10 | .wy-table-responsive {
11 | overflow: visible !important;
12 | }
13 | }
14 |
15 | .wy-side-nav-search {
16 | background-color: #e3e3e3 !important;
17 | }
18 |
19 | .wy-side-nav-search input[type=text] {
20 | border-radius: 0px !important;
21 | border-color: #333333 !important;
22 | }
23 |
24 | .icon-home {
25 | color: #333333 !important;
26 | }
27 |
28 | .icon-home:hover {
29 | background-color: #d6d6d6 !important;
30 | }
31 |
32 | .version {
33 | color: #000000 !important;
34 | }
35 |
36 | a:hover {
37 | color: #bd2c2a !important;
38 | }
39 |
40 | .logo {
41 | width: 240px !important;
42 | }
43 |
44 | .highlight .c1 {
45 | color: #008080;
46 | }
47 |
48 | .bolditalics {
49 | font-weight: bold;
50 | font-style: italic;
51 | }
52 |
--------------------------------------------------------------------------------
/docs/_static/upgrade_flow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/docs/_static/upgrade_flow.png
--------------------------------------------------------------------------------
/docs/_static/wechat_mini.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/docs/_static/wechat_mini.jpg
--------------------------------------------------------------------------------
/docs/convert_to_rst.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | for i in en/latex/*.tex
4 | do
5 | if [ $i != "main.tex" ] && [ $i != "structure.tex" ]
6 | then
7 | echo $i;
8 | target=`basename $i`
9 | pandoc $i --verbose --number-sections --section-divs --reference-links -t rst -o en/rst/${target/tex/rst};
10 | # Change \label to and anchor before the section/chapter names
11 | perl -0777 -i -pe 's/\n\n([^\n]*\n[-~]*\n\n)\[sec:([^\]]*)\][ ]*/\n\n.. _sec_$2:\n\n$1/igs' en/rst/${target/tex/rst};
12 | # Change the \ref to restructured text's :ref:
13 | perl -0777 -i -pe 's/\[sec:([^\]]*)\]/:ref:`sec_$1`/igs' en/rst/${target/tex/rst};
14 | # Disable figure references, since there is no easy way to do this
15 | perl -0777 -i -pe 's/[ ]*\[fig:([^\]]*)\]//igs' en/rst/${target/tex/rst};
16 | fi
17 | done
18 |
--------------------------------------------------------------------------------
/docs/en/conf.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | #
3 | # English Language RTD & Sphinx config file
4 | #
5 | # Uses ../conf_common.py for most non-language-specific settings.
6 |
7 | # Importing conf_common adds all the non-language-specific
8 | # parts to this conf module
9 | import sys, os
10 | sys.path.insert(0, os.path.abspath('../'))
11 | from conf_common import *
12 |
13 | # General information about the project.
14 | project = u'ESP-Moonlight'
15 | copyright = u'2018 - 2020, Espressif Systems (Shanghai) PTE LTD'
16 |
17 | # The language for content autogenerated by Sphinx. Refer to documentation
18 | # for a list of supported languages.
19 | language = 'en'
20 |
21 | # Grouping the document tree into LaTeX files. List of tuples
22 | # (source start file, target name, title,
23 | # author, documentclass [howto, manual, or own class]).
24 | latex_documents = [
25 | ('index', 'ReadtheDocsTemplate.tex', u'ESP-Moonlight',
26 | u'2018 - 2020, Espressif Systems (Shanghai) PTE LTD', 'manual'),
27 | ]
28 |
--------------------------------------------------------------------------------
/docs/en/drivers.rst:
--------------------------------------------------------------------------------
1 | .. include:: ../zh_CN/drivers.rst
--------------------------------------------------------------------------------
/docs/en/firmwareupgrade.rst:
--------------------------------------------------------------------------------
1 | .. include:: ../zh_CN/firmwareupgrade.rst
--------------------------------------------------------------------------------
/docs/en/gettingstarted.rst:
--------------------------------------------------------------------------------
1 | .. include:: ../zh_CN/gettingstarted.rst
--------------------------------------------------------------------------------
/docs/en/index.rst:
--------------------------------------------------------------------------------
1 | ESP-Moonlight
2 | =============
3 |
4 | :link_to_translation:`zh_CN:[中文]`
5 |
6 | ESP-Moonlight Support Policy
7 | -----------------------------
8 |
9 | From December 2023, we will offer limited support on this project, but Pull Request is still welcomed!
10 |
11 | Supported versions and chips
12 | -----------------------------
13 |
14 | +---------------+-------------------+---------------+-----------------+
15 | | ESP-Moonlight | Dependent ESP-IDF | Target | Support State |
16 | +===============+===================+===============+=================+
17 | | master | >=release/v4.4 | ESP32 ESP32S3 | Limited Support |
18 | +---------------+-------------------+---------------+-----------------+
19 |
20 | Get Started
21 | ------------
22 |
23 | .. role:: bolditalics
24 | :class: bolditalics
25 |
26 |
27 | | **Building Products with ESP32** :bolditalics:`fast`: MoonLight
28 |
29 | +------------------+
30 | | |Jumpstart Now|_ |
31 | +------------------+
32 | | `Jumpstart Now`_ |
33 | +------------------+
34 |
35 |
36 | .. toctree::
37 | :hidden:
38 |
39 | Introduction
40 | Getting Started
41 | The Driver
42 | Wi-Fi Connection
43 | Network Configuration
44 | Remote Control (LAN)
45 | Firmware Upgrades
46 | Speech Recognition
47 |
48 |
49 |
50 | .. |Jumpstart Now| image:: ../_static/cover_page.jpg
51 | .. _Jumpstart Now: introduction.html
52 |
--------------------------------------------------------------------------------
/docs/en/introduction.rst:
--------------------------------------------------------------------------------
1 | .. include:: ../zh_CN/introduction.rst
--------------------------------------------------------------------------------
/docs/en/networkconfig.rst:
--------------------------------------------------------------------------------
1 | .. include:: ../zh_CN/networkconfig.rst
--------------------------------------------------------------------------------
/docs/en/remotecontrol_lan.rst:
--------------------------------------------------------------------------------
1 | .. include:: ../zh_CN/remotecontrol_lan.rst
--------------------------------------------------------------------------------
/docs/en/speech_recognition.rst:
--------------------------------------------------------------------------------
1 | .. include:: ../zh_CN/speech_recognition.rst
--------------------------------------------------------------------------------
/docs/en/wifi.rst:
--------------------------------------------------------------------------------
1 | .. include:: ../zh_CN/wifi.rst
--------------------------------------------------------------------------------
/docs/link-roles.py:
--------------------------------------------------------------------------------
1 | # based on http://protips.readthedocs.io/link-roles.html
2 |
3 | import re
4 | import os
5 | from docutils import nodes
6 | from local_util import run_cmd_get_output
7 |
8 | def get_github_rev():
9 | path = run_cmd_get_output('git rev-parse --short HEAD')
10 | tag = run_cmd_get_output('git describe --exact-match')
11 | print ('Git commit ID: ', path)
12 | if len(tag):
13 | print ('Git tag: ', tag)
14 | path = tag
15 | return path
16 |
17 | def setup(app):
18 | rev = get_github_rev()
19 |
20 | # links to files or folders on the GitHub
21 | baseurl = 'https://github.com/espressif/esp-idf'
22 | app.add_role('idf', autolink('{}/tree/{}/%s'.format(baseurl, rev)))
23 | app.add_role('idf_file', autolink('{}/blob/{}/%s'.format(baseurl, rev)))
24 | app.add_role('idf_raw', autolink('{}/raw/{}/%s'.format(baseurl, rev)))
25 | app.add_role('component', autolink('{}/tree/{}/components/%s'.format(baseurl, rev)))
26 | app.add_role('component_file', autolink('{}/blob/{}/components/%s'.format(baseurl, rev)))
27 | app.add_role('component_raw', autolink('{}/raw/{}/components/%s'.format(baseurl, rev)))
28 | app.add_role('example', autolink('{}/tree/{}/examples/%s'.format(baseurl, rev)))
29 | app.add_role('example_file', autolink('{}/blob/{}/examples/%s'.format(baseurl, rev)))
30 | app.add_role('example_raw', autolink('{}/raw/{}/examples/%s'.format(baseurl, rev)))
31 |
32 | # link to the current documentation file in specific language version
33 | on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
34 | if on_rtd:
35 | # provide RTD specific commit identification to be included in the link
36 | tag_rev = 'latest'
37 | if (run_cmd_get_output('git rev-parse --short HEAD') != rev):
38 | tag_rev = rev
39 | else:
40 | # if not on the RTD then provide generic identification
41 | tag_rev = run_cmd_get_output('git describe --always')
42 |
43 | app.add_role('link_to_translation', crosslink('%s../../%s/{}/%s.html'.format(tag_rev)))
44 |
45 | def autolink(pattern):
46 | def role(name, rawtext, text, lineno, inliner, options={}, content=[]):
47 | m = re.search('(.*)\s*<(.*)>', text)
48 | if m:
49 | link_text = m.group(1)
50 | link = m.group(2)
51 | else:
52 | link_text = text
53 | link = text
54 | url = pattern % (link,)
55 | node = nodes.reference(rawtext, link_text, refuri=url, **options)
56 | return [node], []
57 | return role
58 |
59 | def crosslink(pattern):
60 | def role(name, rawtext, text, lineno, inliner, options={}, content=[]):
61 | (language, link_text) = text.split(':')
62 | docname = inliner.document.settings.env.docname
63 | doc_path = inliner.document.settings.env.doc2path(docname, None, None)
64 | return_path = '../' * doc_path.count('/')
65 | url = pattern % (return_path, language, docname)
66 | node = nodes.reference(rawtext, link_text, refuri=url, **options)
67 | return [node], []
68 | return role
69 |
--------------------------------------------------------------------------------
/docs/local_util.py:
--------------------------------------------------------------------------------
1 | # Utility functions used in conf.py
2 | #
3 | # Copyright 2017 Espressif Systems (Shanghai) PTE LTD
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http:#www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | import re
18 | import os
19 | import shutil
20 |
21 | def run_cmd_get_output(cmd):
22 | return os.popen(cmd).read().strip()
23 |
24 | def files_equal(path_1, path_2):
25 | if not os.path.exists(path_1) or not os.path.exists(path_2):
26 | return False
27 | file_1_contents = ''
28 | with open(path_1, "r") as f_1:
29 | file_1_contents = f_1.read()
30 | file_2_contents = ''
31 | with open(path_2, "r") as f_2:
32 | file_2_contents = f_2.read()
33 | return file_1_contents == file_2_contents
34 |
35 | def copy_file_if_modified(src_file_path, dst_file_path):
36 | if not files_equal(src_file_path, dst_file_path):
37 | dst_dir_name = os.path.dirname(dst_file_path)
38 | if not os.path.isdir(dst_dir_name):
39 | os.makedirs(dst_dir_name)
40 | shutil.copy(src_file_path, dst_file_path)
41 |
42 | def copy_if_modified(src_path, dst_path):
43 | if os.path.isfile(src_path):
44 | copy_file_if_modified(src_path, dst_path)
45 | return
46 |
47 | src_path_len = len(src_path)
48 | for root, dirs, files in os.walk(src_path):
49 | for src_file_name in files:
50 | src_file_path = os.path.join(root, src_file_name)
51 | dst_file_path = os.path.join(dst_path + root[src_path_len:], src_file_name)
52 | copy_file_if_modified(src_file_path, dst_file_path)
53 |
54 |
--------------------------------------------------------------------------------
/docs/requirements.txt:
--------------------------------------------------------------------------------
1 | # This is a list of python packages used to generate documentation. This file is used with pip:
2 | # pip install --user -r requirements.txt
3 | #
4 | sphinx==3.0.4
5 | breathe==4.14.1
6 | sphinx-rtd-theme==1.0.0
7 | sphinx-notfound-page==0.7.1
8 | sphinxcontrib-blockdiag==2.0.0
9 | sphinxcontrib-seqdiag==2.0.0
10 | sphinxcontrib-actdiag==2.0.0
11 | sphinxcontrib-nwdiag==2.0.0
12 | blockdiag>=1.5.4, <2.0.0
13 | seqdiag>=0.9.6, <2.0.0
14 | actdiag>=0.5.4, <2.0.0
15 | nwdiag==2.0.0
16 | recommonmark==0.7.0
17 | markdown>=3.0.1, <3.4.0
18 | sphinx-markdown-tables==0.0.15
19 | Jinja2<3.1
20 |
--------------------------------------------------------------------------------
/docs/zh_CN/conf.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | #
3 | # English Language RTD & Sphinx config file
4 | #
5 | # Uses ../conf_common.py for most non-language-specific settings.
6 |
7 | # Importing conf_common adds all the non-language-specific
8 | # parts to this conf module
9 | import sys, os
10 | sys.path.insert(0, os.path.abspath('../'))
11 | from conf_common import *
12 |
13 | # General information about the project.
14 | project = u'ESP-Moonlight'
15 | copyright = u'2016 - 2020 乐鑫信息科技(上海)股份有限公司'
16 |
17 | # The language for content autogenerated by Sphinx. Refer to documentation
18 | # for a list of supported languages.
19 | language = 'zh_CN'
20 |
21 | # Grouping the document tree into LaTeX files. List of tuples
22 | # (source start file, target name, title,
23 | # author, documentclass [howto, manual, or own class]).
24 | latex_documents = [
25 | ('index', 'ReadtheDocsTemplate.tex', u'ESP-Moonlight',
26 | u'2016 - 2020 乐鑫信息科技(上海)股份有限公司', 'manual'),
27 | ]
28 |
--------------------------------------------------------------------------------
/docs/zh_CN/drivers.rst:
--------------------------------------------------------------------------------
1 | 驱动程序
2 | =============
3 |
4 |
5 |
6 | 这个示例将展示我们如何使用 ESP32 驱动开发板上的外设,本章节只关注实现基本的驱动的功能,后续章节会具体介绍连网功能。如需查看相关代码,请前往 ``examples/2_drivers`` 目录。
7 |
8 | 该示例包含以下功能:
9 |
10 | - 驱动 LED 灯,可改变灯的颜色、亮度等。
11 | - 一个实体按钮,按下按钮即可控制 LED 灯。
12 | - 监测电池电压,并且把电压值输出到串口监视器。
13 | - 接收震动传感器的触发,实现触碰可变色。
14 |
15 | 驱动程序的代码已按照功能分开单独放入工程目录下的 ``components`` 文件夹,因此如果后续需要修改此应用程序用于产品,您只需更改此文件夹下对应的内容。
16 |
17 |
18 | LED 灯
19 | ---------------
20 |
21 | 首先,我们需要使 LED 灯亮起来。开发板上有 6 颗三种颜色(红、绿、蓝)分别并联在一起的 RGB LED 灯,ESP32 输出的信号经过三个 MOS 管驱动这些 LED 灯。
22 |
23 | 硬件的接口定义如下:
24 |
25 | +------------+---------------+-----------------+
26 | | 接口 | ESP32-S2-SOLO | ESP32-WROOM-32D |
27 | +============+===============+=================+
28 | |红灯 (RED) | IO36 | IO16 |
29 | +------------+---------------+-----------------+
30 | |绿灯 (GREEN)| IO35 | IO4 |
31 | +------------+---------------+-----------------+
32 | |蓝灯 (BLUE) | IO37 | IO17 |
33 | +------------+---------------+-----------------+
34 |
35 | 代码
36 | ~~~~~~~~
37 |
38 | 初始化配置 LED 驱动的代码如下:
39 |
40 | .. code-block:: c
41 |
42 | /**< configure led driver */
43 | led_rgb_config_t rgb_config = {0};
44 | rgb_config.red_gpio_num = BOARD_GPIO_LED_R;
45 | rgb_config.green_gpio_num = BOARD_GPIO_LED_G;
46 | rgb_config.blue_gpio_num = BOARD_GPIO_LED_B;
47 | rgb_config.red_ledc_ch = LEDC_CHANNEL_0;
48 | rgb_config.green_ledc_ch = LEDC_CHANNEL_1;
49 | rgb_config.blue_ledc_ch = LEDC_CHANNEL_2;
50 | rgb_config.speed_mode = LEDC_LOW_SPEED_MODE;
51 | rgb_config.timer_sel = LEDC_TIMER_0;
52 | rgb_config.freq = 20000;
53 | rgb_config.resolution = LEDC_TIMER_8_BIT;
54 | g_leds = led_rgb_create(&rgb_config);
55 |
56 | if (!g_leds) {
57 | ESP_LOGE(TAG, "install LED driver failed");
58 | }
59 |
60 | `LEDC `_ 是 ESP32 中主要用于控制 LED 亮度和颜色的一个外设,也可以产生 PWM 信号用于其他用途。上面的程序中调用 :c:func:`led_rgb_create` 函数初始化了三个通道分别控制 RGB 三色灯,在参数中指定了 PWM 的频率是 20 KHz ,分辨率为 8 位。
61 |
62 | 控制 LED 灯的函数如下:
63 |
64 | .. code-block:: c
65 |
66 | /**< Write HSV values to LED */
67 | ESP_ERROR_CHECK(g_leds->set_hsv(g_leds, a, b, c));
68 |
69 | /**< Write RGB values to LED */
70 | ESP_ERROR_CHECK(g_leds->set_rgb(g_leds, a, b, c));
71 |
72 | 这里是分别以 HSV 参数和 RGB 参数两种方式控制 LED 灯。
73 |
74 |
75 | 实体按钮
76 | ---------------
77 |
78 | 在 ESP32-Moonlight 开发板上有一个按钮,连接至 ESP32 的 GPIO0,我们将配置此按钮,用于切换灯光的模式。
79 |
80 |
81 | 代码
82 | ~~~~~~~~
83 |
84 | 实现此功能的代码如下:
85 |
86 | .. code-block:: c
87 |
88 | static void button_press_cb(void *arg)
89 | {
90 | if (g_led_mode) {
91 | g_led_mode = 0;
92 | } else {
93 | g_led_mode = 1;
94 | }
95 |
96 | ESP_LOGI(TAG, "Set the light mode to %d", g_led_mode);
97 | }
98 |
99 | static void configure_push_button(int gpio_num, void (*btn_cb)(void *))
100 | {
101 | button_handle_t btn_handle = iot_button_create(gpio_num, 0);
102 |
103 | if (btn_handle) {
104 | iot_button_set_evt_cb(btn_handle, BUTTON_CB_TAP, button_press_cb, NULL);
105 | }
106 | }
107 |
108 | 我们使用 :c:func:`configure_push_button` 函数来配置按钮功能。首先,创建 button 对象,指定 GPIO 输出端及其有效电平用于检测按钮动作。
109 | 然后我们为按钮注册事件回调函数,松开按钮时,就会在 esp-timer 线程中调用 :c:func:`button_press_cb` 函数。请确保为 esp-timer 线程配置的默认堆栈足以满足回调函数需求。
110 |
111 |
112 | 震动传感器
113 | ---------------
114 |
115 | 在开发板上有一个圆柱形的震动传感器。震动开关在静止时为开路状态,当受到外力触碰而达到一定振动力时或移动速度达到一定离心力时,两个引脚将会瞬间导通,外力消失后恢复到开路状态,传感器将震动转换为可以被 ESP32 检测到的高低电平信号。
116 |
117 | 和按键的特性类似,在一次震动中会存在很多的抖动信号,电路上传感器的两端并联了一个小电容来消除一些电平的抖动。ESP32 上使用 IO 中断来检测震动传感器的电平变化,软件上通过在检测到第一次电平变化后延时一段时间来避开连续的抖动。
118 |
119 | 代码
120 | ~~~~~~~~
121 |
122 | 实现此功能的代码如下:
123 |
124 | .. code-block:: c
125 |
126 | sensor_vibration_init(BOARD_GPIO_SENSOR_INT);
127 | sensor_vibration_triggered_register(vibration_handle, NULL);
128 |
129 | 首先调用 :c:func:`sensor_vibration_init` 进行初始化,指定震动传感器的 IO 口,其后注册一个传感器触发的回调函数,当震动传感器输出的电平发生变化即会进行回调。
130 |
131 | 回调函数代码如下:
132 |
133 | .. code-block:: c
134 |
135 | static void vibration_handle(void *arg)
136 | {
137 | uint16_t h;
138 | uint8_t s;
139 |
140 | if (!g_led_mode) {
141 | return;
142 | }
143 |
144 | /**< Set a random color */
145 | h = esp_random() / 11930465;
146 | s = esp_random() / 42949673;
147 | s = s < 40 ? 40 : s;
148 |
149 | ESP_ERROR_CHECK(g_leds->set_hsv(g_leds, h, s, 100));
150 | }
151 |
152 |
153 | 电池电压监测
154 | ---------------
155 |
156 | ESP32 集成有两个 12 位的逐次逼近型 `ADC `_,一共支持 18 个模拟通道输入。电池的电压经过电阻 1/2 分压后输入到 ESP32 ADC 的一个通道。
157 | ADC 内部的参考电压为 1100 mv ,内部还有一个可调的衰减系数,增大了 ADC 的输入范围。
158 |
159 | 代码
160 | ~~~~~~~~
161 |
162 | 实现此功能的代码如下:
163 |
164 | .. code-block:: c
165 |
166 | esp_err_t sensor_adc_init(int32_t adc_channel)
167 | {
168 | g_adc_ch_bat = adc_channel;
169 | /**< Check if Two Point or Vref are burned into eFuse */
170 | adc_check_efuse();
171 |
172 | /**< Configure ADC */
173 | adc1_config_width(ADC_WIDTH_BIT_12);
174 | adc1_config_channel_atten(g_adc_ch_bat, ADC_ATTEN_DB_12);
175 |
176 | /**< Characterize ADC */
177 | g_adc_chars = calloc(1, sizeof(esp_adc_cal_characteristics_t));
178 | esp_adc_cal_value_t val_type = esp_adc_cal_characterize(ADC_UNIT_1, ADC_ATTEN_DB_12, ADC_WIDTH_BIT_12, DEFAULT_VREF, g_adc_chars);
179 | print_char_val_type(val_type);
180 |
181 | xTaskCreatePinnedToCore(sensor_battery_task, "battery", 1024 * 2, NULL, 3, NULL, 1);
182 |
183 | return ESP_OK;
184 | }
185 |
186 | 调用 :c:func:`adc1_config_width` 配置 ADC 的分辨率为 12 位,然后使用 :c:func:`adc1_config_channel_atten` 设置内部衰减为 11 DB,也就是大约原来的 1/3.6 ,再加上外部电阻的衰减才能保证电压动态范围不超过 ADC 的量程,
187 | 最后通过 :c:func:`xTaskCreatePinnedToCore` 在 CPU1 上创建了一个用于电池监测的任务。
188 |
189 | 演示
190 | ---------
191 |
192 | 将此固件编译并烧录至设备后,LED 灯的颜色从红色渐变到绿色再到蓝色,以此不断循环。每次按下按钮,ESP32 就会在灯光受震动传感器控制和自动渐变之间来回切换。
193 | 同时,在串口 monitor 中还会不断打印出当前 ADC 测量得到的电池电压值。
194 |
195 | 未完待续
196 | ---------------
197 |
198 | 现在,我们已经实现了一个小夜灯本身的驱动功能,当然,目前该设备还无法连网。
199 | 下一步,我们将增加 Wi-Fi 连接功能。
200 |
--------------------------------------------------------------------------------
/docs/zh_CN/firmwareupgrade.rst:
--------------------------------------------------------------------------------
1 | 固件升级
2 | =================
3 |
4 | 有时我们开发了新的功能,希望给已经在运行的设备进行固件升级。但很可能因为电路板已经被安装了外壳等原因而不能方便地使用下载器将新的固件烧录到设备,此时将需要使用 OTA (over-the-air) 升级功能。
5 |
6 | 本节将实现 ESP32 从指定的 URL 来更新固件的功能。如需查看相关代码,请前往 ``examples/6_ota`` 目录。
7 |
8 |
9 | Flash 分区
10 | ----------------
11 |
12 | 在讨论固件升级之前,让我们先了解一下 ESP32 中的 flash 分区。
13 |
14 | 在 ESP32 的应用中,通常包含多种不同类型的数据,因此通过分区表将 flash 划分为多个逻辑分区。具体结构如下:
15 |
16 | .. figure:: ../_static/flash_partitions_intro.png
17 | :width: 500
18 | :alt: Flash Partitions
19 | :align: center
20 |
21 | Flash 分区结构
22 |
23 | 从上图可以看出,flash 地址在 0x9000 之前的结构是固定的,第一部分包括二级 Bootloader,后面紧接着就是分区表,分区表用来管理储存在 flash 剩余区域的数据分布。
24 | 关于分区表内容的详细信息可参见 `分区表介绍 `_。
25 |
26 |
27 | 创建分区表
28 | ~~~~~~~~~~~~~
29 |
30 | 使用 OTA 功能需要包含 OTA Data 分区和两个应用程序分区,可以通过创建一个分区表文件来实现,即 CSV 文件(Comma Separated Values,逗号分隔值)。
31 |
32 | 本示例所用的分区表文件内容如下:
33 |
34 | .. code:: text
35 |
36 | # Name, Type, SubType, Offset, Size, Flags
37 | nvs, data, nvs, , 0x4000,
38 | otadata, data, ota, , 0x2000,
39 | phy_init, data, phy, , 0x1000,
40 | ota_0, app, ota_0, , 1600K,
41 | ota_1, app, ota_1, , 1600K,
42 |
43 | 在这个分区表中,指定了两个 1600 KB 大小的应用程序分区,足够存放我们待升级的固件。
44 |
45 | .. figure:: ../_static/flash_partitions_upgrade.png
46 | :width: 300
47 | :alt: Flash Partitions Upgrade
48 | :align: center
49 |
50 | OTA Flash 分区
51 |
52 | 创建此分区文件后,我们还需在 menuconfig 中配置使用该自定义分区,而非默认分区。你可以在 ``Partition Table ---> Partition Table`` 中选择 ``Custom partition table CSV``,同时在下面指定分区表文件名。
53 | 本示例中,已经在 ``sdkconfig.defaults`` 文件中重写了默认配置,因此无需再进行其他配置操作。
54 |
55 |
56 | 空中升级过程
57 | ----------------
58 |
59 | 空中升级使用两个应用程序分区交替工作的方式,确保不会因升级失败而无法启动设备,OTA Data 分区将记录哪个是活动分区。
60 |
61 | OTA 固件升级过程中,状态变更如图所示:
62 |
63 | .. figure:: ../_static/upgrade_flow.png
64 | :width: 700
65 | :alt: Upgrade Flow
66 | :align: center
67 |
68 | 固件升级步骤
69 |
70 | - 步骤 0:OTA 0 为活动固件,该信息储存在 OTA Data 分区。
71 |
72 | - 步骤 1:固件升级开始,识别并擦除非活动分区,新的固件将写入 OTA 1 分区。
73 |
74 | - 步骤 2:固件写入完毕,开始进行验证。
75 |
76 | - 步骤 3:固件升级成功,OTA Data 分区已更新,并指示 OTA 1 现在是活动分区。下次启动时,固件将从此分区启动。
77 |
78 |
79 | 代码
80 | --------
81 |
82 | 现在我们来看一下实际执行固件升级的代码:
83 |
84 | .. code-block:: c
85 |
86 | esp_http_client_config_t config = {
87 | .url = url,
88 | .cert_pem = (char *)server_cert_pem_start,
89 | .event_handler = _http_event_handler,
90 | };
91 |
92 | esp_err_t ret = esp_https_ota(&config);
93 | if (ret == ESP_OK) {
94 | esp_restart();
95 | } else {
96 | ESP_LOGE(TAG, "Firmware upgrade failed");
97 | }
98 | return ret;
99 |
100 | - 使用 ``esp_http_client_config_t`` 配置 OTA 升级源,包括升级地址的 URL,用于验证服务器的 CA 证书(升级从此服务器处获取)。
101 |
102 | - 然后执行 :c:func:`esp_https_ota` API 启动固件升级,固件升级成功后将设备重启。
103 |
104 |
105 | 固件升级 URL
106 | ~~~~~~~~~~~~~~
107 |
108 | 使用本示例之前需要配置一个 URL 链接,在 menuconfig 中的 ``Example Configuration ---> firmware upgrade url endpoint`` 进行配置。
109 |
110 | 示例中使用的是本地的 http server,所以这里的 IP 地址需改成本机的。
111 |
112 |
113 | 演示
114 | ----------
115 |
116 | 本示例中的升级过程如下图所示:
117 |
118 | .. figure:: ../_static/ota_workflow.png
119 | :width: 700
120 | :alt: OTA Workflow
121 | :align: center
122 |
123 | OTA 升级过程
124 |
125 |
126 | 运行 HTTPS Server
127 | ~~~~~~~~~~~~~~~~~~~~~
128 |
129 | - 输入 ``cd https_server``,进入该文件夹。
130 |
131 | - 执行命令:``openssl req -x509 -newkey rsa:2048 -keyout ca_key.pem -out ca_cert.pem -days 365 -nodes``,创建一个自签名的证书和 KEY,后续设置可参照 `生成证书演示 `_。该步骤完成后会在当前目录下生成两个后缀为 `.pem` 的文件。
132 |
133 | - 启动 HTTPS server,执行命令:``openssl s_server -WWW -key ca_key.pem -cert ca_cert.pem -port 8070``。
134 |
135 | - 在这个文件夹下我们已经放了一个示例 `2_drivers` 的程序固件 `moonlight.bin`。你也可以替换成自己的固件,当然你需要去配置对应的 `firmware upgrade url endpoint`。
136 |
137 | .. note::
138 |
139 | 如果有防火墙软件阻止对端口 *8070* 的访问,请将其配置为在运行本示例时允许访问。
140 |
141 |
142 | .. note::
143 |
144 | Windows 系统的用户来需要在 `openssl` 命令前加上 `winpty`。命令行如下所示:
145 |
146 | - ``winpty openssl req -x509 -newkey rsa:2048 -keyout ca_key.pem -out ca_cert.pem -days 365 -nodes``
147 | - ``winpty openssl s_server -WWW -key ca_key.pem -cert ca_cert.pem -port 8070``
148 |
149 |
150 | 编译烧录固件
151 | ~~~~~~~~~~~~
152 |
153 | 和以前一样的执行 ``idf.py flash monitor`` 即可编译并烧录固件到开发板,同时打开串口监视器。
154 | 在编译时,会将我们前面生成的 ``ca_cert.pem`` 证书文件嵌入到最终的固件中。
155 |
156 |
157 | 执行固件升级
158 | ~~~~~~~~~~~~
159 |
160 | 烧录固件后的开发板将处于等待配网的状态,表现为黄色的呼吸灯。只有在经过配网后才能进行 OTA 的操作,在配网后就可以通过短按按键来触发固件升级操作。
161 | 升级成功将会自动重启运行升级后的固件。
162 |
163 | 在升级开始时,运行 HTTPS Server 的终端下将会出现如下信息:
164 |
165 | ::
166 |
167 | ACCEPT
168 | FILE:moonlight.bin
169 |
170 |
171 | 未完待续
172 | ------------
173 |
174 | 有了这个空中升级的功能,我们就可以方便的对设备进行升级。虽然这样有一个缺点是必须多空出一个固件大小的 flash 空间,不过它所带来的益处要更大。
175 |
176 |
--------------------------------------------------------------------------------
/docs/zh_CN/gettingstarted.rst:
--------------------------------------------------------------------------------
1 | 入门指南
2 | ===============
3 |
4 |
5 |
6 | 在本章中,我们将介绍 ESP32 的开发环境,并帮助您了解 ESP32 可用的开发工具和代码仓库。
7 |
8 | 开发过程概述
9 | --------------------
10 |
11 | 使用 ESP32 开发产品时,常用的开发环境如下图所示:
12 |
13 | .. figure:: ../_static/dev_setup.png
14 | :alt: Typical Developer Setup
15 | :align: center
16 |
17 | ESP32 产品开发过程
18 |
19 | 上图电脑(即开发主机)可以是 Linux、Windows 或 MacOS 操作系统。ESP32 开发板通过 USB 连接到开发主机,开发主机上有 ESP-IDF (乐鑫 SDK)、编译器工具链和项目代码。首先,主机编译代码生成可执行文件,然后电脑上的工具把生成的文件烧录到开发板上,开发版开始执行文件,最后你可以从主机查看日志。
20 |
21 |
22 | 准备工作
23 | -------------
24 |
25 | - ESP32-Moonlight 开发板(也可以通过外接器件使用其他 ESP32 开发板)
26 | - USB 数据线
27 | - 用于开发的 PC(Windows、Linux 或 Mac OS)
28 |
29 |
30 | ESP-IDF 介绍
31 | -------------
32 |
33 | ESP-IDF 是乐鑫为 ESP32 提供的物联网开发框架。
34 |
35 | - ESP-IDF (Espressif IoT Development Framework) 是由乐鑫官方推出的针对 `ESP32 `_ 系列芯片的开发框架。除此之外,乐鑫还有用于音频开发的 ESP-ADF 和用于 MESH 网络开发的 ESP-MDF 等各种开发框架,全部开放在 `github `_ 上。
36 | - ESP-IDF 包含一系列库及头文件,提供了基于 ESP32 构建软件项目所需的核心组件,还提供了开发和量产过程中最常用的工具及功能,例如:构建、烧录、调试和测量等。
37 | - ESP-IDF 支持在 Windows、Mac、Linux 多种操作系统下编译,在 V4.0 版本上除了安装编译环境时的差异之外几乎无差别,编译、烧录的操作都是一致的。
38 |
39 | 设置 ESP-IDF
40 | ~~~~~~~~~~~~~~
41 |
42 | 请参照 `ESP-IDF 入门指南 `_,按照步骤设置 ESP-IDF。注:请完成链接页面的所有步骤。
43 |
44 | 在进行下面步骤之前,请确认您已经正确设置了开发主机,并按照上面链接中的步骤构建了第一个应用程序。如果上面步骤已经完成,那让我们继续探索 ESP-IDF。
45 |
46 | ESP-IDF 详解
47 | ~~~~~~~~~~~~~~
48 | ESP-IDF 采用了一种基于组件的架构:
49 |
50 | .. figure:: ../_static/idf_comp.png
51 | :alt: Component Based Design
52 | :align: center
53 |
54 | ESP-IDF 组件设计
55 |
56 | ESP-IDF 中的所有软件均以“组件”的形式提供,比如操作系统、网络协议栈、Wi-Fi 驱动程序、以及 HTTP 服务器等中间件等等。在这种基于“组件”的架构下,你可以轻松使用更多自己研发或第三方提供的组件。
57 |
58 | 工程目录结构
59 | ~~~~~~~~~~~~~
60 |
61 | 开发人员通常借助 ESP-IDF 构建 *应用程序*,包含业务逻辑、外设驱动程序和 SDK 配置。
62 |
63 | .. figure:: ../_static/app_structure.png
64 | :alt: Application’s Structure
65 | :width: 230
66 | :align: center
67 |
68 | 应用程序架构
69 |
70 | - `CMakeLists.txt` 和 `Makefile` 文件,用于控制工程的编译过程。
71 | - `components` 文件夹,包含该项目的组件文件夹。
72 | - `main` 文件夹,一个特殊的组件,默认编译这里面的代码,应用程序必须包含一个 **main** 组件。
73 | - 一个可选的 *sdkconfig.defaults* 文件,存放应用程序默认的 SDK 配置。
74 |
75 | 在编译完成后会生成以下文件:
76 |
77 | - `build` 文件夹,存放编译输出的文件。
78 | - `sdkconfig` 文件,定义项目的所有配置。这个文件无需手动修改,编译时会自动从你在 menuconfig 中的设置来更新该文件。
79 |
80 | .. note:: 更多关于工程结构和编译过程的细节,请参阅 `编程指南/构建系统 `_。
81 |
82 |
83 | 获取 ESP-Moonlight
84 | ---------------------
85 |
86 | ESP-Moonlight 库包含了一系列由 ESP-IDF 构建的应用程序,我们将在本次练习中使用这些应用程序。首先克隆 ESP-Moonlight 库:
87 |
88 | .. code:: shell
89 |
90 | $ git clone --recursive https://github.com/espressif/esp-moonlight
91 |
92 | 我们将构建一个可用的固件,因此选择使用 ESP-IDF 稳定版本进行开发。目前 ESP-Moonlight 使用的是 ESP-IDF V4.0.1 稳定版本,使用如下命令切换 esp-idf 到 v4.0.1 的 tag:
93 |
94 | .. code:: shell
95 |
96 | $ cd esp-idf
97 | $ git checkout -b v4.0.1 v4.0.1
98 | $ git submodule update --recursive
99 |
100 | .. note::
101 |
102 | 不同的版本之间会有一些差异,可能导致编译不通过等问题,关于如何选择 IDF 的版本参见 `ESP-IDF 版本简介 `_。
103 |
104 |
105 | 现在,我们构建 ESP-Jumpstart 中的第一个应用程序 *Hello World*,并将其烧录到开发板上,具体步骤如下,相信您已经熟悉这些步骤:
106 |
107 | .. code:: shell
108 |
109 | $ cd esp-moonlight/1_hello_world
110 | $ idf.py flash monitor
111 |
112 | 上面的步骤将编译生成一个应用程序。编译成功后,将会把生成的固件烧录到开发板。
113 |
114 | 烧录成功后,设备将重启。同时,你还可以在控制台看到该固件的输出。
115 |
116 |
117 | 代码
118 | --------
119 |
120 | 现在,让我们研究一下 Hello World 应用程序的代码,位于 ``examples/1_hello_world``,它非常简单,包含了一些基本的程序功能:
121 |
122 | .. code:: c
123 |
124 | void app_main()
125 | {
126 | int i = 0;
127 | while (1) {
128 | printf("[%d] Hello world!\n", i);
129 | i++;
130 | vTaskDelay(5000 / portTICK_PERIOD_MS);
131 | }
132 | }
133 |
134 | 下面是这组代码的一些要点:
135 |
136 | - ``app_main()`` 函数是应用程序入口点,FreeRTOS 一旦完成初始化,即将在 ESP32 的其中一个核上新建一个应用程序线程,称为主线程,并在这一线程中调用 ``app_main()`` 函数。这个就相当于众所周知的程序入口 `main` 函数。这个函数在 idf 中可以写成死循环操作,也可以在创建一些任务后返回。
137 |
138 | - printf()、strlen()、time() 等 C 库函数可以直接调用。IDF 使用 newlib C 标准库,newlib 是一个占用空间较低的 C 标准库,支持 stdio、stdlib、字符串操作、数学、时间/时区、文件/目录操作等 C 库中的大多数函数,不支持 signal、locale、wchr 等。在上面示例中,我们使用 printf() 函数将数据输出打印到控制台。
139 |
140 | - ``vTaskDelay()`` 函数是 FreeRTOS 操作系统提供的一个延时函数。FreeRTOS 是驱动 ESP32 双核的操作系统。`FreeRTOS `_ 是一个很小的内核,提供了任务创建、任务间通信(信号量、信息队列、互斥量)、中断和定时器等机制。在上面示例中,我们使用 vTaskDelay 函数让线程休眠 5 秒。有关 FreeRTOS API 的详细信息,请查看 `FreeRTOS 文档 `_。
141 |
142 | 未完待续
143 | ---------------
144 |
145 | 到现在为止,我们已经具备了基本的开发能力,可以进行编译代码、烧录固件、查看固件日志和消息等基本开发操作。从这里开始,我们已经成功运行了第一个程序,接下来就是一步一步完成更多的功能
146 |
--------------------------------------------------------------------------------
/docs/zh_CN/index.rst:
--------------------------------------------------------------------------------
1 | ESP-Moonlight
2 | =============
3 |
4 | :link_to_translation:`en:[English]`
5 |
6 | ESP-Moonlight 支持政策
7 | -----------------------
8 |
9 | 自 2023 年 12 月起,我们仅提供有限的支持,但是 Pull Request 仍然是被欢迎的!
10 |
11 | 支持的版本和芯片
12 | -----------------
13 |
14 | +---------------+-------------------+---------------+-----------------+
15 | | ESP-Moonlight | Dependent ESP-IDF | Target | Support State |
16 | +===============+===================+===============+=================+
17 | | master | >=release/v4.4 | ESP32 ESP32S3 | Limited Support |
18 | +---------------+-------------------+---------------+-----------------+
19 |
20 | 快速入门
21 | --------
22 |
23 | .. role:: bolditalics
24 | :class: bolditalics
25 |
26 |
27 | | **快速构建 ESP32 产品**: MoonLight
28 |
29 | +------------------+
30 | | |Jumpstart Now|_ |
31 | +------------------+
32 | | `Jumpstart Now`_ |
33 | +------------------+
34 |
35 |
36 | .. toctree::
37 | :hidden:
38 |
39 | 简介
40 | 入门指南
41 | 驱动程序
42 | Wi-Fi 连接
43 | 网络配置
44 | 远程控制(局域网)
45 | 固件升级
46 | 语音识别控制
47 |
48 |
49 |
50 | .. |Jumpstart Now| image:: ../_static/cover_page.jpg
51 | .. _Jumpstart Now: introduction.html
52 |
53 |
--------------------------------------------------------------------------------
/docs/zh_CN/introduction.rst:
--------------------------------------------------------------------------------
1 | 简介
2 | ============
3 |
4 |
5 |
6 | ESP-Moonlight:使用 ESP32 快速构建一个月球灯
7 | ---------------------------------------------
8 |
9 | ESP-Moonlight 是乐鑫推出的基于 ESP32 开发的月球灯示例项目,内含产品开发的完整步骤、最佳做法,可实现驱动 LED 灯、局域网内使用小程序端控制灯的亮度和色彩等功能。本项目以快速开发为特点,硬件结构简单,代码架构清晰完善,方便功能扩展,可用于教育领域。
10 |
11 | .. figure:: ../_static/moonlight2.jpg
12 | :align: center
13 | :alt: esp-moonlight
14 | :figclass: align-center
15 |
16 | ESP-Moonlight
17 |
18 | 本项目中的月球灯有以下功能:
19 |
20 | - 板载自动下载电路
21 | - 电池充电功能
22 | - 支持手机进行配网
23 | - 支持手机控制
24 | - 支持触碰控制
25 | - 支持 OTA 升级
26 | - 支持语音唤醒控制
27 |
28 |
29 | 开发板介绍
30 | -----------
31 |
32 | 本项目使用的是 ESP32-Moonlight V2.0 开发板。
33 |
34 | .. figure:: ../_static/ESP-Moonlight_front.png
35 | :alt: front
36 | :width: 600
37 | :align: center
38 |
39 | ESP32-Moonlight 开发板正面
40 |
41 | .. figure:: ../_static/ESP-Moonlight_back.png
42 | :alt: back
43 | :width: 600
44 | :align: center
45 |
46 | ESP32-Moonlight 开发板背面
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/docs/zh_CN/networkconfig.rst:
--------------------------------------------------------------------------------
1 | SoftAP 配网和 Bluetooth Low Energy 配网
2 | ========================================
3 |
4 |
5 |
6 | 在上个示例中有个很不方便的地方,我们把 Wi-Fi 信息(SSID 和 PASSWORD)直接固定写在了程序中,不能随时改变想要连接的 Wi-Fi,显然这样是不实用的。
7 | 所以出现了包括 SoftAP 配网、Bluetooth Low Energy 配网、smartconfig 等多种配网方式,允许用户在设备运行时,将其 Wi-Fi 信息配置到设备中。不同的方式各有优缺点,主要取决于应用场景。
8 |
9 | 由于用户的网络信息将永久储存在设备中,所以另外提供了 **恢复出厂设置** 功能,可擦除设备中储存的用户配置信息。如需查看相关代码,请前往 ``examples/4_network_config`` 目录。
10 |
11 | 概述
12 | -------
13 |
14 | 如下图所示,在配网阶段,用户通常使用智能手机将 Wi-Fi 信息安全地配置到设备中。设备获取 Wi-Fi 信息后,就会连接到用户指定的 Wi-Fi 网络中。
15 |
16 | .. figure:: ../_static/network_config.png
17 | :width: 600
18 | :alt: Network config
19 | :align: center
20 |
21 | 配网过程
22 |
23 | 配网方式
24 | ----------
25 |
26 | - **SoftAP 配网**:ESP32 会建立一个 Wi-Fi 热点,用户将手机连接到这个热点后将要连接的 Wi-Fi 信息发送给 ESP32。这种配网模式需要用户手动连接到 ESP32 的热点网络,这会让用户感到奇怪和不友好,不过这种方式很可靠,设备端的代码也简单。
27 |
28 | - **Bluetooth Low Energy 配网**:ESP32 会进行 Bluetooth Low Energy 广播,附近的手机收到该广播后会询问用户是否进行 Bluetooth Low Energy 连接,如选择连接,则手机即可将信息发送给 ESP32。在这个的过程中用户无需切换 Wi-Fi 网络,但是需要打开蓝牙,用户体验相对 SoftAP 配网好一些。但是,需要在设备端加入蓝牙相关代码,这会增加固件的大小,并在配网完成前占用一定内存。
29 |
30 | - **Smartconfig 配网**:这种方式不需要建立任何通信链路,手机端通过发送不同长度的 UDP 广播包来表示 Wi-Fi 信息,ESP32 在混杂模式监听信号覆盖范围内的所有数据帧,通过一定算法得到 Wi-Fi 信息。缺点是配网成功率受环境的影响较大。
31 |
32 | - **WEB 配网**:在 ESP32 上建立热点,使用手机连接上后在浏览器打开配置网页,在网页中完成配网,这种方式很可靠,而且允许在电脑端完成配网,缺点是需要在设备端占用空间来嵌入网页。
33 |
34 |
35 | BluFi 配网
36 | ----------
37 |
38 | 在本节的例程中使用的是 Bluetooth Low Energy 的配网方式,ESP32 上提供了一个完整的解决方案——BluFi。它是一个基于蓝牙通道的 Wi-Fi 网络配置功能,通过安全协议将 Wi-Fi 配置和证书传输到 ESP32,然后 ESP32 可基于这些信息连接到 AP 或建立 SoftAP。
39 |
40 | Blufi 是完全开源的,以下为相关下载链接:
41 |
42 | * `BluFi 协议 `_
43 | * `iOS 源码 `_
44 | * `Android 源码 `_
45 |
46 | 你可以从 `Android version `_ 和 `iOS version `_ 下载手机端 APP 来进行配置。
47 |
48 | .. note::
49 |
50 | 目前的 IOS 和 Android 的 APP 使用逻辑因为系统的权限等原因而不尽相同,在未来的版本上可能会统一起来。
51 |
52 |
53 | 代码
54 | ~~~~~~~
55 | BluFi 的使用非常简单,下面是主程序部分的代码:
56 |
57 | .. code-block:: c
58 |
59 | /**< Initialize the BluFi */
60 | blufi_init();
61 |
62 | ESP_LOGI(TAG, "Wait for connect");
63 | blufi_wait_connect();
64 |
65 | :c:func:`blufi_init` 进行 BluFi 的初始化,:c:func:`blufi_wait_connect` 函数则一直等待配网完成。
66 | 在 `components/blufi` 文件夹中存放了 BluFi 的相关代码。
67 |
68 | 这里给出一些工程中新增文件的作用:
69 |
70 | - ``components/blufi/blufi.c``:关于 BluFi 的应用代码。
71 | - ``components/blufi/blufi_security.c``:关于 BluFi 安全加密相关。
72 | - ``sdkconfig.default``:保存了项目的默认配置,用于指定某些配置项。
73 | - ``partitions.csv``:ESP32 flash 的分区表,默认的分区表中留给 factory 应用程序的空间对于本节程序是不足的,自定义的分区表将 factory 分区增大到了 2 MB。
74 |
75 | Wi-Fi 信息的存储
76 | -------------------------------
77 |
78 | 我们希望在进行配网后,设备接收到的网络信息保存起来,以便下次直接读取出来进行连接,这里使用 NVS 进行保存。NVS(Non-volatile storage) 是一种软件组件,用于永久储存键值对,即便设备重启或断电,这些信息也不会丢失。NVS 在 flash 中有一个专门的分区来储存这些信息。
79 |
80 | NVS 经过专门设计,不但可以防止设备断电带来的数据损坏影响,而且还可以通过将写入的内容分布到整个 NVS 分中以处理 flash 磨损的问题。请参考 `NVS 相关文档 `_,查看详细信息。
81 |
82 | 默认情况下,Wi-Fi 组件会自动帮我们在 NVS 中保存上一次连接的 Wi-Fi 信息,但是如果调用函数 `esp_wifi_set_storage(WIFI_STORAGE_RAM)` 将 Wi-Fi 信息保存到了 RAM 中,则掉电丢失该信息。当然我们也可以自己使用 NVS 的相关函数来实现存储包括 Wi-Fi 信息在内的自己的信息。
83 |
84 | 恢复出厂设置
85 | ~~~~~~~~~~~~~~
86 |
87 | 当我们想要重新进行配网时,*恢复出厂设置* 便是一个常见需要。通常而言,长按设备上的某个按钮即可恢复出厂设置。
88 |
89 | 在应用程序中,我们通过长按按钮动作来恢复出厂设置,下面是按键配置的程序:
90 |
91 | .. code-block:: c
92 |
93 | static void configure_push_button(int gpio_num)
94 | {
95 | button_handle_t btn_handle = iot_button_create(gpio_num, 0);
96 |
97 | if (btn_handle) {
98 | iot_button_add_on_press_cb(btn_handle, 3, button_press_3sec_cb, NULL);
99 | }
100 | }
101 |
102 | 在成功创建了一个按键驱动后添加了一个长按的动作回调函数,一旦按钮被按下超过 3 秒,就会回调 :c:func:`button_press_3sec_cb` 函数。
103 |
104 | 回调函数内容如下:
105 |
106 | .. code:: c
107 |
108 | static void button_press_3sec_cb(void *arg)
109 | {
110 | ESP_LOGW(TAG, "Restore factory settings");
111 | nvs_flash_erase();
112 | esp_restart();
113 | }
114 |
115 | 这段代码的作用是擦除 NVS 的所有内容,然后触发设备重启。由于 NVS 内容已被清除,设备下次启动时将回到未配置状态。
116 |
117 |
118 | 演示
119 | --------
120 |
121 | 在 ESP-MoonLight 提供的微信小程序中集成了配网功能,扫描下面二维码进入:
122 |
123 | .. figure:: ../_static/wechat_mini.jpg
124 | :alt: Wechat Mini
125 | :align: center
126 |
127 | 微信小程序二维码
128 |
129 | 微信小程序的源码可在 `https://github.com/EspressifApps/Moonlight `_ 查看。
130 |
131 | - 上电等待 10 秒的时间用之前保存的 Wi-Fi 信息进行自动连接,此时 LED 是黄色呼吸灯状态。
132 |
133 | - 如果自动连接成功则 LED 直接高亮并开始颜色渐变,配网结束;如果未连接则启动 BluFi 并保持呼吸灯状态。
134 |
135 | - 使用手机进行配网,这里有两种可选方式:
136 |
137 | + 打开手机 APP 扫描设备后配置网络。有关如何配网的详细介绍,可参阅 `ESP32 蓝牙配⽹用户指南 `_。
138 | + 使用微信小程序,按照提示步骤进行配网。
139 |
140 | - ESP32 按照接收到的 Wi-Fi 信息进行连接,成功后 LED 高亮并开始颜色渐变,代表配网完成。
141 |
142 | - 如果此时重启设备,设备将不再进入网络配置模式,而是直接连接已配置的 Wi-Fi 网络。这就是我们想要的效果。
143 |
144 | - 这里,如果想重新配置你的设备,可尝试长按按钮(3 秒以上),你可以看到恢复出厂设置的整个过程。
145 |
146 | 未完待续
147 | ---------------
148 |
149 | 目前,我们已经有了这样一个通过手机 app 连入家庭 Wi-Fi 网络的月球灯,并且网络配置的过程已经很方便了。下一步,我们会将连网和自身的功能结合起来,远程控制灯的状态。
150 |
151 |
152 |
--------------------------------------------------------------------------------
/docs/zh_CN/remotecontrol_lan.rst:
--------------------------------------------------------------------------------
1 | 远程控制(局域网)
2 | ======================
3 |
4 |
5 |
6 | 要想成为一个智能硬件,单纯的连网是不够的。真正的智能在于通过联网对设备进行远程控制或监测,然后依托于强大的云服务,赋予设备一定的智慧。
7 | 在本章中,我们先将月球灯在局域网内连接到手机,实现对设备的控制。如需查看相关代码,请前往 ``examples/5_app_control`` 目录。
8 |
9 |
10 | 通信连接方式
11 | --------------
12 |
13 | 首先需要确定使用何种连接方式,下面提供了几种方式:
14 |
15 | 1. 将设备接入云,手机通过云平台的 API 来进行控制,如下图
16 |
17 | .. figure:: ../_static/cloud_connectivity.png
18 | :width: 700
19 | :alt: Cloud Connectivity
20 | :align: center
21 |
22 | 云连接
23 |
24 | 这种方式需要一个设备云服务器,这样不仅允许手机的远程控制,还允许通过其他的云来透过设备云控制设备,具有极大的灵活性。
25 |
26 | 2. 设备在局域网内连接,不经过外网,如下图
27 |
28 | .. figure:: ../_static/phone-device.png
29 | :width: 400
30 | :alt: Phone Device
31 | :align: center
32 |
33 | 局域网连接
34 |
35 | 相比之下,这种在局域网内的连接方式简单了许多,但同时也限制了控制只能在该局域网下进行。如果手机离开了该网络,则无法控制我们的设备,因为 Wi-Fi 覆盖范围有限,这样的断连情况较为常见。
36 |
37 |
38 | 通信过程
39 | ---------
40 |
41 | 简单起见,这里我们选用第二种方式并且使用 UDP 进行通信,使 ESP32 设备端作为 UDP Server,手机作为 Client 端,手机上使用微信小程序作为控制端。
42 | 当在微信小程序中点击颜色块时,手机会以 UDP 广播的方式发送 JSON 数据包,ESP32 接收到数据后进行解析,将得到的颜色值发送给 LED 灯。
43 |
44 | .. figure:: ../_static/remote_lan.png
45 | :width: 600
46 | :alt: Remote Lan
47 | :align: center
48 |
49 | 通信过程
50 |
51 |
52 | 数据格式
53 | ~~~~~~~~~~
54 |
55 | 数据使用 JSON 格式,如下所示:
56 |
57 | .. code-block:: JSON
58 |
59 | {
60 | "led":{
61 | "red":255,
62 | "green":255,
63 | "blue":255
64 | }
65 | }
66 |
67 | 其中 red、green、blue 分别控制着红、绿、蓝三色的亮度,其范围值都是 0 ~ 255。
68 |
69 | 代码
70 | -------
71 |
72 | 以下所示为 UDP 通信的部分代码:
73 |
74 | .. code-block:: c
75 | :linenos:
76 |
77 | if (addr_family == AF_INET) {
78 | struct sockaddr_in *dest_addr_ip4 = (struct sockaddr_in *)&dest_addr;
79 | dest_addr_ip4->sin_addr.s_addr = htonl(INADDR_ANY);
80 | dest_addr_ip4->sin_family = AF_INET;
81 | dest_addr_ip4->sin_port = htons(PORT);
82 | ip_protocol = IPPROTO_IP;
83 | }
84 |
85 | int sock = socket(addr_family, SOCK_DGRAM, ip_protocol);
86 |
87 | if (sock < 0) {
88 | ESP_LOGE(TAG, "Unable to create socket: errno %d", errno);
89 | break;
90 | }
91 |
92 | ESP_LOGI(TAG, "Socket created");
93 |
94 | int err = bind(sock, (struct sockaddr *)&dest_addr, sizeof(dest_addr));
95 |
96 | if (err < 0) {
97 | ESP_LOGE(TAG, "Socket unable to bind: errno %d", errno);
98 | }
99 |
100 | ESP_LOGI(TAG, "Socket bound, port %d", PORT);
101 |
102 | while (1) {
103 |
104 | ESP_LOGI(TAG, "Waiting for data");
105 | struct sockaddr_in6 source_addr; /**< Large enough for both IPv4 or IPv6 */
106 | socklen_t socklen = sizeof(source_addr);
107 | int len = recvfrom(sock, rx_buffer, sizeof(rx_buffer) - 1, 0, (struct sockaddr *)&source_addr, &socklen);
108 |
109 | /**< Error occurred during receiving */
110 | if (len < 0) {
111 | ESP_LOGE(TAG, "recvfrom failed: errno %d", errno);
112 | break;
113 | }
114 | /**< Data received */
115 | else {
116 | /**< Get the sender's ip address as string */
117 | if (source_addr.sin6_family == PF_INET) {
118 | inet_ntoa_r(((struct sockaddr_in *)&source_addr)->sin_addr.s_addr, addr_str, sizeof(addr_str) - 1);
119 | } else if (source_addr.sin6_family == PF_INET6) {
120 | inet6_ntoa_r(source_addr.sin6_addr, addr_str, sizeof(addr_str) - 1);
121 | }
122 |
123 | rx_buffer[len] = 0; /**< Null-terminate whatever we received and treat like a string... */
124 | ESP_LOGI(TAG, "Received %d bytes from %s:", len, addr_str);
125 |
126 | cJSON *root = cJSON_Parse(rx_buffer);
127 |
128 | if (!root) {
129 | printf("JSON format error:%s \r\n", cJSON_GetErrorPtr());
130 | } else {
131 | cJSON *item = cJSON_GetObjectItem(root, "led");
132 | int32_t red = cJSON_GetObjectItem(item, "red")->valueint;
133 | int32_t green = cJSON_GetObjectItem(item, "green")->valueint;
134 | int32_t blue = cJSON_GetObjectItem(item, "blue")->valueint;
135 | cJSON_Delete(root);
136 |
137 | if (red != g_red || green != g_green || blue != g_blue) {
138 | g_red = red;
139 | g_green = green;
140 | g_blue = blue;
141 | ESP_LOGI(TAG, "Light control: red = %d, green = %d, blue = %d", g_red, g_green, g_blue);
142 | ESP_ERROR_CHECK(g_leds->set_rgb(g_leds, g_red, g_green, g_blue));
143 | }
144 | }
145 | }
146 | }
147 |
148 |
149 |
150 | - 1 ~ 26 行为 UDP 的通信配置过程
151 |
152 | - 在循环中不断调用 :c:func:`recvfrom` 来接收数据
153 |
154 | - 将接收到的数据使用 :c:func:`cJSON_Parse` 进行解析得到 LED 灯的颜色值
155 |
156 | - 最后用解析出的颜色值去控制 LED 灯
157 |
158 | .. note::
159 |
160 | 为了确保通信的可靠性,微信小程序在发送 UDP 广播时,会重复发送多次。
161 |
162 |
163 | 未完待续
164 | ---------------
165 |
166 | 通过这个应用程序,我们将月球灯本身的功能与网络连接功能结合到了一起,实现了一个简单的远程控制。云端的控制我们将在以后介绍。下一章,我们会探讨连网设备的一个常见功能:空中固件升级。
167 |
--------------------------------------------------------------------------------
/docs/zh_CN/speech_recognition.rst:
--------------------------------------------------------------------------------
1 | 语音识别控制
2 | =============
3 |
4 |
5 |
6 | 这个示例将展示如何使用一个乐鑫提供的语音识别相关方向算法模型 ESP-SR 来控制 LED 灯。如需查看相关代码,请前往 ``examples/7_recognition`` 目录。
7 |
8 | 该示例包含以下功能:
9 |
10 | - 使用语音唤醒开发板
11 | - 支持连续对话
12 | - 语音控制 LED 灯的开关、颜色、亮度
13 |
14 |
15 | ESP-SR 介绍
16 | ---------------
17 |
18 | 包含三个主要模块:
19 |
20 | - 唤醒词识别模型:WakeNet
21 | - 语音命令识别模型:MultiNet
22 | - 声学算法:麦克风阵列语音增强(Mic-Array Speech Enhancement,简称 MASE)、回声消除(Acoustic Echo Cancellation,简称 AEC)、语音端点检测(Voice Activity Detection,简称 VAD)、自动增益控制(Automatic Gain Control,简称 AGC)、噪声抑制(Noise Suppression,简称 NS)
23 |
24 | 唤醒词模型 WakeNet 目前提供了免费的 “Hi,乐鑫” 唤醒词,这也是我们这里使用的唤醒词。命令词识别模型 MultiNet 则允许用户自定义语音命令而无需重新训练模型。
25 |
26 | 详细信息可参见 `ESP-SR `_。
27 |
28 |
29 | 麦克风输入
30 | ---------------
31 |
32 | 要使用语音识别控制,首先应该有一个音频输入。开发板使用了一个 I2S 数字输出的 MEMS 麦克风直接与 ESP32 的 I2S 接口连接。
33 |
34 | 硬件接口如下:
35 |
36 | +--------------+------------------+---------------+-----------------+
37 | | Pin Name | ESP32-S3-WROOM-1 | ESP32-S2-SOLO | ESP32-WROOM-32D |
38 | +==============+==================+===============+=================+
39 | | DMIC_I2S_SCK | IO39 | IO15 | IO32 |
40 | +--------------+------------------+---------------+-----------------+
41 | | DMIC_I2S_WS | IO38 | IO16 | IO32 |
42 | +--------------+------------------+---------------+-----------------+
43 | | DMIC_I2S_SDO | IO40 | IO17 | IO25 |
44 | +--------------+------------------+---------------+-----------------+
45 |
46 | 这种设计无需使用外置 Audio Codec ,极大地简化了电路。
47 |
48 | 扬声器输出
49 | ----------------
50 |
51 | 同时该实例还支持一路扬声器输出,通过 I2S 接口连接。硬件接口如下:
52 |
53 | +------------------+------------------+---------------+-----------------+
54 | | Pin Name | ESP32-S3-WROOM-1 | ESP32-S2-SOLO | ESP32-WROOM-32D |
55 | +==================+==================+===============+=================+
56 | | DSPEAKER_I2S_BCK | IO48 | × | × |
57 | +------------------+------------------+---------------+-----------------+
58 | | DSPEAKER_I2S_WS | IO45 | × | × |
59 | +------------------+------------------+---------------+-----------------+
60 | | DSPEAKER_I2S_SDO | IO47 | × | × |
61 | +------------------+------------------+---------------+-----------------+
62 |
63 | .. note::
64 | `ESP32S3` 开启扬声器功能,需使用 IDF 版本 v5.0 及以上。
65 |
66 | 代码
67 | ---------
68 |
69 | 以下所示为调用语音识别模型的部分代码:
70 |
71 | .. code-block:: c
72 |
73 | i2s_read(1, buffer, size * 2 * sizeof(int), &read_len, portMAX_DELAY);
74 |
75 | for (int x = 0; x < size * 2 / 4; x++) {
76 | int s1 = ((buffer[x * 4] + buffer[x * 4 + 1]) >> 13) & 0x0000FFFF;
77 | int s2 = ((buffer[x * 4 + 2] + buffer[x * 4 + 3]) << 3) & 0xFFFF0000;
78 | buffer[x] = s1 | s2;
79 | }
80 |
81 | if (enable_wn) {
82 | wakenet_state_t r = wakenet->detect(model_wn_data, (int16_t *)buffer);
83 |
84 | if (r == WAKENET_DETECTED) {
85 | ESP_LOGI(TAG, "%s DETECTED", wakenet->get_word_name(model_wn_data, r));
86 |
87 | if (NULL != g_sr_callback_func[SR_CB_TYPE_WAKE].fn) {
88 | g_sr_callback_func[SR_CB_TYPE_WAKE].fn(g_sr_callback_func[SR_CB_TYPE_WAKE].args);
89 | }
90 |
91 | enable_wn = false;
92 | }
93 | } else {
94 | esp_mn_state_t mn_state = multinet->detect(model_mn_data, (int16_t *)buffer);
95 | if (mn_state == ESP_MN_STATE_DETECTED) {
96 | esp_mn_results_t *mn_result = multinet->get_results(model_mn_data);
97 | ESP_LOGI(TAG, "MN test successfully, Commands ID: %d", mn_result->phrase_id[0]);
98 | int command_id = mn_result->phrase_id[0];
99 |
100 | if (NULL != g_sr_callback_func[SR_CB_TYPE_CMD].fn) {
101 | if (NULL != g_sr_callback_func[SR_CB_TYPE_CMD].args) {
102 | g_sr_callback_func[SR_CB_TYPE_CMD].fn(g_sr_callback_func[SR_CB_TYPE_CMD].args);
103 | } else {
104 | g_sr_callback_func[SR_CB_TYPE_CMD].fn((void *)command_id);
105 | }
106 | }
107 |
108 | } else if (mn_state == ESP_MN_STATE_TIMEOUT) {
109 | esp_mn_results_t *mn_result = multinet->get_results(model_mn_data);
110 | ESP_LOGI(TAG, "timeout, string:%s\n", mn_result->string);
111 |
112 | if (NULL != g_sr_callback_func[SR_CB_TYPE_CMD_EXIT].fn) {
113 | g_sr_callback_func[SR_CB_TYPE_CMD_EXIT].fn(g_sr_callback_func[SR_CB_TYPE_CMD_EXIT].args);
114 | }
115 |
116 | enable_wn = true;
117 | } else {
118 | continue;
119 | }
120 | }
121 |
122 | - 首先调用 :c:func:`i2s_read` 从麦克风读取一段音频数据,然后进行数据格式的调整。
123 | - 根据 ``enable_wn`` 变量来控制使用唤醒识别还是命令词识别。
124 | - 调用 :c:func:`detect` 函数将音频数据送入对应的识别网络进行识别。
125 | - 在识别命令词时,当识别超时时回到唤醒词识别状态。
126 |
127 |
128 | 命令词定义
129 | ---------------
130 |
131 | ``app_speech_rec.c`` 文件中定义了 11 条控制命令,如下所示:
132 |
133 | ::
134 |
135 | char *commands[] = {
136 | "da kai dian deng",
137 | "kai deng",
138 | "da kai xiao ye deng",
139 | "guan bi dian deng",
140 | "guan deng",
141 | "guan bi xiao ye deng",
142 | "huan yi ge yan se",
143 | "liang yi dian",
144 | "zeng da liang du",
145 | "an yi dian",
146 | "jian xiao liang du",
147 | };
148 |
149 | esp_mn_commands_clear();
150 | for (int i = 0; i`_。
157 | 请注意,添加语音命令后需更改语音命令的数量,使之显示实际数量。
158 |
159 |
160 | 演示
161 | ---------------
162 |
163 | - 先说出唤醒词“Hi,乐鑫”,唤醒开发板,让 ESP32 运行命令词识别模型,此时 LED 呈现绿色呼吸灯状态。
164 | - 唤醒后可说出“打开电灯”、“关闭电灯”、“增大亮度”等命令来控制灯的状态,前文已列出可支持的全部语音指令。
165 | - 支持连续对话,唤醒一次后,可连续识别多条命令。
166 | - 唤醒后亮绿色呼吸灯为命令词识别状态,若一段时间后未识别到有效指令,开发板将自动回到等待唤醒的状态。
167 |
168 |
--------------------------------------------------------------------------------
/examples/1_hello_world/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # The following lines of boilerplate have to be in your project's CMakeLists
2 | # in this exact order for cmake to work correctly
3 | cmake_minimum_required(VERSION 3.5)
4 |
5 | include($ENV{IDF_PATH}/tools/cmake/project.cmake)
6 | project(moonlight)
7 |
--------------------------------------------------------------------------------
/examples/1_hello_world/main/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | idf_component_register(SRCS "app_main.c"
2 | INCLUDE_DIRS ".")
3 |
--------------------------------------------------------------------------------
/examples/1_hello_world/main/app_main.c:
--------------------------------------------------------------------------------
1 | /* Hello World Example
2 |
3 | This example code is in the Public Domain (or CC0 licensed, at your option.)
4 |
5 | Unless required by applicable law or agreed to in writing, this
6 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
7 | CONDITIONS OF ANY KIND, either express or implied.
8 | */
9 | #include
10 | #include "freertos/FreeRTOS.h"
11 | #include "freertos/task.h"
12 | #include "board_moonlight.h"
13 |
14 | void app_main()
15 | {
16 | int i = 0;
17 | #if CONFIG_ESP32_MOONLIGHT_BOARD
18 | printf("Select ESP32_MOONLIGHT_BOARD\n");
19 | #elif CONFIG_ESP32_S3_MOONLIGHT_BOARD
20 | printf("Select ESP32_S3_MOONLIGHT_BOARD\n");
21 | #endif
22 |
23 | while (1) {
24 | printf("[%d] Hello world!\n", i);
25 | i++;
26 | vTaskDelay(3000 / portTICK_PERIOD_MS);
27 | }
28 | }
--------------------------------------------------------------------------------
/examples/1_hello_world/main/idf_component.yml:
--------------------------------------------------------------------------------
1 | ## IDF Component Manager Manifest File
2 | dependencies:
3 | moonlight_board:
4 | override_path: ../../../components/moonlight_board
5 | ## Required IDF version
6 | idf:
7 | version: ">=4.1.0"
8 |
--------------------------------------------------------------------------------
/examples/2_drivers/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # The following lines of boilerplate have to be in your project's CMakeLists
2 | # in this exact order for cmake to work correctly
3 | cmake_minimum_required(VERSION 3.5)
4 |
5 | include($ENV{IDF_PATH}/tools/cmake/project.cmake)
6 | project(moonlight)
7 |
--------------------------------------------------------------------------------
/examples/2_drivers/main/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | idf_component_register(SRCS "app_main.c"
2 | INCLUDE_DIRS ".")
3 |
--------------------------------------------------------------------------------
/examples/2_drivers/main/app_main.c:
--------------------------------------------------------------------------------
1 | /* Driver Example
2 |
3 | This example code is in the Public Domain (or CC0 licensed, at your option.)
4 |
5 | Unless required by applicable law or agreed to in writing, this
6 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
7 | CONDITIONS OF ANY KIND, either express or implied.
8 | */
9 |
10 | #include "sdkconfig.h"
11 | #include "freertos/FreeRTOS.h"
12 | #include "freertos/task.h"
13 | #include "esp_log.h"
14 | #include "esp_check.h"
15 | #include "board_moonlight.h"
16 |
17 | static const char *TAG = "moonlight";
18 | static led_rgb_t *g_leds = NULL;
19 | uint8_t g_led_mode = 0; /**< led mode 0:color fade 1:fixed color */
20 |
21 | static void vibration_handle(void *arg)
22 | {
23 | uint16_t h;
24 | uint8_t s;
25 |
26 | if (!g_led_mode) {
27 | return;
28 | }
29 |
30 | /**< Set a random color */
31 | h = esp_random() / 11930465;
32 | s = esp_random() / 42949673;
33 | s = s < 40 ? 40 : s;
34 |
35 | ESP_ERROR_CHECK(g_leds->set_hsv(g_leds, h, s, 100));
36 | }
37 |
38 | static void button_press_down_cb(void *arg, void *data)
39 | {
40 | if (g_led_mode) {
41 | g_led_mode = 0;
42 | } else {
43 | g_led_mode = 1;
44 | }
45 |
46 | ESP_LOGI(TAG, "Set the light mode to %d", g_led_mode);
47 | }
48 |
49 | static esp_err_t button_init(void)
50 | {
51 | button_handle_t button = board_button_init();
52 | esp_err_t ret = iot_button_register_cb(button, BUTTON_PRESS_DOWN, button_press_down_cb, NULL);
53 | return ret;
54 | }
55 |
56 | void app_main(void)
57 | {
58 | /**< configure led driver */
59 | g_leds = board_rgb_init();
60 |
61 | /**< Configure button and sensors */
62 | ESP_ERROR_CHECK(button_init());
63 | ESP_ERROR_CHECK(board_sensor_init(vibration_handle));
64 |
65 | ESP_LOGI(TAG, "Color fade start");
66 |
67 | while (true) {
68 | board_led_rgb_ctrl(g_leds, g_led_mode);
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/examples/2_drivers/main/idf_component.yml:
--------------------------------------------------------------------------------
1 | ## IDF Component Manager Manifest File
2 | dependencies:
3 | espressif/button: "^3.0.1"
4 | moonlight_board:
5 | override_path: ../../../components/moonlight_board
6 | ## Required IDF version
7 | idf:
8 | version: ">=4.1.0"
9 |
--------------------------------------------------------------------------------
/examples/3_wifi_connection/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # The following lines of boilerplate have to be in your project's CMakeLists
2 | # in this exact order for cmake to work correctly
3 | cmake_minimum_required(VERSION 3.5)
4 |
5 | include($ENV{IDF_PATH}/tools/cmake/project.cmake)
6 | project(moonlight)
--------------------------------------------------------------------------------
/examples/3_wifi_connection/main/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | idf_component_register(SRCS "app_main.c"
2 | INCLUDE_DIRS ".")
3 |
--------------------------------------------------------------------------------
/examples/3_wifi_connection/main/Kconfig.projbuild:
--------------------------------------------------------------------------------
1 | menu "Example Configuration"
2 |
3 | config ESP_WIFI_SSID
4 | string "WiFi SSID"
5 | default "myssid"
6 | help
7 | SSID (network name) for the example to connect to.
8 |
9 | config ESP_WIFI_PASSWORD
10 | string "WiFi Password"
11 | default "mypassword"
12 | help
13 | WiFi password (WPA or WPA2) for the example to use.
14 |
15 | config ESP_MAXIMUM_RETRY
16 | int "Maximum retry"
17 | default 5
18 | help
19 | Set the Maximum retry to avoid station reconnecting to the AP unlimited when the AP is really inexistent.
20 | endmenu
21 |
--------------------------------------------------------------------------------
/examples/3_wifi_connection/main/idf_component.yml:
--------------------------------------------------------------------------------
1 | ## IDF Component Manager Manifest File
2 | dependencies:
3 | moonlight_board:
4 | override_path: ../../../components/moonlight_board
5 | ## Required IDF version
6 | idf:
7 | version: ">=4.1.0"
--------------------------------------------------------------------------------
/examples/4_network_config/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # The following lines of boilerplate have to be in your project's CMakeLists
2 | # in this exact order for cmake to work correctly
3 | cmake_minimum_required(VERSION 3.5)
4 |
5 | include($ENV{IDF_PATH}/tools/cmake/project.cmake)
6 | add_compile_options(-fdiagnostics-color=always
7 | -Wno-unused-variable)
8 | project(moonlight)
9 |
--------------------------------------------------------------------------------
/examples/4_network_config/main/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | idf_component_register(SRCS "app_main.c"
2 | INCLUDE_DIRS ".")
3 |
--------------------------------------------------------------------------------
/examples/4_network_config/main/app_main.c:
--------------------------------------------------------------------------------
1 | /* Network Config Example
2 |
3 | This example code is in the Public Domain (or CC0 licensed, at your option.)
4 |
5 | Unless required by applicable law or agreed to in writing, this
6 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
7 | CONDITIONS OF ANY KIND, either express or implied.
8 | */
9 | #include "sdkconfig.h"
10 | #include "freertos/FreeRTOS.h"
11 | #include "freertos/task.h"
12 | #include "freertos/event_groups.h"
13 | #include "esp_wifi.h"
14 | #include "esp_wpa2.h"
15 | #include "esp_event.h"
16 | #include "esp_log.h"
17 | #include "esp_check.h"
18 | #include "esp_system.h"
19 | #include "nvs_flash.h"
20 | #include "esp_netif.h"
21 | #include "string.h"
22 | #include "iot_button.h"
23 | #include "led_rgb.h"
24 | #include "board_moonlight.h"
25 | #include "blufi.h"
26 |
27 | static const char *TAG = "moonlight";
28 | static TaskHandle_t g_breath_light_task_handle = NULL;
29 | static led_rgb_t *g_leds = NULL;
30 |
31 | static void button_press_3sec_cb(void *arg, void *data)
32 | {
33 | ESP_LOGW(TAG, "Restore factory settings");
34 | nvs_flash_erase();
35 | esp_restart();
36 | }
37 |
38 | static esp_err_t button_init(void)
39 | {
40 | button_handle_t button = board_button_init();
41 | esp_err_t ret = iot_button_register_cb(button, BUTTON_LONG_PRESS_START, button_press_3sec_cb, NULL);
42 | return ret;
43 | }
44 |
45 | void app_main(void)
46 | {
47 | uint16_t hue = 0;
48 | /**< Initialize NVS */
49 | ESP_ERROR_CHECK(board_nvs_flash_init());
50 | /**< Initialize button */
51 | ESP_ERROR_CHECK(button_init());
52 | /**< configure led driver */
53 | g_leds = board_rgb_init();
54 |
55 | /**< Turn on the breathing light */
56 | xTaskCreatePinnedToCore(breath_light_task, "breath_light_task", 1024 * 3, (void*)g_leds, 5, &g_breath_light_task_handle, 1);
57 |
58 | /**< Initialize the BluFi */
59 | blufi_network_init();
60 | bool configured;
61 | blufi_is_configured(&configured);
62 |
63 | if (!configured) {
64 | blufi_start();
65 | }
66 |
67 | ESP_LOGI(TAG, "Wait for connect");
68 | blufi_wait_connection(portMAX_DELAY);
69 |
70 | if (!configured) {
71 | blufi_stop();
72 | }
73 |
74 | vTaskDelete(g_breath_light_task_handle);
75 | ESP_LOGI(TAG, "Color fade start");
76 |
77 | while (true) {
78 |
79 | /**< Write HSV values to LED */
80 | ESP_ERROR_CHECK(g_leds->set_hsv(g_leds, hue, 100, 80));
81 | vTaskDelay(pdMS_TO_TICKS(30));
82 | hue++;
83 |
84 | if (hue > 360) {/**< The maximum value of hue in HSV color space is 360 */
85 | hue = 0;
86 | }
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/examples/4_network_config/main/idf_component.yml:
--------------------------------------------------------------------------------
1 | ## IDF Component Manager Manifest File
2 | dependencies:
3 | espressif/button: "^3.0.1"
4 | moonlight_board:
5 | override_path: ../../../components/moonlight_board
6 | blufi:
7 | override_path: ../../../components/blufi
8 | ## Required IDF version
9 | idf:
10 | version: ">=4.1.0"
11 | # # Put list of dependencies here
12 | # # For components maintained by Espressif:
13 | # component: "~1.0.0"
14 | # # For 3rd party components:
15 | # username/component: ">=1.0.0,<2.0.0"
16 | # username2/component2:
17 | # version: "~1.0.0"
18 | # # For transient dependencies `public` flag can be set.
19 | # # `public` flag doesn't have an effect dependencies of the `main` component.
20 | # # All dependencies of `main` are public by default.
21 | # public: true
22 |
--------------------------------------------------------------------------------
/examples/4_network_config/partitions.csv:
--------------------------------------------------------------------------------
1 | # Name, Type, SubType, Offset, Size, Flags
2 | # Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
3 | nvs, data, nvs, 0x9000, 0x6000,
4 | phy_init, data, phy, 0xf000, 0x1000,
5 | factory, app, factory, 0x10000, 2M,
6 |
--------------------------------------------------------------------------------
/examples/4_network_config/sdkconfig.defaults:
--------------------------------------------------------------------------------
1 | # Override some defaults so BT stack is enabled
2 |
3 |
4 | #
5 | # SDK tool configuration
6 | #
7 | CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
8 |
9 | #
10 | # Partition config
11 | #
12 | CONFIG_PARTITION_TABLE_CUSTOM=y
13 | CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
14 | CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
15 | CONFIG_PARTITION_TABLE_OFFSET=0x8000
16 |
17 | #
18 | # BT config
19 | #
20 | CONFIG_BT_ENABLED=y
21 | CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y
22 | CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n
23 | CONFIG_BTDM_CTRL_MODE_BTDM=n
24 | CONFIG_BTDM_CTRL_PINNED_TO_CORE_0=y
25 | CONFIG_BTDM_CTRL_PINNED_TO_CORE_1=n
26 | CONFIG_BTDM_CTRL_PINNED_TO_CORE=0
27 | CONFIG_BTDM_CTRL_HCI_MODE_VHCI=y
28 | CONFIG_BTDM_CTRL_HCI_MODE_UART_H4=n
29 | CONFIG_BT_BLUEDROID_ENABLED=y
30 | CONFIG_BT_BLUEDROID_PINNED_TO_CORE_0=y
31 | CONFIG_BT_BLUEDROID_PINNED_TO_CORE_1=n
32 | CONFIG_BT_BLUEDROID_PINNED_TO_CORE=0
33 | CONFIG_BT_BTC_TASK_STACK_SIZE=3072
34 | CONFIG_BT_BLUEDROID_MEM_DEBUG=n
35 | CONFIG_BT_CLASSIC_ENABLED=n
36 | CONFIG_BT_GATTS_ENABLE=y
37 | CONFIG_BT_GATTC_ENABLE=n
38 | CONFIG_BT_BLE_SMP_ENABLE=n
39 | CONFIG_BL_ENABLE_SRVCHG_REG=y
40 | CONFIG_BT_STACK_NO_LOG=n
41 | CONFIG_BT_ACL_CONNECTIONS=4
42 | CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST=n
43 | CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY=n
44 | CONFIG_BT_SMP_ENABLE=n
45 | CONFIG_BT_BLE_BLUFI_ENABLE=y
46 | CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
47 |
48 | #
49 | # Certificates
50 | #
51 | CONFIG_MBEDTLS_DHM_C=y
--------------------------------------------------------------------------------
/examples/5_app_control/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # The following lines of boilerplate have to be in your project's CMakeLists
2 | # in this exact order for cmake to work correctly
3 | cmake_minimum_required(VERSION 3.5)
4 |
5 | include($ENV{IDF_PATH}/tools/cmake/project.cmake)
6 | add_compile_options(-fdiagnostics-color=always
7 | -Wno-unused-variable)
8 | project(moonlight)
9 |
--------------------------------------------------------------------------------
/examples/5_app_control/main/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | idf_component_register(SRCS "app_main.c"
2 | INCLUDE_DIRS ".")
3 |
--------------------------------------------------------------------------------
/examples/5_app_control/main/Kconfig.projbuild:
--------------------------------------------------------------------------------
1 | menu "Example Configuration"
2 |
3 | config EXAMPLE_PORT
4 | int "UDP Port"
5 | range 0 65535
6 | default 3333
7 | help
8 | Local port the example server will listen on.
9 |
10 | endmenu
11 |
--------------------------------------------------------------------------------
/examples/5_app_control/main/app_main.c:
--------------------------------------------------------------------------------
1 | /* APP Control Example
2 |
3 | This example code is in the Public Domain (or CC0 licensed, at your option.)
4 |
5 | Unless required by applicable law or agreed to in writing, this
6 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
7 | CONDITIONS OF ANY KIND, either express or implied.
8 | */
9 | #include "sdkconfig.h"
10 | #include "freertos/FreeRTOS.h"
11 | #include "freertos/task.h"
12 | #include "freertos/event_groups.h"
13 | #include "esp_system.h"
14 | #include "esp_wifi.h"
15 | #include "esp_event.h"
16 | #include "esp_log.h"
17 | #include "esp_check.h"
18 |
19 | #include "lwip/err.h"
20 | #include "lwip/sys.h"
21 | #include "lwip/sockets.h"
22 | #include
23 | #include "cJSON.h"
24 |
25 | #include "board_moonlight.h"
26 | #include "blufi.h"
27 |
28 | static const char *TAG = "moonlight";
29 | static led_rgb_t *g_leds = NULL;
30 | static uint8_t g_red;
31 | static uint8_t g_green;
32 | static uint8_t g_blue;
33 | static TaskHandle_t g_breath_light_task_handle = NULL;
34 |
35 | #define PORT CONFIG_EXAMPLE_PORT
36 |
37 |
38 | static void button_press_3sec_cb(void *arg, void *data)
39 | {
40 | ESP_LOGW(TAG, "Restore factory settings");
41 | nvs_flash_erase();
42 | esp_restart();
43 | }
44 |
45 | static esp_err_t button_init(void)
46 | {
47 | button_handle_t button = board_button_init();
48 | esp_err_t ret = iot_button_register_cb(button, BUTTON_LONG_PRESS_START, button_press_3sec_cb, NULL);
49 | return ret;
50 | }
51 |
52 | static void udp_server_task(void *pvParameters)
53 | {
54 | char rx_buffer[128];
55 | char addr_str[128];
56 | int addr_family = (int)AF_INET;
57 | int ip_protocol = 0;
58 | struct sockaddr_in6 dest_addr;
59 |
60 | while (1) {
61 |
62 | if (addr_family == AF_INET) {
63 | struct sockaddr_in *dest_addr_ip4 = (struct sockaddr_in *)&dest_addr;
64 | dest_addr_ip4->sin_addr.s_addr = htonl(INADDR_ANY);
65 | dest_addr_ip4->sin_family = AF_INET;
66 | dest_addr_ip4->sin_port = htons(PORT);
67 | ip_protocol = IPPROTO_IP;
68 | }
69 |
70 | int sock = socket(addr_family, SOCK_DGRAM, ip_protocol);
71 |
72 | if (sock < 0) {
73 | ESP_LOGE(TAG, "Unable to create socket: errno %d", errno);
74 | break;
75 | }
76 |
77 | ESP_LOGI(TAG, "Socket created");
78 |
79 | int err = bind(sock, (struct sockaddr *)&dest_addr, sizeof(dest_addr));
80 |
81 | if (err < 0) {
82 | ESP_LOGE(TAG, "Socket unable to bind: errno %d", errno);
83 | }
84 |
85 | ESP_LOGI(TAG, "Socket bound, port %d", PORT);
86 |
87 | while (1) {
88 |
89 | ESP_LOGI(TAG, "Waiting for data");
90 | struct sockaddr_in6 source_addr; /**< Large enough for both IPv4 or IPv6 */
91 | socklen_t socklen = sizeof(source_addr);
92 | int len = recvfrom(sock, rx_buffer, sizeof(rx_buffer) - 1, 0, (struct sockaddr *)&source_addr, &socklen);
93 |
94 | /**< Error occurred during receiving */
95 | if (len < 0) {
96 | ESP_LOGE(TAG, "recvfrom failed: errno %d", errno);
97 | break;
98 | }
99 | /**< Data received */
100 | else {
101 | /**< Get the sender's ip address as string */
102 | if (source_addr.sin6_family == PF_INET) {
103 | inet_ntoa_r(((struct sockaddr_in *)&source_addr)->sin_addr.s_addr, addr_str, sizeof(addr_str) - 1);
104 | } else if (source_addr.sin6_family == PF_INET6) {
105 | inet6_ntoa_r(source_addr.sin6_addr, addr_str, sizeof(addr_str) - 1);
106 | }
107 |
108 | rx_buffer[len] = 0; /**< Null-terminate whatever we received and treat like a string... */
109 | ESP_LOGI(TAG, "Received %d bytes from %s:", len, addr_str);
110 |
111 | cJSON *root = cJSON_Parse(rx_buffer);
112 |
113 | if (!root) {
114 | printf("JSON format error:%s \r\n", cJSON_GetErrorPtr());
115 | } else {
116 | cJSON *item = cJSON_GetObjectItem(root, "led");
117 | int32_t red = cJSON_GetObjectItem(item, "red")->valueint;
118 | int32_t green = cJSON_GetObjectItem(item, "green")->valueint;
119 | int32_t blue = cJSON_GetObjectItem(item, "blue")->valueint;
120 | cJSON_Delete(root);
121 |
122 | if (red != g_red || green != g_green || blue != g_blue) {
123 | g_red = red;
124 | g_green = green;
125 | g_blue = blue;
126 | ESP_LOGI(TAG, "Light control: red = %d, green = %d, blue = %d", g_red, g_green, g_blue);
127 | ESP_ERROR_CHECK(g_leds->set_rgb(g_leds, g_red, g_green, g_blue));
128 | }
129 | }
130 | }
131 | }
132 |
133 | if (sock != -1) {
134 | ESP_LOGE(TAG, "Shutting down socket and restarting...");
135 | shutdown(sock, 0);
136 | close(sock);
137 | }
138 | }
139 |
140 | vTaskDelete(NULL);
141 | }
142 |
143 | void app_main(void)
144 | {
145 | /**< Initialize NVS */
146 | ESP_ERROR_CHECK(board_nvs_flash_init());
147 | /**< Initialize button */
148 | ESP_ERROR_CHECK(button_init());
149 | /**< configure led driver */
150 | g_leds = board_rgb_init();
151 |
152 | /**< Turn on the breathing light */
153 | xTaskCreatePinnedToCore(breath_light_task, "breath_light_task", 1024 * 3, (void*)g_leds, 5, &g_breath_light_task_handle, 1);
154 |
155 | /**< Initialize the BluFi */
156 | blufi_network_init();
157 | bool configured;
158 | blufi_is_configured(&configured);
159 |
160 | if (!configured) {
161 | blufi_start();
162 | }
163 |
164 | ESP_LOGI(TAG, "Wait for connect");
165 | blufi_wait_connection(portMAX_DELAY);
166 |
167 | if (!configured) {
168 | blufi_stop();
169 | }
170 |
171 | vTaskDelete(g_breath_light_task_handle);
172 |
173 | /**< It's connected. It's time to change the light to white */
174 | ESP_ERROR_CHECK(g_leds->set_rgb(g_leds, 128, 128, 128));
175 | xTaskCreatePinnedToCore(udp_server_task, "udp_server_task", 1024 * 5, NULL, 5, NULL, 1);
176 | }
177 |
--------------------------------------------------------------------------------
/examples/5_app_control/main/idf_component.yml:
--------------------------------------------------------------------------------
1 | ## IDF Component Manager Manifest File
2 | dependencies:
3 | espressif/button: "^3.0.1"
4 | moonlight_board:
5 | override_path: ../../../components/moonlight_board
6 | blufi:
7 | override_path: ../../../components/blufi
8 | ## Required IDF version
9 | idf:
10 | version: ">=4.1.0"
11 | # # Put list of dependencies here
12 | # # For components maintained by Espressif:
13 | # component: "~1.0.0"
14 | # # For 3rd party components:
15 | # username/component: ">=1.0.0,<2.0.0"
16 | # username2/component2:
17 | # version: "~1.0.0"
18 | # # For transient dependencies `public` flag can be set.
19 | # # `public` flag doesn't have an effect dependencies of the `main` component.
20 | # # All dependencies of `main` are public by default.
21 | # public: true
22 |
--------------------------------------------------------------------------------
/examples/5_app_control/partitions.csv:
--------------------------------------------------------------------------------
1 | # Name, Type, SubType, Offset, Size, Flags
2 | # Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
3 | nvs, data, nvs, 0x9000, 0x6000,
4 | phy_init, data, phy, 0xf000, 0x1000,
5 | factory, app, factory, 0x10000, 2M,
6 |
--------------------------------------------------------------------------------
/examples/5_app_control/sdkconfig.defaults:
--------------------------------------------------------------------------------
1 | # Override some defaults so BT stack is enabled
2 |
3 |
4 | #
5 | # SDK tool configuration
6 | #
7 | CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
8 |
9 | #
10 | # Partition config
11 | #
12 | CONFIG_PARTITION_TABLE_CUSTOM=y
13 | CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
14 | CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
15 | CONFIG_PARTITION_TABLE_OFFSET=0x8000
16 |
17 | #
18 | # BT config
19 | #
20 | CONFIG_BT_ENABLED=y
21 | CONFIG_BT_BLE_BLUFI_ENABLE=y
22 | CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y
23 | CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n
24 | CONFIG_BTDM_CTRL_MODE_BTDM=n
25 | CONFIG_BTDM_CTRL_PINNED_TO_CORE_0=y
26 | CONFIG_BTDM_CTRL_PINNED_TO_CORE_1=n
27 | CONFIG_BTDM_CTRL_PINNED_TO_CORE=0
28 | CONFIG_BTDM_CTRL_HCI_MODE_VHCI=y
29 | CONFIG_BTDM_CTRL_HCI_MODE_UART_H4=n
30 | CONFIG_BT_BLUEDROID_ENABLED=y
31 | CONFIG_BT_BLUEDROID_PINNED_TO_CORE_0=y
32 | CONFIG_BT_BLUEDROID_PINNED_TO_CORE_1=n
33 | CONFIG_BT_BLUEDROID_PINNED_TO_CORE=0
34 | CONFIG_BT_BTC_TASK_STACK_SIZE=3072
35 | CONFIG_BT_BLUEDROID_MEM_DEBUG=n
36 | CONFIG_BT_CLASSIC_ENABLED=n
37 | CONFIG_BT_GATTS_ENABLE=y
38 | CONFIG_BT_GATTC_ENABLE=n
39 | CONFIG_BT_BLE_SMP_ENABLE=n
40 | CONFIG_BL_ENABLE_SRVCHG_REG=y
41 | CONFIG_BT_STACK_NO_LOG=n
42 | CONFIG_BT_ACL_CONNECTIONS=4
43 | CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST=n
44 | CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY=n
45 | CONFIG_BT_SMP_ENABLE=n
46 | CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
47 |
48 | #
49 | # Certificates
50 | #
51 | CONFIG_MBEDTLS_DHM_C=y
52 |
--------------------------------------------------------------------------------
/examples/6_ota/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # The following lines of boilerplate have to be in your project's CMakeLists
2 | # in this exact order for cmake to work correctly
3 | cmake_minimum_required(VERSION 3.5)
4 |
5 | include($ENV{IDF_PATH}/tools/cmake/project.cmake)
6 | add_compile_options(-fdiagnostics-color=always
7 | -Wno-unused-variable)
8 | project(moonlight)
9 |
--------------------------------------------------------------------------------
/examples/6_ota/https_server/ca_cert.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIEAzCCAuugAwIBAgIUTWEHU42eKNDV+QV0s8fnINMreCAwDQYJKoZIhvcNAQEL
3 | BQAwgZAxCzAJBgNVBAYTAkNOMRAwDgYDVQQIDAdKaWFuZ3N1MQ8wDQYDVQQHDAZT
4 | dXpob3UxEjAQBgNVBAoMCUVzcHJlc3NpZjEMMAoGA1UECwwDY29tMRUwEwYDVQQD
5 | DAwxOTIuMTY4LjEuNjgxJTAjBgkqhkiG9w0BCQEWFmxpYW5naGFvQGVzcHJlc3Np
6 | Zi5jb20wHhcNMjMxMDEyMDkyMzU2WhcNMjQxMDExMDkyMzU2WjCBkDELMAkGA1UE
7 | BhMCQ04xEDAOBgNVBAgMB0ppYW5nc3UxDzANBgNVBAcMBlN1emhvdTESMBAGA1UE
8 | CgwJRXNwcmVzc2lmMQwwCgYDVQQLDANjb20xFTATBgNVBAMMDDE5Mi4xNjguMS42
9 | ODElMCMGCSqGSIb3DQEJARYWbGlhbmdoYW9AZXNwcmVzc2lmLmNvbTCCASIwDQYJ
10 | KoZIhvcNAQEBBQADggEPADCCAQoCggEBAMv93gY8zRwpYW4U41wKVW3wkkJN3TvP
11 | /sRtgpPmlmo2OWqTih6r1ODlBD/JuWgq+7P3+BWcq/DEya3lU0+1UOYJSGKLFF7E
12 | kuxtOmFoAKwsVLN/kgLeHNvOqwJw/5d0L+t1YxnS8AlENJYtPyXtz9m0RcXHI7ye
13 | 0D1TqE9Mve9Cjx3JL8biiK1jfj/95+5k2h/7fF7OkMcTxPACGdrZEsl/FxsnE5Kq
14 | KZoyYv6QWewN2zChYWPt9dCFIai2We5sGXNO3KDLb3mVs7FnmyPcFYEkRHwawwhp
15 | p+EAvGKZWA8VOsWBx8f7YPHXQYxPUQAktPNJo7r5QsgpKHiVP/tUORsCAwEAAaNT
16 | MFEwHQYDVR0OBBYEFOSYYBOA/maiwwDtr9rqyKZiQdLhMB8GA1UdIwQYMBaAFOSY
17 | YBOA/maiwwDtr9rqyKZiQdLhMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEL
18 | BQADggEBAB8c80rwMKNQ56suZpBxRgVZEubKAMe5Z3+XW41uU/FpTQoPa/pD2Kl/
19 | dBDp4FRz7/XLtWVymiBDcL28Jen6CKydmusL0BKV9muzKPyt+JtvDxvUQVCLRLZ4
20 | J+648+KBid+qXfIIUDtW/xgncS/c1OhCwOtxblBfyjEjVLp5EOCT03C6RvOK6Qsk
21 | dHz/sObMvVRwS1A2yxnsrSZNmHkveMZnNLuvcoKVqTYzneLmAYl/8Ted0PG2H1Zk
22 | zNJJA90lyC7aR/XIkPsNXCdlNg9Ww6DQPVFLhrJwPuFTFt4Qop4PyL+A9SZZQdAm
23 | APo4agv9RTyrVgVz/bsrtqtlgbaXAX4=
24 | -----END CERTIFICATE-----
25 |
--------------------------------------------------------------------------------
/examples/6_ota/https_server/ca_key.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN PRIVATE KEY-----
2 | MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDL/d4GPM0cKWFu
3 | FONcClVt8JJCTd07z/7EbYKT5pZqNjlqk4oeq9Tg5QQ/ybloKvuz9/gVnKvwxMmt
4 | 5VNPtVDmCUhiixRexJLsbTphaACsLFSzf5IC3hzbzqsCcP+XdC/rdWMZ0vAJRDSW
5 | LT8l7c/ZtEXFxyO8ntA9U6hPTL3vQo8dyS/G4oitY34//efuZNof+3xezpDHE8Tw
6 | Ahna2RLJfxcbJxOSqimaMmL+kFnsDdswoWFj7fXQhSGotlnubBlzTtygy295lbOx
7 | Z5sj3BWBJER8GsMIaafhALximVgPFTrFgcfH+2Dx10GMT1EAJLTzSaO6+ULIKSh4
8 | lT/7VDkbAgMBAAECggEAF31HpCs7KRuAuxbPqWkNNkgl51mk+H62ZPMBPrumJVvS
9 | F7oehPKfZDgq2ZeGcH7Glg4fNIniaKqYWJxYEA0eYCbAfYxrT5BOJMhdGRtLPIgs
10 | RrERZKAj7ZGqMnFFlTCNVg0h2Lbn6gE/Fu3l4B22uehewmvwawdUjkNEVcFN+69X
11 | E79CrEjQB2UEgWWDQRglCi3NQtaRriZ3ZZkCShvVXcLCoOH0cZsuKNa/2fIokA+c
12 | f6H0g2YDrBfvQB5TSJkJTezpTs3R9xPTHNbyHs9H03wly8fVcZZPAG5etv4jZWYb
13 | 1AhrYjAV0pcKHLsl0vX2aq0pCFA5Jk9mArkmgMeRWQKBgQD3t3B2se1dnNUN3vB4
14 | Lw0+GphXkSMqPJITtK91Kv4julCcCeh5tioHn0l2xD4mjFEBODfOglHCDu4IYLtB
15 | ojm2zc8QW4Ad28n6rxkTd5wiv7mp0E0AYaUqAQgEFL+P3/1Nib7/Ac4QtA4exJra
16 | D725x9Dx1Voij7tZmWd6f1QEuQKBgQDS0B/Agm1/3XvV6eFdi0pxWhTZ+0A4XUhC
17 | UXpNmkJQpxFLMngj7QilmcqW0ew1+oXCKkOKhjQkFILre7pSfsPiazZQEjxZgchS
18 | 7dllKhuG/XYG1km1GhSMB5S+bo620GoHljmi6ZOkUEdFjxh3v+H0yZ4wkP3xIlfq
19 | t+ymBe3qcwKBgQDjBaz+OuaNKpRfl/fOTWDXj8waRJtzs/s0MB21ReePmssRlksG
20 | cJpoTeUoAYXsEiCS+5C5o9mF/eTMrMowxpoaHNgt542sz6d2JU7X9oCToB5psMtB
21 | FDwoGLXd953wH5mnnBv83QybZkiijhBU1KRORQALAjsO/ab34I1jSJoZkQKBgDBY
22 | 1s9Zmi825k2aw7qmVT5FwH51ZrcGfann8bqWZBsHFao/OtpSZCdGa/XG0vtWJxLu
23 | imrceFzF73h9+a8tr1Lf76bRZ9HHN9/8+FyBGasNueG7h0/nWUr7+hrqVASNK6Pt
24 | ye4Yz2lhl9bWCHB+Kx3ulz7gIb0JeUw1PiqdNYENAoGBAPbAi3McCh4CbIZwUdqY
25 | 5mYdhPLbL7bnzY5fEs4kS2Io1TfcgwzJio4GenhFDaa5pAhRQQvdANFl1flmVIgf
26 | 16dlVHhfYDi1JUnEfCnjwhaWno5//qJYPaDCtwYoJP4YzT8IcthyyJC91XRRVCsO
27 | isvm0F7JMiKU678KUc3BfqhK
28 | -----END PRIVATE KEY-----
29 |
--------------------------------------------------------------------------------
/examples/6_ota/https_server/moonlight.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/examples/6_ota/https_server/moonlight.bin
--------------------------------------------------------------------------------
/examples/6_ota/main/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | # Embed the server root certificate into the final binary
3 | idf_build_get_property(project_dir PROJECT_DIR)
4 | idf_component_register(SRCS "app_main.c"
5 | "ota.c"
6 | EMBED_TXTFILES ${project_dir}/https_server/ca_cert.pem)
--------------------------------------------------------------------------------
/examples/6_ota/main/Kconfig.projbuild:
--------------------------------------------------------------------------------
1 | menu "Example Configuration"
2 |
3 | config EXAMPLE_PORT
4 | int "UDP Port"
5 | range 0 65535
6 | default 3333
7 | help
8 | Local port the example server will listen on.
9 |
10 | config EXAMPLE_FIRMWARE_UPGRADE_URL
11 | string "firmware upgrade url endpoint"
12 | default "https://192.168.0.118:8070/moonlight.bin"
13 | help
14 | URL of server which hosts the firmware
15 | image.
16 |
17 | config EXAMPLE_SKIP_COMMON_NAME_CHECK
18 | bool "Skip server certificate CN fieldcheck"
19 | default n
20 | help
21 | This allows you to skip the validation of OTA server certificate CN field.
22 | endmenu
23 |
--------------------------------------------------------------------------------
/examples/6_ota/main/app_main.c:
--------------------------------------------------------------------------------
1 | /* OTA Example
2 |
3 | This example code is in the Public Domain (or CC0 licensed, at your option.)
4 |
5 | Unless required by applicable law or agreed to in writing, this
6 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
7 | CONDITIONS OF ANY KIND, either express or implied.
8 | */
9 | #include "sdkconfig.h"
10 | #include "freertos/FreeRTOS.h"
11 | #include "freertos/task.h"
12 | #include "freertos/event_groups.h"
13 | #include "esp_system.h"
14 | #include "esp_wifi.h"
15 | #include "esp_event.h"
16 | #include "esp_log.h"
17 | #include "esp_check.h"
18 | #include "nvs_flash.h"
19 |
20 | #include "lwip/err.h"
21 | #include "lwip/sys.h"
22 | #include "lwip/sockets.h"
23 | #include
24 | #include "cJSON.h"
25 |
26 | #include "led_rgb.h"
27 | #include "board_moonlight.h"
28 | #include "blufi.h"
29 | #include "ota.h"
30 | #include "iot_button.h"
31 |
32 | static const char *TAG = "moonlight";
33 | static led_rgb_t *g_leds = NULL;
34 | static uint8_t g_red;
35 | static uint8_t g_green;
36 | static uint8_t g_blue;
37 | static TaskHandle_t g_breath_light_task_handle = NULL;
38 | static SemaphoreHandle_t ota_Semaphore = NULL;
39 |
40 | #define PORT CONFIG_EXAMPLE_PORT
41 |
42 |
43 | static void button_press_3sec_cb(void *arg, void *data)
44 | {
45 | ESP_LOGW(TAG, "Restore factory settings");
46 | nvs_flash_erase();
47 | esp_restart();
48 | }
49 |
50 | static void button_press_cb(void *arg, void *data)
51 | {
52 | xSemaphoreGive(ota_Semaphore);
53 | }
54 |
55 | static esp_err_t button_init(void)
56 | {
57 | button_handle_t button = board_button_init();
58 | esp_err_t ret = iot_button_register_cb(button, BUTTON_LONG_PRESS_START, button_press_3sec_cb, NULL);
59 | ret = iot_button_register_cb(button, BUTTON_PRESS_DOWN, button_press_cb, NULL);
60 | return ret;
61 | }
62 |
63 | static void ota_task(void *pvParameters)
64 | {
65 | while (1) {
66 | xSemaphoreTake(ota_Semaphore, portMAX_DELAY);
67 | ESP_LOGW(TAG, "Start firmware upgrade");
68 | ota_start(CONFIG_EXAMPLE_FIRMWARE_UPGRADE_URL);
69 | }
70 | }
71 |
72 | static void udp_server_task(void *pvParameters)
73 | {
74 | char rx_buffer[128];
75 | char addr_str[128];
76 | int addr_family = (int)AF_INET;
77 | int ip_protocol = 0;
78 | struct sockaddr_in6 dest_addr;
79 |
80 | while (1) {
81 |
82 | if (addr_family == AF_INET) {
83 | struct sockaddr_in *dest_addr_ip4 = (struct sockaddr_in *)&dest_addr;
84 | dest_addr_ip4->sin_addr.s_addr = htonl(INADDR_ANY);
85 | dest_addr_ip4->sin_family = AF_INET;
86 | dest_addr_ip4->sin_port = htons(PORT);
87 | ip_protocol = IPPROTO_IP;
88 | }
89 |
90 | int sock = socket(addr_family, SOCK_DGRAM, ip_protocol);
91 |
92 | if (sock < 0) {
93 | ESP_LOGE(TAG, "Unable to create socket: errno %d", errno);
94 | break;
95 | }
96 |
97 | ESP_LOGI(TAG, "Socket created");
98 |
99 | int err = bind(sock, (struct sockaddr *)&dest_addr, sizeof(dest_addr));
100 |
101 | if (err < 0) {
102 | ESP_LOGE(TAG, "Socket unable to bind: errno %d", errno);
103 | }
104 |
105 | ESP_LOGI(TAG, "Socket bound, port %d", PORT);
106 |
107 | while (1) {
108 |
109 | ESP_LOGI(TAG, "Waiting for data");
110 | struct sockaddr_in6 source_addr; /**< Large enough for both IPv4 or IPv6 */
111 | socklen_t socklen = sizeof(source_addr);
112 | int len = recvfrom(sock, rx_buffer, sizeof(rx_buffer) - 1, 0, (struct sockaddr *)&source_addr, &socklen);
113 |
114 | /**< Error occurred during receiving */
115 | if (len < 0) {
116 | ESP_LOGE(TAG, "recvfrom failed: errno %d", errno);
117 | break;
118 | }
119 | /**< Data received */
120 | else {
121 | /**< Get the sender's ip address as string */
122 | if (source_addr.sin6_family == PF_INET) {
123 | inet_ntoa_r(((struct sockaddr_in *)&source_addr)->sin_addr.s_addr, addr_str, sizeof(addr_str) - 1);
124 | } else if (source_addr.sin6_family == PF_INET6) {
125 | inet6_ntoa_r(source_addr.sin6_addr, addr_str, sizeof(addr_str) - 1);
126 | }
127 |
128 | rx_buffer[len] = 0; /**< Null-terminate whatever we received and treat like a string... */
129 | ESP_LOGI(TAG, "Received %d bytes from %s:", len, addr_str);
130 |
131 | cJSON *root = cJSON_Parse(rx_buffer);
132 |
133 | if (!root) {
134 | printf("JSON format error:%s \r\n", cJSON_GetErrorPtr());
135 | } else {
136 | cJSON *item = cJSON_GetObjectItem(root, "led");
137 | int32_t red = cJSON_GetObjectItem(item, "red")->valueint;
138 | int32_t green = cJSON_GetObjectItem(item, "green")->valueint;
139 | int32_t blue = cJSON_GetObjectItem(item, "blue")->valueint;
140 | cJSON_Delete(root);
141 |
142 | if (red != g_red || green != g_green || blue != g_blue) {
143 | g_red = red;
144 | g_green = green;
145 | g_blue = blue;
146 | ESP_LOGI(TAG, "Light control: red = %d, green = %d, blue = %d", g_red, g_green, g_blue);
147 | ESP_ERROR_CHECK(g_leds->set_rgb(g_leds, g_red, g_green, g_blue));
148 | }
149 |
150 | }
151 |
152 | }
153 | }
154 |
155 | if (sock != -1) {
156 | ESP_LOGE(TAG, "Shutting down socket and restarting...");
157 | shutdown(sock, 0);
158 | close(sock);
159 | }
160 | }
161 |
162 | vTaskDelete(NULL);
163 | }
164 |
165 | void app_main(void)
166 | {
167 | /**< Initialize NVS */
168 | ESP_ERROR_CHECK(board_nvs_flash_init());
169 | /**< Initialize button */
170 | ESP_ERROR_CHECK(button_init());
171 | /**< configure led driver */
172 | g_leds = board_rgb_init();
173 |
174 | /**< Turn on the breathing light */
175 | xTaskCreatePinnedToCore(breath_light_task, "breath_light_task", 1024 * 3, (void*)g_leds, 5, &g_breath_light_task_handle, 1);
176 |
177 | /**< Initialize the BluFi */
178 | blufi_network_init();
179 | bool configured;
180 | blufi_is_configured(&configured);
181 |
182 | if (!configured) {
183 | blufi_start();
184 | }
185 |
186 | ESP_LOGI(TAG, "Wait for connect");
187 | blufi_wait_connection(portMAX_DELAY);
188 |
189 | if (!configured) {
190 | blufi_stop();
191 | }
192 |
193 | vTaskDelete(g_breath_light_task_handle);
194 |
195 | /**< It's connected. It's time to change the light to white */
196 | g_red = 120;
197 | g_green = 120;
198 | g_blue = 120;
199 | ESP_ERROR_CHECK(g_leds->set_rgb(g_leds, 120, 120, 120));
200 |
201 | xTaskCreate(udp_server_task, "udp_server_task", 1024 * 5, NULL, 5, NULL);
202 |
203 | ota_Semaphore = xSemaphoreCreateBinary();
204 | xTaskCreate(ota_task, "ota_task", 1024 * 5, NULL, 6, NULL);
205 |
206 | }
207 |
--------------------------------------------------------------------------------
/examples/6_ota/main/idf_component.yml:
--------------------------------------------------------------------------------
1 | ## IDF Component Manager Manifest File
2 | dependencies:
3 | espressif/button: "^3.0.1"
4 | moonlight_board:
5 | override_path: ../../../components/moonlight_board
6 | blufi:
7 | override_path: ../../../components/blufi
8 | ## Required IDF version
9 | idf:
10 | version: ">=4.1.0"
11 | # # Put list of dependencies here
12 | # # For components maintained by Espressif:
13 | # component: "~1.0.0"
14 | # # For 3rd party components:
15 | # username/component: ">=1.0.0,<2.0.0"
16 | # username2/component2:
17 | # version: "~1.0.0"
18 | # # For transient dependencies `public` flag can be set.
19 | # # `public` flag doesn't have an effect dependencies of the `main` component.
20 | # # All dependencies of `main` are public by default.
21 | # public: true
22 |
--------------------------------------------------------------------------------
/examples/6_ota/main/ota.c:
--------------------------------------------------------------------------------
1 | /* OTA Example
2 |
3 | This example code is in the Public Domain (or CC0 licensed, at your option.)
4 |
5 | Unless required by applicable law or agreed to in writing, this
6 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
7 | CONDITIONS OF ANY KIND, either express or implied.
8 | */
9 | #include "freertos/FreeRTOS.h"
10 | #include "freertos/task.h"
11 | #include "esp_system.h"
12 | #include "esp_idf_version.h"
13 | #include "esp_event.h"
14 | #include "esp_event.h"
15 | #include "esp_log.h"
16 | #include "esp_ota_ops.h"
17 | #include "esp_http_client.h"
18 | #include "esp_https_ota.h"
19 | #include "string.h"
20 |
21 | #include "nvs.h"
22 | #include "nvs_flash.h"
23 |
24 | #if CONFIG_EXAMPLE_CONNECT_WIFI
25 | #include "esp_wifi.h"
26 | #endif
27 |
28 | static const char *TAG = "simple_ota";
29 | extern const uint8_t server_cert_pem_start[] asm("_binary_ca_cert_pem_start");
30 | extern const uint8_t server_cert_pem_end[] asm("_binary_ca_cert_pem_end");
31 |
32 | #define OTA_URL_SIZE 256
33 |
34 | static esp_err_t _http_event_handler(esp_http_client_event_t *evt)
35 | {
36 | switch (evt->event_id) {
37 | case HTTP_EVENT_ERROR:
38 | ESP_LOGD(TAG, "HTTP_EVENT_ERROR");
39 | break;
40 | case HTTP_EVENT_ON_CONNECTED:
41 | ESP_LOGD(TAG, "HTTP_EVENT_ON_CONNECTED");
42 | break;
43 | case HTTP_EVENT_HEADER_SENT:
44 | ESP_LOGD(TAG, "HTTP_EVENT_HEADER_SENT");
45 | break;
46 | case HTTP_EVENT_ON_HEADER:
47 | ESP_LOGD(TAG, "HTTP_EVENT_ON_HEADER, key=%s, value=%s", evt->header_key, evt->header_value);
48 | break;
49 | case HTTP_EVENT_ON_DATA:
50 | ESP_LOGD(TAG, "HTTP_EVENT_ON_DATA, len=%d", evt->data_len);
51 | break;
52 | case HTTP_EVENT_ON_FINISH:
53 | ESP_LOGD(TAG, "HTTP_EVENT_ON_FINISH");
54 | break;
55 | case HTTP_EVENT_DISCONNECTED:
56 | ESP_LOGD(TAG, "HTTP_EVENT_DISCONNECTED");
57 | break;
58 |
59 | #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
60 | case HTTP_EVENT_REDIRECT:
61 | ESP_LOGD(TAG, "HTTP_EVENT_REDIRECT");
62 | break;
63 | #endif
64 | }
65 |
66 | return ESP_OK;
67 | }
68 |
69 | esp_err_t ota_start(const char *url)
70 | {
71 | esp_http_client_config_t config = {
72 | .url = url,
73 | .cert_pem = (char *)server_cert_pem_start,
74 | .event_handler = _http_event_handler,
75 | };
76 |
77 | #ifdef CONFIG_EXAMPLE_SKIP_COMMON_NAME_CHECK
78 | config.skip_cert_common_name_check = true;
79 | #endif
80 |
81 | #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
82 | esp_https_ota_config_t http_ota_config = {
83 | .http_config = &config,
84 | };
85 | esp_err_t ret = esp_https_ota(&http_ota_config);
86 | #else
87 | esp_err_t ret = esp_https_ota(&config);
88 | #endif
89 | if (ret == ESP_OK) {
90 | esp_restart();
91 | } else {
92 | ESP_LOGE(TAG, "Firmware upgrade failed");
93 | }
94 | return ret;
95 | }
96 |
97 |
--------------------------------------------------------------------------------
/examples/6_ota/main/ota.h:
--------------------------------------------------------------------------------
1 | /*
2 | This example code is in the Public Domain (or CC0 licensed, at your option.)
3 |
4 | Unless required by applicable law or agreed to in writing, this
5 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
6 | CONDITIONS OF ANY KIND, either express or implied.
7 | */
8 |
9 | #ifndef OTA_H
10 | #define OTA_H
11 |
12 | #include "stdint.h"
13 | #include "freertos/FreeRTOS.h"
14 | #include "freertos/task.h"
15 | #include "freertos/queue.h"
16 | #include "esp_err.h"
17 |
18 |
19 |
20 | /**
21 | * @brief start firmware upgrade
22 | *
23 | * @param url HTTP URL, the information on the URL is most important
24 | *
25 | * @return
26 | * - ESP_OK Success ;
27 | * - ESP_ERR_INVALID_ARG pointer fn error
28 | */
29 | esp_err_t ota_start(const char *url);
30 |
31 |
32 | #endif
--------------------------------------------------------------------------------
/examples/6_ota/partitions.csv:
--------------------------------------------------------------------------------
1 | # Name, Type, SubType, Offset, Size, Flags
2 | # Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
3 | nvs, data, nvs, , 0x4000,
4 | otadata, data, ota, , 0x2000,
5 | phy_init, data, phy, , 0x1000,
6 | ota_0, app, ota_0, , 1600K,
7 | ota_1, app, ota_1, , 1600K,
8 |
--------------------------------------------------------------------------------
/examples/6_ota/sdkconfig.defaults:
--------------------------------------------------------------------------------
1 | # Override some defaults so BT stack is enabled
2 |
3 |
4 | #
5 | # SDK tool configuration
6 | #
7 | CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
8 |
9 | #
10 | # Partition config
11 | #
12 | CONFIG_PARTITION_TABLE_CUSTOM=y
13 | CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
14 | CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
15 | CONFIG_PARTITION_TABLE_OFFSET=0x8000
16 |
17 | #
18 | # BT config
19 | #
20 | CONFIG_BT_ENABLED=y
21 | CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y
22 | CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n
23 | CONFIG_BTDM_CTRL_MODE_BTDM=n
24 | CONFIG_BTDM_CTRL_PINNED_TO_CORE_0=y
25 | CONFIG_BTDM_CTRL_PINNED_TO_CORE_1=n
26 | CONFIG_BTDM_CTRL_PINNED_TO_CORE=0
27 | CONFIG_BTDM_CTRL_HCI_MODE_VHCI=y
28 | CONFIG_BTDM_CTRL_HCI_MODE_UART_H4=n
29 | CONFIG_BT_BLUEDROID_ENABLED=y
30 | CONFIG_BT_BLUEDROID_PINNED_TO_CORE_0=y
31 | CONFIG_BT_BLUEDROID_PINNED_TO_CORE_1=n
32 | CONFIG_BT_BLUEDROID_PINNED_TO_CORE=0
33 | CONFIG_BT_BTC_TASK_STACK_SIZE=3072
34 | CONFIG_BT_BLUEDROID_MEM_DEBUG=n
35 | CONFIG_BT_CLASSIC_ENABLED=n
36 | CONFIG_BT_GATTS_ENABLE=y
37 | CONFIG_BT_GATTC_ENABLE=n
38 | CONFIG_BT_BLE_SMP_ENABLE=n
39 | CONFIG_BL_ENABLE_SRVCHG_REG=y
40 | CONFIG_BT_STACK_NO_LOG=n
41 | CONFIG_BT_ACL_CONNECTIONS=4
42 | CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST=n
43 | CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY=n
44 | CONFIG_BT_SMP_ENABLE=n
45 | CONFIG_BT_BLE_BLUFI_ENABLE=y
46 | CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
47 |
48 | #
49 | # Certificates
50 | #
51 | CONFIG_MBEDTLS_ECP_C=y
52 | CONFIG_MBEDTLS_DHM_C=y
53 | CONFIG_MBEDTLS_ECDH_C=y
54 | CONFIG_MBEDTLS_ECDSA_C=y
55 |
--------------------------------------------------------------------------------
/examples/7_recognition/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # The following lines of boilerplate have to be in your project's CMakeLists
2 | # in this exact order for cmake to work correctly
3 | cmake_minimum_required(VERSION 3.5)
4 |
5 | include($ENV{IDF_PATH}/tools/cmake/project.cmake)
6 | add_compile_options(-fdiagnostics-color=always
7 | -Wno-ignored-qualifiers)
8 | project(moonlight)
--------------------------------------------------------------------------------
/examples/7_recognition/main/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | idf_component_register(SRCS "app_main.c" "app_speech_rec.c"
3 | INCLUDE_DIRS "include")
4 |
5 | if(CONFIG_ESP32_S3_MOONLIGHT_BOARD)
6 | spiffs_create_partition_image(storage ../spiffs FLASH_IN_PROJECT)
7 | endif()
--------------------------------------------------------------------------------
/examples/7_recognition/main/app_main.c:
--------------------------------------------------------------------------------
1 | /* Speech Recognition Example
2 |
3 | This example code is in the Public Domain (or CC0 licensed, at your option.)
4 |
5 | Unless required by applicable law or agreed to in writing, this
6 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
7 | CONDITIONS OF ANY KIND, either express or implied.
8 | */
9 |
10 | #include "freertos/FreeRTOS.h"
11 | #include "freertos/task.h"
12 | #include "esp_log.h"
13 | #include "esp_random.h"
14 | #include "app_speech_if.h"
15 | #include "board_moonlight.h"
16 | #if BOARD_SUPPORT_SPEAKER
17 | #include "audio_player.h"
18 | #endif
19 |
20 | static led_rgb_t *g_leds = NULL;
21 | typedef struct {
22 | uint8_t r;
23 | uint8_t g;
24 | uint8_t b;
25 | } led_color_t;
26 |
27 | static led_color_t led_color = {0};
28 | static led_color_t led_color_wake_bk = {0};
29 |
30 | static TaskHandle_t g_breath_light_task_handle = NULL;
31 |
32 | static void sr_wake(void *arg)
33 | {
34 | g_leds->get_rgb(g_leds, &led_color_wake_bk.r, &led_color_wake_bk.g, &led_color_wake_bk.b);
35 | /**< Turn on the breathing light */
36 | xTaskCreate(breath_light_task, "breath_light_task", 1024 * 2, (void*)g_leds, configMAX_PRIORITIES - 1, &g_breath_light_task_handle);
37 | #if BOARD_SUPPORT_SPEAKER
38 | FILE *fp;
39 | fp = fopen("/spiffs/echo_cn_wake.wav", "rb");
40 | if (fp) {
41 | audio_player_play(fp);
42 | }
43 | #endif
44 | }
45 |
46 | static void sr_cmd(void *arg)
47 | {
48 | if (NULL != g_breath_light_task_handle) {
49 | vTaskDelete(g_breath_light_task_handle);
50 | g_leds->set_rgb(g_leds, led_color_wake_bk.r, led_color_wake_bk.g, led_color_wake_bk.b);
51 | g_breath_light_task_handle = NULL;
52 | }
53 |
54 | #if BOARD_SUPPORT_SPEAKER
55 | FILE *fp;
56 | fp = fopen("/spiffs/echo_cn_ok.wav", "rb");
57 | if (fp) {
58 | audio_player_play(fp);
59 | }
60 | #endif
61 |
62 | int32_t cmd_id = (int32_t)arg;
63 |
64 | switch (cmd_id) {
65 | case 0:
66 | case 1:
67 | case 2:
68 | g_leds->set_rgb(g_leds, led_color.r, led_color.g, led_color.b);
69 | break;
70 |
71 | case 3:
72 | case 4:
73 | case 5: {
74 | uint8_t r, g, b;
75 | g_leds->get_rgb(g_leds, &r, &g, &b);
76 |
77 | if (0 == r && 0 == g && 0 == b) {
78 | break;
79 | }
80 |
81 | g_leds->get_rgb(g_leds, &led_color.r, &led_color.g, &led_color.b);
82 | g_leds->set_rgb(g_leds, 0, 0, 0);
83 | }
84 | break;
85 |
86 | case 6: {
87 | uint32_t h, s, v;
88 | g_leds->get_hsv(g_leds, &h, &s, &v);
89 | /**< Set a random color */
90 | h = esp_random() / 11930465;
91 | s = esp_random() / 42949673;
92 | s = s < 40 ? 40 : s;
93 | ESP_ERROR_CHECK(g_leds->set_hsv(g_leds, h, s, v));
94 | }
95 | break;
96 |
97 | case 7:
98 | case 8: {
99 | uint32_t h, s, v;
100 | g_leds->get_hsv(g_leds, &h, &s, &v);
101 |
102 | if (v < 90) {
103 | v += 10;
104 | }
105 |
106 | g_leds->set_hsv(g_leds, h, s, v);
107 | }
108 | break;
109 |
110 | case 9:
111 | case 10: {
112 | uint32_t h, s, v;
113 | g_leds->get_hsv(g_leds, &h, &s, &v);
114 |
115 | if (v > 20) {
116 | v -= 10;
117 | }
118 |
119 | g_leds->set_hsv(g_leds, h, s, v);
120 | }
121 | break;
122 |
123 | default:
124 | break;
125 | }
126 | }
127 |
128 | static void sr_cmd_exit(void *arg)
129 | {
130 | #if BOARD_SUPPORT_SPEAKER
131 | FILE *fp;
132 | fp = fopen("/spiffs/echo_cn_end.wav", "rb");
133 | if (fp) {
134 | audio_player_play(fp);
135 | }
136 | #endif
137 | if (NULL != g_breath_light_task_handle) {
138 | vTaskDelete(g_breath_light_task_handle);
139 | g_leds->set_rgb(g_leds, led_color_wake_bk.r, led_color_wake_bk.g, led_color_wake_bk.b);
140 | g_breath_light_task_handle = NULL;
141 | }
142 | }
143 |
144 | void app_main(void)
145 | {
146 | /**< Initialize NVS */
147 | ESP_ERROR_CHECK(board_nvs_flash_init());
148 | /**< configure led driver */
149 | g_leds = board_rgb_init();
150 |
151 | speech_recognition_init();
152 |
153 | g_leds->set_rgb(g_leds, 120, 120, 120);
154 | g_leds->get_rgb(g_leds, &led_color.r, &led_color.g, &led_color.b);
155 | sr_handler_install(SR_CB_TYPE_WAKE, sr_wake, NULL);
156 | sr_handler_install(SR_CB_TYPE_CMD, sr_cmd, NULL);
157 | sr_handler_install(SR_CB_TYPE_CMD_EXIT, sr_cmd_exit, NULL);
158 | }
159 |
--------------------------------------------------------------------------------
/examples/7_recognition/main/idf_component.yml:
--------------------------------------------------------------------------------
1 | ## IDF Component Manager Manifest File
2 | dependencies:
3 | moonlight_board:
4 | override_path: ../../../components/moonlight_board
5 | chmorgan/esp-audio-player:
6 | version: "^1.0.5"
7 | rules:
8 | - if: idf_version >=5.0 && target == esp32s3
9 | espressif/esp-sr: "^1.6.0"
10 | idf: ">=4.1.0"
11 |
--------------------------------------------------------------------------------
/examples/7_recognition/main/include/app_speech_if.h:
--------------------------------------------------------------------------------
1 | /*
2 | This example code is in the Public Domain (or CC0 licensed, at your option.)
3 |
4 | Unless required by applicable law or agreed to in writing, this
5 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
6 | CONDITIONS OF ANY KIND, either express or implied.
7 | */
8 |
9 | #ifndef SRC_IF_H
10 | #define SRC_IF_H
11 |
12 | #include "freertos/FreeRTOS.h"
13 | #include "freertos/queue.h"
14 |
15 | typedef void (*sr_cb_t)(void*);
16 |
17 | typedef enum {
18 | SR_CB_TYPE_WAKE = 0, /*!< Wake up callback function */
19 | SR_CB_TYPE_CMD = 1, /*!< Command callback function */
20 | SR_CB_TYPE_CMD_EXIT = 2, /*!< Exit command mode, wait for wakeup*/
21 | SR_CB_TYPE_MAX,
22 | } sr_cb_type_t;
23 |
24 | /**
25 | * @brief Initialize speech recognition
26 | *
27 | * @return
28 | * - ESP_OK: Create speech recognition task successfully
29 | */
30 | esp_err_t speech_recognition_init(void);
31 |
32 | /**
33 | * @brief Install an handler to the speech recognition.
34 | *
35 | * @param type: Handler type ,see sr_cb_type_t
36 | * @param handler: Pointer of callback function
37 | * @param args: Parameter of callback function
38 | *
39 | * @return
40 | * - ESP_OK: Install handler successfully
41 | * - ESP_ERR_INVALID_ARG: Callback handler type invaild
42 | */
43 | esp_err_t sr_handler_install(sr_cb_type_t type, sr_cb_t handler, void *args);
44 |
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/examples/7_recognition/partitions_esp32.csv:
--------------------------------------------------------------------------------
1 | # Espressif ESP32 Partition Table
2 | # Name, Type, SubType, Offset, Size
3 | factory, app, factory, 0x10000, 3000K
4 | nvs, data, nvs, , 16K
5 |
--------------------------------------------------------------------------------
/examples/7_recognition/partitions_esp32s3.csv:
--------------------------------------------------------------------------------
1 | # Espressif ESP32 Partition Table
2 | # Name, Type, SubType, Offset, Size
3 | factory, app, factory, 0x010000, 2048k
4 | nvs, data, nvs, , 16K
5 | storage, data, spiffs, , 1600K
6 | model, data, spiffs, , 4096K ,
--------------------------------------------------------------------------------
/examples/7_recognition/sdkconfig.defaults:
--------------------------------------------------------------------------------
1 | #
2 | # Serial flasher config
3 | #
4 | CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
5 | CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
6 | CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
7 |
8 | #
9 | # FreeRTOS
10 | #
11 |
12 | #
13 | # Kernel
14 | #
15 | CONFIG_FREERTOS_HZ=1000
16 |
17 | #
18 | # Partition Table
19 | #
20 | CONFIG_PARTITION_TABLE_CUSTOM=y
21 |
--------------------------------------------------------------------------------
/examples/7_recognition/sdkconfig.defaults.esp32:
--------------------------------------------------------------------------------
1 | #
2 | # ESP32-specific
3 | #
4 | CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y
5 |
6 | #
7 | # Partition Table
8 | #
9 | CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_esp32.csv"
10 |
11 | #
12 | # ESP Speech Recognition
13 | #
14 | CONFIG_USE_WAKENET=y
15 | CONFIG_SR_WN_WN5_HILEXIN=y
16 | CONFIG_USE_MULTINET=y
17 | CONFIG_SR_MN_CN_MULTINET2_SINGLE_RECOGNITION=y
18 | CONFIG_SR_MN_EN_NONE=y
19 |
--------------------------------------------------------------------------------
/examples/7_recognition/sdkconfig.defaults.esp32s3:
--------------------------------------------------------------------------------
1 | #
2 | # ESP System Settings
3 | #
4 | CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
5 | CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ=240
6 |
7 | #
8 | # Serial flasher config
9 | #
10 | CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
11 | CONFIG_ESPTOOLPY_FLASHSIZE="8MB"
12 |
13 | #
14 | # Partition Table
15 | #
16 | CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_esp32s3.csv"
17 |
18 | #
19 | # ESP PSRAM
20 | #
21 | CONFIG_SPIRAM=y
22 |
23 | #
24 | # SPI RAM config
25 | #
26 | CONFIG_SPIRAM_MODE_OCT=y
27 | CONFIG_SPIRAM_TYPE_AUTO=y
28 | CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY=y
29 |
30 | CONFIG_ESP32S3_SPIRAM_SUPPORT=y
31 |
32 | #
33 | # SPI RAM config
34 | #
35 | CONFIG_SPIRAM_MODE_OCT=y
36 | CONFIG_SPIRAM_SPEED_80M=y
37 |
38 | CONFIG_MODEL_IN_SPIFFS=y
39 | CONFIG_USE_WAKENET=y
40 | CONFIG_SR_WN_WN9_HILEXIN=y
41 | CONFIG_USE_MULTINET=y
42 | CONFIG_SR_MN_CN_MULTINET6_AC_QUANT=y
43 | CONFIG_SR_MN_EN_NONE=y
44 |
45 | CONFIG_AUDIO_PLAYER_ENABLE_MP3=n
--------------------------------------------------------------------------------
/examples/7_recognition/spiffs/echo_cn_end.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/examples/7_recognition/spiffs/echo_cn_end.wav
--------------------------------------------------------------------------------
/examples/7_recognition/spiffs/echo_cn_ok.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/examples/7_recognition/spiffs/echo_cn_ok.wav
--------------------------------------------------------------------------------
/examples/7_recognition/spiffs/echo_cn_wake.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/examples/7_recognition/spiffs/echo_cn_wake.wav
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/01_Schematic/SCH_ESP-MOONLIGHT_V2_0_20200421A.DSN:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/01_Schematic/SCH_ESP-MOONLIGHT_V2_0_20200421A.DSN
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/01_Schematic/SCH_ESP-MOONLIGHT_V2_0_20200421A.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/01_Schematic/SCH_ESP-MOONLIGHT_V2_0_20200421A.pdf
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/02_PCB Layout/PCB_ESP-Moonlight_V2.0_20200421.pcb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/02_PCB Layout/PCB_ESP-Moonlight_V2.0_20200421.pcb
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/02_PCB Layout/PCB_ESP-Moonlight_V2.0_20200421.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/02_PCB Layout/PCB_ESP-Moonlight_V2.0_20200421.pdf
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Main Board/01_top.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Main Board/01_top.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Main Board/Bottom_pastemask.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Main Board/Bottom_pastemask.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Main Board/Bottom_silkscreen.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Main Board/Bottom_silkscreen.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Main Board/Bottom_soldermask.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Main Board/Bottom_soldermask.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Main Board/Top_pastemask.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Main Board/Top_pastemask.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Main Board/Top_silkscreen.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Main Board/Top_silkscreen.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Main Board/Top_soldermask.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Main Board/Top_soldermask.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Main Board/bottom.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Main Board/bottom.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Main Board/drilldrawing.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Main Board/drilldrawing.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Main Board/ncdrill.drl:
--------------------------------------------------------------------------------
1 | %
2 | T1C.00984F0S0
3 | X191025Y15008
4 | X191125Y15088
5 | X19085Y151155
6 | X189375Y15118
7 | X19085Y15153
8 | X190725Y151905
9 | X190875Y15228
10 | X189375Y15253
11 | X19085Y152655
12 | X190325Y15338
13 | X189375Y15388
14 | X190925Y153905
15 | X1914Y154955
16 | X19035Y155205
17 | X191525Y155205
18 | X189375Y15558
19 | X1908Y15568
20 | X19135Y15618
21 | X190525Y15638
22 | X191525Y15693
23 | X19165Y157155
24 | X189375Y15728
25 | X190675Y157655
26 | X189975Y15788
27 | X191375Y15853
28 | X189375Y158605
29 | X19055Y15903
30 | X191375Y15933
31 | X19Y159405
32 | X191675Y159855
33 | X189375Y16003
34 | X190575Y16038
35 | X189975Y16083
36 | X191225Y16103
37 | X19065Y16138
38 | X189375Y161705
39 | X19065Y16203
40 | X190525Y162505
41 | X18975Y162905
42 | X190875Y16348
43 | X1915Y163755
44 | X189375Y163905
45 | X1908Y16433
46 | X1915Y164355
47 | X1905Y16493
48 | X1917Y16493
49 | X19295Y164755
50 | X194075Y164755
51 | X194075Y164255
52 | X1924Y16403
53 | X192775Y16403
54 | X19425Y16403
55 | X19265Y163805
56 | X191975Y16248
57 | X192675Y161305
58 | X192275Y16053
59 | X1926Y159855
60 | X1921Y159855
61 | X1929Y159855
62 | X1929Y157855
63 | X192125Y157205
64 | X1939Y156905
65 | X193775Y156405
66 | X193675Y15528
67 | X192975Y155005
68 | X19255Y15388
69 | X191875Y153805
70 | X192725Y15368
71 | X1929Y15348
72 | X192225Y153455
73 | X191875Y153455
74 | X191875Y153105
75 | X192325Y153105
76 | X192325Y152805
77 | X191875Y152805
78 | X1928Y152805
79 | X193625Y152405
80 | X1935Y15208
81 | X1938Y15173
82 | X1938Y15118
83 | X19305Y15118
84 | X1924Y151005
85 | X19265Y150905
86 | X193225Y15083
87 | X1932Y150105
88 | X1953Y15003
89 | X195075Y15068
90 | X19545Y15113
91 | X194625Y15143
92 | X1948Y15173
93 | X19545Y15188
94 | X19465Y152105
95 | X194375Y15213
96 | X19465Y15238
97 | X1948Y15273
98 | X1948Y15358
99 | X196025Y15448
100 | X1947Y15453
101 | X195525Y155305
102 | X196575Y15563
103 | X1962Y15613
104 | X195075Y156205
105 | X1967Y157005
106 | X1961Y15723
107 | X195475Y159205
108 | X195475Y159455
109 | X1947Y159655
110 | X195475Y15968
111 | X195475Y159905
112 | X195425Y16013
113 | X19665Y16013
114 | X1952Y16103
115 | X194675Y16153
116 | X19525Y16198
117 | X19465Y16218
118 | X195275Y16258
119 | X194975Y162805
120 | X19475Y162905
121 | X195875Y162905
122 | X195675Y16308
123 | X19465Y16348
124 | X1953Y16348
125 | X19615Y16348
126 | X194425Y163605
127 | X1945Y164255
128 | X195625Y16428
129 | X19665Y164305
130 | X196775Y16488
131 | X19535Y16488
132 | X198225Y16488
133 | X1979Y16423
134 | X198225Y163955
135 | X199225Y163305
136 | X197125Y162905
137 | X198375Y16288
138 | X1984Y16223
139 | X1985Y161155
140 | X1976Y16053
141 | X1971Y159905
142 | X1971Y15968
143 | X19935Y15963
144 | X1971Y159455
145 | X197025Y15923
146 | X1983Y159155
147 | X19925Y15838
148 | X199025Y15838
149 | X198025Y15723
150 | X197775Y15703
151 | X196975Y157005
152 | X196975Y15643
153 | X1982Y15613
154 | X1989Y15583
155 | X19735Y155505
156 | X198825Y155055
157 | X19805Y15503
158 | X1973Y154155
159 | X1986Y154055
160 | X198375Y154055
161 | X197125Y153305
162 | X1969Y153305
163 | X19815Y15198
164 | X198875Y15178
165 | X19885Y15128
166 | X198275Y15113
167 | X199325Y15003
168 | X1974Y15003
169 | X201375Y150105
170 | X199375Y150905
171 | X2012Y150905
172 | X19955Y15158
173 | X201775Y151605
174 | X200575Y15168
175 | X200525Y152255
176 | X200875Y152255
177 | X200175Y152255
178 | X200525Y152705
179 | X20185Y152705
180 | X200875Y152705
181 | X200175Y152705
182 | X20185Y15318
183 | X200175Y153205
184 | X200875Y153205
185 | X200525Y153205
186 | X2008Y154805
187 | X2001Y15543
188 | X2007Y15568
189 | X201825Y156805
190 | X20015Y156905
191 | X1994Y157905
192 | X1994Y158155
193 | X201575Y158505
194 | X201175Y15938
195 | X201425Y160705
196 | X201225Y160855
197 | X1994Y162055
198 | X20175Y16263
199 | X201775Y16343
200 | X201775Y16368
201 | X199425Y16388
202 | X2007Y164855
203 | X2018Y164855
204 | X1996Y16488
205 | X200975Y16493
206 | X202975Y164855
207 | X202525Y16418
208 | X204325Y16378
209 | X203225Y163705
210 | X204125Y162905
211 | X20345Y16288
212 | X204325Y162105
213 | X20225Y161705
214 | X203525Y161705
215 | X202575Y16143
216 | X20355Y160855
217 | X204325Y16083
218 | X2027Y159555
219 | X204325Y15933
220 | X202275Y159205
221 | X201925Y15838
222 | X20275Y15803
223 | X2025Y158005
224 | X204325Y158005
225 | X203475Y15723
226 | X204325Y15683
227 | X20275Y156805
228 | X20365Y156755
229 | X2025Y15668
230 | X20275Y156555
231 | X20365Y156355
232 | X20275Y156305
233 | X204325Y155505
234 | X204325Y15388
235 | X204325Y152455
236 | X20215Y151605
237 | X204325Y15113
238 | X2027Y150955
239 | X202225Y150555
240 | X2031Y15013
241 | T2C.01F095S3
242 | X203Y15963
243 | X2035Y15963
244 | X20325Y15963
245 | X204Y162005
246 | X2022Y16203
247 | X2024Y16218
248 | X204Y16228
249 | X2022Y16233
250 | X201975Y16413
251 | T3C.01969F095S3
252 | X190283Y16123G85X189968Y16123
253 | T4C.02362F197S55
254 | X190125Y162215
255 | T5C.03543F197S55
256 | X2035Y15203
257 | X2035Y15303
258 | X2035Y15403
259 | X2032Y155787
260 | X2032Y156574
261 | M30
262 |
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Main Board/ncdrill.lst:
--------------------------------------------------------------------------------
1 | Drill Listing
2 | =============
3 | Drill: .00984 Tool: 1 Feed: 0 Speed: 0
4 | X 1910253 Y 1500803
5 | X 1911253 Y 1508803
6 | X 1908503 Y 1511553
7 | X 1893753 Y 1511803
8 | X 1908503 Y 1515303
9 | X 1907253 Y 1519053
10 | X 1908753 Y 1522803
11 | X 1893753 Y 1525303
12 | X 1908503 Y 1526553
13 | X 1903253 Y 1533803
14 | X 1893753 Y 1538803
15 | X 1909253 Y 1539053
16 | X 1914003 Y 1549553
17 | X 1903503 Y 1552053
18 | X 1915253 Y 1552053
19 | X 1893753 Y 1555803
20 | X 1908003 Y 1556803
21 | X 1913503 Y 1561803
22 | X 1905253 Y 1563803
23 | X 1915253 Y 1569303
24 | X 1916503 Y 1571553
25 | X 1893753 Y 1572803
26 | X 1906753 Y 1576553
27 | X 1899753 Y 1578803
28 | X 1913753 Y 1585303
29 | X 1893753 Y 1586053
30 | X 1905503 Y 1590303
31 | X 1913753 Y 1593303
32 | X 1900003 Y 1594053
33 | X 1916753 Y 1598553
34 | X 1893753 Y 1600303
35 | X 1905753 Y 1603803
36 | X 1899753 Y 1608303
37 | X 1912253 Y 1610303
38 | X 1906503 Y 1613803
39 | X 1893753 Y 1617053
40 | X 1906503 Y 1620303
41 | X 1905253 Y 1625053
42 | X 1897503 Y 1629053
43 | X 1908753 Y 1634803
44 | X 1915003 Y 1637553
45 | X 1893753 Y 1639053
46 | X 1908003 Y 1643303
47 | X 1915003 Y 1643553
48 | X 1905003 Y 1649303
49 | X 1917003 Y 1649303
50 | X 1929503 Y 1647553
51 | X 1940753 Y 1647553
52 | X 1940753 Y 1642553
53 | X 1924003 Y 1640303
54 | X 1927753 Y 1640303
55 | X 1942503 Y 1640303
56 | X 1926503 Y 1638053
57 | X 1919753 Y 1624803
58 | X 1926753 Y 1613053
59 | X 1922753 Y 1605303
60 | X 1926003 Y 1598553
61 | X 1921003 Y 1598553
62 | X 1929003 Y 1598553
63 | X 1929003 Y 1578553
64 | X 1921253 Y 1572053
65 | X 1939003 Y 1569053
66 | X 1937753 Y 1564053
67 | X 1936753 Y 1552803
68 | X 1929753 Y 1550053
69 | X 1925503 Y 1538803
70 | X 1918753 Y 1538053
71 | X 1927253 Y 1536803
72 | X 1929003 Y 1534803
73 | X 1922253 Y 1534553
74 | X 1918753 Y 1534553
75 | X 1918753 Y 1531053
76 | X 1923253 Y 1531053
77 | X 1923253 Y 1528053
78 | X 1918753 Y 1528053
79 | X 1928003 Y 1528053
80 | X 1936253 Y 1524053
81 | X 1935003 Y 1520803
82 | X 1938003 Y 1517303
83 | X 1938003 Y 1511803
84 | X 1930503 Y 1511803
85 | X 1924003 Y 1510053
86 | X 1926503 Y 1509053
87 | X 1932253 Y 1508303
88 | X 1932003 Y 1501053
89 | X 1953003 Y 1500303
90 | X 1950753 Y 1506803
91 | X 1954503 Y 1511303
92 | X 1946253 Y 1514303
93 | X 1948003 Y 1517303
94 | X 1954503 Y 1518803
95 | X 1946503 Y 1521053
96 | X 1943753 Y 1521303
97 | X 1946503 Y 1523803
98 | X 1948003 Y 1527303
99 | X 1948003 Y 1535803
100 | X 1960253 Y 1544803
101 | X 1947003 Y 1545303
102 | X 1955253 Y 1553053
103 | X 1965753 Y 1556303
104 | X 1962003 Y 1561303
105 | X 1950753 Y 1562053
106 | X 1967003 Y 1570053
107 | X 1961003 Y 1572303
108 | X 1954753 Y 1592053
109 | X 1954753 Y 1594553
110 | X 1947003 Y 1596553
111 | X 1954753 Y 1596803
112 | X 1954753 Y 1599053
113 | X 1954253 Y 1601303
114 | X 1966503 Y 1601303
115 | X 1952003 Y 1610303
116 | X 1946753 Y 1615303
117 | X 1952503 Y 1619803
118 | X 1946503 Y 1621803
119 | X 1952753 Y 1625803
120 | X 1949753 Y 1628053
121 | X 1947503 Y 1629053
122 | X 1958753 Y 1629053
123 | X 1956753 Y 1630803
124 | X 1946503 Y 1634803
125 | X 1953003 Y 1634803
126 | X 1961503 Y 1634803
127 | X 1944253 Y 1636053
128 | X 1945003 Y 1642553
129 | X 1956253 Y 1642803
130 | X 1966503 Y 1643053
131 | X 1967753 Y 1648803
132 | X 1953503 Y 1648803
133 | X 1982253 Y 1648803
134 | X 1979003 Y 1642303
135 | X 1982253 Y 1639553
136 | X 1992253 Y 1633053
137 | X 1971253 Y 1629053
138 | X 1983753 Y 1628803
139 | X 1984003 Y 1622303
140 | X 1985003 Y 1611553
141 | X 1976003 Y 1605303
142 | X 1971003 Y 1599053
143 | X 1971003 Y 1596803
144 | X 1993503 Y 1596303
145 | X 1971003 Y 1594553
146 | X 1970253 Y 1592303
147 | X 1983003 Y 1591553
148 | X 1992503 Y 1583803
149 | X 1990253 Y 1583803
150 | X 1980253 Y 1572303
151 | X 1977753 Y 1570303
152 | X 1969753 Y 1570053
153 | X 1969753 Y 1564303
154 | X 1982003 Y 1561303
155 | X 1989003 Y 1558303
156 | X 1973503 Y 1555053
157 | X 1988253 Y 1550553
158 | X 1980503 Y 1550303
159 | X 1973003 Y 1541553
160 | X 1986003 Y 1540553
161 | X 1983753 Y 1540553
162 | X 1971253 Y 1533053
163 | X 1969003 Y 1533053
164 | X 1981503 Y 1519803
165 | X 1988753 Y 1517803
166 | X 1988503 Y 1512803
167 | X 1982753 Y 1511303
168 | X 1993253 Y 1500303
169 | X 1974003 Y 1500303
170 | X 2013753 Y 1501053
171 | X 1993753 Y 1509053
172 | X 2012003 Y 1509053
173 | X 1995503 Y 1515803
174 | X 2017753 Y 1516053
175 | X 2005753 Y 1516803
176 | X 2005253 Y 1522553
177 | X 2008753 Y 1522553
178 | X 2001753 Y 1522553
179 | X 2005253 Y 1527053
180 | X 2018503 Y 1527053
181 | X 2008753 Y 1527053
182 | X 2001753 Y 1527053
183 | X 2018503 Y 1531803
184 | X 2001753 Y 1532053
185 | X 2008753 Y 1532053
186 | X 2005253 Y 1532053
187 | X 2008003 Y 1548053
188 | X 2001003 Y 1554303
189 | X 2007003 Y 1556803
190 | X 2018253 Y 1568053
191 | X 2001503 Y 1569053
192 | X 1994003 Y 1579053
193 | X 1994003 Y 1581553
194 | X 2015753 Y 1585053
195 | X 2011753 Y 1593803
196 | X 2014253 Y 1607053
197 | X 2012253 Y 1608553
198 | X 1994003 Y 1620553
199 | X 2017503 Y 1626303
200 | X 2017753 Y 1634303
201 | X 2017753 Y 1636803
202 | X 1994253 Y 1638803
203 | X 2007003 Y 1648553
204 | X 2018003 Y 1648553
205 | X 1996003 Y 1648803
206 | X 2009753 Y 1649303
207 | X 2029753 Y 1648553
208 | X 2025253 Y 1641803
209 | X 2043253 Y 1637803
210 | X 2032253 Y 1637053
211 | X 2041253 Y 1629053
212 | X 2034503 Y 1628803
213 | X 2043253 Y 1621053
214 | X 2022503 Y 1617053
215 | X 2035253 Y 1617053
216 | X 2025753 Y 1614303
217 | X 2035503 Y 1608553
218 | X 2043253 Y 1608303
219 | X 2027003 Y 1595553
220 | X 2043253 Y 1593303
221 | X 2022753 Y 1592053
222 | X 2019253 Y 1583803
223 | X 2027503 Y 1580303
224 | X 2025003 Y 1580053
225 | X 2043253 Y 1580053
226 | X 2034753 Y 1572303
227 | X 2043253 Y 1568303
228 | X 2027503 Y 1568053
229 | X 2036503 Y 1567553
230 | X 2025003 Y 1566803
231 | X 2027503 Y 1565553
232 | X 2036503 Y 1563553
233 | X 2027503 Y 1563053
234 | X 2043253 Y 1555053
235 | X 2043253 Y 1538803
236 | X 2043253 Y 1524553
237 | X 2021503 Y 1516053
238 | X 2043253 Y 1511303
239 | X 2027003 Y 1509553
240 | X 2022253 Y 1505553
241 | X 2031003 Y 1501303
242 |
243 | Drill: .01 Tool: 2 Feed: 95 Speed: 300
244 | X 2030003 Y 1596303
245 | X 2035003 Y 1596303
246 | X 2032503 Y 1596303
247 | X 2040003 Y 1620053
248 | X 2022003 Y 1620303
249 | X 2024003 Y 1621803
250 | X 2040003 Y 1622803
251 | X 2022003 Y 1623303
252 | X 2019753 Y 1641303
253 |
254 | Drill: .01969 Tool: 3 Feed: 95 Speed: 300
255 | X 1902828 Y 1612303 X 1899679 Y 1612303
256 |
257 | Drill: .02362 Tool: 4 Feed: 197 Speed: 550
258 | X 1901253 Y 1622145
259 |
260 | Drill: .03543 Tool: 5 Feed: 197 Speed: 550
261 | X 2035003 Y 1520303
262 | X 2035003 Y 1530303
263 | X 2035003 Y 1540303
264 | X 2032003 Y 1557866
265 | X 2032003 Y 1565740
266 |
267 | End of Listing
268 |
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Main Board/ncdrill.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Main Board/ncdrill.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/01_top.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/01_top.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/Bottom_pastemask.pho:
--------------------------------------------------------------------------------
1 | *
2 | *
3 | G04 PADS 9.5 Build Number: 522968 generated Gerber (RS-274-X) file*
4 | G04 PC Version=2.1*
5 | *
6 | %IN "PCB_ESP-Moonlight_V2.0_"*%
7 | *
8 | %MOIN*%
9 | *
10 | %FSLAX35Y35*%
11 | *
12 | *
13 | *
14 | *
15 | G04 PC Standard Apertures*
16 | *
17 | *
18 | G04 Thermal Relief Aperture macro.*
19 | %AMTER*
20 | 1,1,$1,0,0*
21 | 1,0,$1-$2,0,0*
22 | 21,0,$3,$4,0,0,45*
23 | 21,0,$3,$4,0,0,135*
24 | %
25 | *
26 | *
27 | G04 Annular Aperture macro.*
28 | %AMANN*
29 | 1,1,$1,0,0*
30 | 1,0,$2,0,0*
31 | %
32 | *
33 | *
34 | G04 Odd Aperture macro.*
35 | %AMODD*
36 | 1,1,$1,0,0*
37 | 1,0,$1-0.005,0,0*
38 | %
39 | *
40 | *
41 | G04 PC Custom Aperture Macros*
42 | *
43 | *
44 | *
45 | *
46 | *
47 | *
48 | G04 PC Aperture Table*
49 | *
50 | %ADD010C,0.001*%
51 | %ADD109C,0.005*%
52 | *
53 | *
54 | *
55 | *
56 | G04 PC Circuitry*
57 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - circuitry*
58 | %LPD*%
59 | *
60 | *
61 | G04 PC Custom Flashes*
62 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - flashes*
63 | %LPD*%
64 | *
65 | *
66 | G04 PC Circuitry*
67 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - circuitry*
68 | %LPD*%
69 | *
70 | G54D10*
71 | G54D109*
72 | G01X1957087Y1488189D02*
73 | X1979921D01*
74 | Y1479528*
75 | X1983071*
76 | X1985039Y1477559D02*
77 | G75*
78 | G03X1983071Y1479528I-1968J0D01*
79 | G01X1985039Y1477559D02*
80 | Y1403543D01*
81 | X1983071Y1401575D02*
82 | G03X1985039Y1403543I-0J1968D01*
83 | G01X1983071Y1401575D02*
84 | X1953937D01*
85 | X1951969Y1403543D02*
86 | G03X1953937Y1401575I1968J0D01*
87 | G01X1951969Y1403543D02*
88 | Y1477559D01*
89 | X1953937Y1479528D02*
90 | G03X1951969Y1477559I0J-1969D01*
91 | G01X1953937Y1479528D02*
92 | X1957087D01*
93 | Y1488189*
94 | G74*
95 | X0Y0D02*
96 | M02*
97 |
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/Bottom_pastemask.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/Bottom_pastemask.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/Bottom_silkscreen.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/Bottom_silkscreen.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/Bottom_soldermask.pho:
--------------------------------------------------------------------------------
1 | *
2 | *
3 | G04 PADS 9.5 Build Number: 522968 generated Gerber (RS-274-X) file*
4 | G04 PC Version=2.1*
5 | *
6 | %IN "PCB_ESP-Moonlight_V2.0_"*%
7 | *
8 | %MOIN*%
9 | *
10 | %FSLAX35Y35*%
11 | *
12 | *
13 | *
14 | *
15 | G04 PC Standard Apertures*
16 | *
17 | *
18 | G04 Thermal Relief Aperture macro.*
19 | %AMTER*
20 | 1,1,$1,0,0*
21 | 1,0,$1-$2,0,0*
22 | 21,0,$3,$4,0,0,45*
23 | 21,0,$3,$4,0,0,135*
24 | %
25 | *
26 | *
27 | G04 Annular Aperture macro.*
28 | %AMANN*
29 | 1,1,$1,0,0*
30 | 1,0,$2,0,0*
31 | %
32 | *
33 | *
34 | G04 Odd Aperture macro.*
35 | %AMODD*
36 | 1,1,$1,0,0*
37 | 1,0,$1-0.005,0,0*
38 | %
39 | *
40 | *
41 | G04 PC Custom Aperture Macros*
42 | *
43 | *
44 | *
45 | *
46 | *
47 | *
48 | G04 PC Aperture Table*
49 | *
50 | %ADD010C,0.001*%
51 | %ADD109C,0.005*%
52 | %ADD313C,0.02562*%
53 | %ADD324O,0.06106X0.07287*%
54 | %ADD336R,0.02956X0.12011*%
55 | %ADD337R,0.04924X0.12011*%
56 | *
57 | *
58 | *
59 | *
60 | G04 PC Circuitry*
61 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - circuitry*
62 | %LPD*%
63 | *
64 | *
65 | G04 PC Custom Flashes*
66 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - flashes*
67 | %LPD*%
68 | *
69 | *
70 | G04 PC Circuitry*
71 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - circuitry*
72 | %LPD*%
73 | *
74 | G54D10*
75 | G54D109*
76 | G01X1957087Y1488189D02*
77 | X1979921D01*
78 | Y1479528*
79 | X1983071*
80 | X1985039Y1477559D02*
81 | G75*
82 | G03X1983071Y1479528I-1968J0D01*
83 | G01X1985039Y1477559D02*
84 | Y1403543D01*
85 | X1983071Y1401575D02*
86 | G03X1985039Y1403543I-0J1968D01*
87 | G01X1983071Y1401575D02*
88 | X1953937D01*
89 | X1951969Y1403543D02*
90 | G03X1953937Y1401575I1968J0D01*
91 | G01X1951969Y1403543D02*
92 | Y1477559D01*
93 | X1953937Y1479528D02*
94 | G03X1951969Y1477559I0J-1969D01*
95 | G01X1953937Y1479528D02*
96 | X1957087D01*
97 | Y1488189*
98 | G54D313*
99 | X1960630Y1417757D03*
100 | X1976378D03*
101 | G54D324*
102 | X1954429Y1423819D03*
103 | X1982579D03*
104 | X1954429Y1409252D03*
105 | X1982579D03*
106 | G54D336*
107 | X1970866Y1474409D03*
108 | X1966142D03*
109 | G54D337*
110 | X1960433D03*
111 | X1976575D03*
112 | G74*
113 | X0Y0D02*
114 | M02*
115 |
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/Bottom_soldermask.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/Bottom_soldermask.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/Top_pastemask.pho:
--------------------------------------------------------------------------------
1 | *
2 | *
3 | G04 PADS 9.5 Build Number: 522968 generated Gerber (RS-274-X) file*
4 | G04 PC Version=2.1*
5 | *
6 | %IN "PCB_ESP-Moonlight_V2.0_"*%
7 | *
8 | %MOIN*%
9 | *
10 | %FSLAX35Y35*%
11 | *
12 | *
13 | *
14 | *
15 | G04 PC Standard Apertures*
16 | *
17 | *
18 | G04 Thermal Relief Aperture macro.*
19 | %AMTER*
20 | 1,1,$1,0,0*
21 | 1,0,$1-$2,0,0*
22 | 21,0,$3,$4,0,0,45*
23 | 21,0,$3,$4,0,0,135*
24 | %
25 | *
26 | *
27 | G04 Annular Aperture macro.*
28 | %AMANN*
29 | 1,1,$1,0,0*
30 | 1,0,$2,0,0*
31 | %
32 | *
33 | *
34 | G04 Odd Aperture macro.*
35 | %AMODD*
36 | 1,1,$1,0,0*
37 | 1,0,$1-0.005,0,0*
38 | %
39 | *
40 | *
41 | G04 PC Custom Aperture Macros*
42 | *
43 | *
44 | *
45 | *
46 | *
47 | *
48 | G04 PC Aperture Table*
49 | *
50 | %ADD010C,0.001*%
51 | %ADD109C,0.005*%
52 | %ADD235R,0.01575X0.0189*%
53 | %ADD287O,0.02362X0.07087*%
54 | %ADD288R,0.01378X0.07087*%
55 | *
56 | *
57 | *
58 | *
59 | G04 PC Circuitry*
60 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - circuitry*
61 | %LPD*%
62 | *
63 | *
64 | G04 PC Custom Flashes*
65 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - flashes*
66 | %LPD*%
67 | *
68 | *
69 | G04 PC Circuitry*
70 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - circuitry*
71 | %LPD*%
72 | *
73 | G54D10*
74 | G54D109*
75 | G01X1957087Y1488189D02*
76 | X1979921D01*
77 | Y1479528*
78 | X1983071*
79 | X1985039Y1477559D02*
80 | G75*
81 | G03X1983071Y1479528I-1968J0D01*
82 | G01X1985039Y1477559D02*
83 | Y1403543D01*
84 | X1983071Y1401575D02*
85 | G03X1985039Y1403543I-0J1968D01*
86 | G01X1983071Y1401575D02*
87 | X1953937D01*
88 | X1951969Y1403543D02*
89 | G03X1953937Y1401575I1968J0D01*
90 | G01X1951969Y1403543D02*
91 | Y1477559D01*
92 | X1953937Y1479528D02*
93 | G03X1951969Y1477559I0J-1969D01*
94 | G01X1953937Y1479528D02*
95 | X1957087D01*
96 | Y1488189*
97 | G54D235*
98 | X1969754Y1429455D03*
99 | Y1434652D03*
100 | X1965004Y1429455D03*
101 | Y1434652D03*
102 | X1959754Y1429455D03*
103 | Y1434652D03*
104 | G54D287*
105 | X1962992Y1422244D03*
106 | X1974016D03*
107 | G54D288*
108 | X1965945D03*
109 | X1968504D03*
110 | X1971063D03*
111 | G74*
112 | X0Y0D02*
113 | M02*
114 |
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/Top_pastemask.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/Top_pastemask.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/Top_silkscreen.pho:
--------------------------------------------------------------------------------
1 | *
2 | *
3 | G04 PADS 9.5 Build Number: 522968 generated Gerber (RS-274-X) file*
4 | G04 PC Version=2.1*
5 | *
6 | %IN "PCB_ESP-Moonlight_V2.0_"*%
7 | *
8 | %MOIN*%
9 | *
10 | %FSLAX35Y35*%
11 | *
12 | *
13 | *
14 | *
15 | G04 PC Standard Apertures*
16 | *
17 | *
18 | G04 Thermal Relief Aperture macro.*
19 | %AMTER*
20 | 1,1,$1,0,0*
21 | 1,0,$1-$2,0,0*
22 | 21,0,$3,$4,0,0,45*
23 | 21,0,$3,$4,0,0,135*
24 | %
25 | *
26 | *
27 | G04 Annular Aperture macro.*
28 | %AMANN*
29 | 1,1,$1,0,0*
30 | 1,0,$2,0,0*
31 | %
32 | *
33 | *
34 | G04 Odd Aperture macro.*
35 | %AMODD*
36 | 1,1,$1,0,0*
37 | 1,0,$1-0.005,0,0*
38 | %
39 | *
40 | *
41 | G04 PC Custom Aperture Macros*
42 | *
43 | *
44 | *
45 | *
46 | *
47 | *
48 | G04 PC Aperture Table*
49 | *
50 | %ADD010C,0.001*%
51 | %ADD109C,0.005*%
52 | %ADD231C,0.004*%
53 | *
54 | *
55 | *
56 | *
57 | G04 PC Circuitry*
58 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - circuitry*
59 | %LPD*%
60 | *
61 | *
62 | G04 PC Custom Flashes*
63 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - flashes*
64 | %LPD*%
65 | *
66 | *
67 | G04 PC Circuitry*
68 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - circuitry*
69 | %LPD*%
70 | *
71 | G54D10*
72 | G54D109*
73 | G01X1957087Y1488189D02*
74 | X1979921D01*
75 | Y1479528*
76 | X1983071*
77 | X1985039Y1477559D02*
78 | G75*
79 | G03X1983071Y1479528I-1968J0D01*
80 | G01X1985039Y1477559D02*
81 | Y1403543D01*
82 | X1983071Y1401575D02*
83 | G03X1985039Y1403543I-0J1968D01*
84 | G01X1983071Y1401575D02*
85 | X1953937D01*
86 | X1951969Y1403543D02*
87 | G03X1953937Y1401575I1968J0D01*
88 | G01X1951969Y1403543D02*
89 | Y1477559D01*
90 | X1953937Y1479528D02*
91 | G03X1951969Y1477559I0J-1969D01*
92 | G01X1953937Y1479528D02*
93 | X1957087D01*
94 | Y1488189*
95 | G54D231*
96 | X1968179Y1432841D02*
97 | X1971329D01*
98 | Y1430675D02*
99 | X1968179D01*
100 | Y1433431*
101 | X1971329*
102 | Y1430675*
103 | X1963429Y1432841D02*
104 | X1966579D01*
105 | Y1430675D02*
106 | X1963429D01*
107 | Y1433431*
108 | X1966579*
109 | Y1430675*
110 | X1958179Y1432841D02*
111 | X1961329D01*
112 | Y1430675D02*
113 | X1958179D01*
114 | Y1433431*
115 | X1961329*
116 | Y1430675*
117 | X1952543Y1398690D02*
118 | Y1398297D01*
119 | X1952740Y1407352D02*
120 | Y1410895D01*
121 | X1953528Y1398418D02*
122 | Y1398297D01*
123 | X1953690Y1398418D02*
124 | Y1398297D01*
125 | X1953724Y1420344D02*
126 | Y1401040D01*
127 | X1954709Y1400386D02*
128 | Y1400659D01*
129 | X1954800D02*
130 | Y1400386D01*
131 | X1955102Y1420344D02*
132 | Y1400659D01*
133 | X1955170Y1400386D02*
134 | Y1400659D01*
135 | X1955496D02*
136 | Y1398297D01*
137 | X1981807Y1400386D02*
138 | X1982709Y1399231D01*
139 | X1982268Y1400386D02*
140 | X1983449Y1398418D01*
141 | X1983448Y1400332D02*
142 | X1984433Y1398690D01*
143 | X1982176Y1400386D02*
144 | X1982709Y1399231D01*
145 | X1981480Y1400659D02*
146 | Y1398297D01*
147 | X1981807Y1400386D02*
148 | Y1400659D01*
149 | X1981874D02*
150 | Y1420344D01*
151 | X1982176Y1400386D02*
152 | Y1400659D01*
153 | X1982268Y1400386D02*
154 | Y1400659D01*
155 | X1983252Y1401040D02*
156 | Y1420344D01*
157 | X1983287Y1398418D02*
158 | Y1398297D01*
159 | X1983449Y1398418D02*
160 | Y1398297D01*
161 | X1984236Y1410895D02*
162 | Y1407352D01*
163 | X1984433Y1398690D02*
164 | Y1398297D01*
165 | X1954800Y1400386D02*
166 | X1954267Y1399231D01*
167 | X1953528Y1400332D02*
168 | X1952543Y1398690D01*
169 | X1954709Y1400386D02*
170 | X1953528Y1398418D01*
171 | X1955170Y1400386D02*
172 | X1954267Y1399231D01*
173 | X1981480Y1398297D02*
174 | X1955496D01*
175 | X1952543D02*
176 | X1953690D01*
177 | X1983287D02*
178 | X1984433D01*
179 | X1983449Y1398418D02*
180 | X1983287D01*
181 | X1953690D02*
182 | X1953528D01*
183 | X1955496Y1398690D02*
184 | X1981480D01*
185 | Y1400332D02*
186 | X1955496D01*
187 | X1982268Y1400386D02*
188 | X1981807D01*
189 | X1955170D02*
190 | X1954709D01*
191 | X1955496Y1400659D02*
192 | X1953670D01*
193 | X1981480D02*
194 | X1983306D01*
195 | X1983252Y1401040D02*
196 | X1953724D01*
197 | X1984236Y1407352D02*
198 | X1983252D01*
199 | X1953724D02*
200 | X1952740D01*
201 | Y1410895D02*
202 | X1953724D01*
203 | X1983252D02*
204 | X1984236D01*
205 | X1953724Y1420344D02*
206 | X1983252D01*
207 | Y1401040D02*
208 | G03X1983449Y1400331I1378J0D01*
209 | G01X1953528D02*
210 | G03X1953724Y1401040I-1182J709D01*
211 | G01X1967568Y1470803D02*
212 | X1967477Y1471028D01*
213 | X1967295Y1471253*
214 | X1967113Y1471366*
215 | X1966749*
216 | X1966568Y1471253*
217 | X1966386Y1471028*
218 | X1966295Y1470803*
219 | X1966204Y1470466*
220 | Y1469903*
221 | X1966295Y1469566*
222 | X1966386Y1469341*
223 | X1966568Y1469116*
224 | X1966749Y1469003*
225 | X1967113*
226 | X1967295Y1469116*
227 | X1967477Y1469341*
228 | X1967568Y1469566*
229 | Y1469903*
230 | X1967113D02*
231 | X1967568D01*
232 | X1968386Y1471366D02*
233 | Y1469003D01*
234 | Y1471366D02*
235 | X1969658Y1469003D01*
236 | Y1471366D02*
237 | Y1469003D01*
238 | X1970477Y1471366D02*
239 | Y1469003D01*
240 | Y1471366D02*
241 | X1971113D01*
242 | X1971386Y1471253*
243 | X1971568Y1471028*
244 | X1971658Y1470803*
245 | X1971749Y1470466*
246 | Y1469903*
247 | X1971658Y1469566*
248 | X1971568Y1469341*
249 | X1971386Y1469116*
250 | X1971113Y1469003*
251 | X1970477*
252 | G74*
253 | X0Y0D02*
254 | M02*
255 |
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/Top_silkscreen.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/Top_silkscreen.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/Top_soldermask.pho:
--------------------------------------------------------------------------------
1 | *
2 | *
3 | G04 PADS 9.5 Build Number: 522968 generated Gerber (RS-274-X) file*
4 | G04 PC Version=2.1*
5 | *
6 | %IN "PCB_ESP-Moonlight_V2.0_"*%
7 | *
8 | %MOIN*%
9 | *
10 | %FSLAX35Y35*%
11 | *
12 | *
13 | *
14 | *
15 | G04 PC Standard Apertures*
16 | *
17 | *
18 | G04 Thermal Relief Aperture macro.*
19 | %AMTER*
20 | 1,1,$1,0,0*
21 | 1,0,$1-$2,0,0*
22 | 21,0,$3,$4,0,0,45*
23 | 21,0,$3,$4,0,0,135*
24 | %
25 | *
26 | *
27 | G04 Annular Aperture macro.*
28 | %AMANN*
29 | 1,1,$1,0,0*
30 | 1,0,$2,0,0*
31 | %
32 | *
33 | *
34 | G04 Odd Aperture macro.*
35 | %AMODD*
36 | 1,1,$1,0,0*
37 | 1,0,$1-0.005,0,0*
38 | %
39 | *
40 | *
41 | G04 PC Custom Aperture Macros*
42 | *
43 | *
44 | *
45 | *
46 | *
47 | *
48 | G04 PC Aperture Table*
49 | *
50 | %ADD010C,0.001*%
51 | %ADD109C,0.005*%
52 | %ADD309R,0.01775X0.0209*%
53 | %ADD310O,0.02562X0.07287*%
54 | %ADD311R,0.01578X0.07287*%
55 | %ADD312O,0.04137X0.07287*%
56 | %ADD313C,0.02562*%
57 | %ADD319R,0.19885X0.06106*%
58 | *
59 | *
60 | *
61 | *
62 | G04 PC Circuitry*
63 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - circuitry*
64 | %LPD*%
65 | *
66 | *
67 | G04 PC Custom Flashes*
68 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - flashes*
69 | %LPD*%
70 | *
71 | *
72 | G04 PC Circuitry*
73 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - circuitry*
74 | %LPD*%
75 | *
76 | G54D10*
77 | G54D109*
78 | G01X1957087Y1488189D02*
79 | X1979921D01*
80 | Y1479528*
81 | X1983071*
82 | X1985039Y1477559D02*
83 | G75*
84 | G03X1983071Y1479528I-1968J0D01*
85 | G01X1985039Y1477559D02*
86 | Y1403543D01*
87 | X1983071Y1401575D02*
88 | G03X1985039Y1403543I-0J1968D01*
89 | G01X1983071Y1401575D02*
90 | X1953937D01*
91 | X1951969Y1403543D02*
92 | G03X1953937Y1401575I1968J0D01*
93 | G01X1951969Y1403543D02*
94 | Y1477559D01*
95 | X1953937Y1479528D02*
96 | G03X1951969Y1477559I0J-1969D01*
97 | G01X1953937Y1479528D02*
98 | X1957087D01*
99 | Y1488189*
100 | G54D309*
101 | X1969754Y1429455D03*
102 | Y1434652D03*
103 | X1965004Y1429455D03*
104 | Y1434652D03*
105 | X1959754Y1429455D03*
106 | Y1434652D03*
107 | G54D310*
108 | X1962992Y1422244D03*
109 | X1974016D03*
110 | G54D311*
111 | X1965945D03*
112 | X1968504D03*
113 | X1971063D03*
114 | G54D312*
115 | X1954429Y1423819D03*
116 | X1982579D03*
117 | X1954429Y1409252D03*
118 | X1982579D03*
119 | G54D313*
120 | X1960630Y1417757D03*
121 | X1976378D03*
122 | G54D319*
123 | X1968504Y1476378D03*
124 | G74*
125 | X0Y0D02*
126 | M02*
127 |
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/Top_soldermask.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/Top_soldermask.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/bottom.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/bottom.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/drilldrawing.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/drilldrawing.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/ncdrill.drl:
--------------------------------------------------------------------------------
1 | %
2 | T1C.00984F0S0
3 | X195525Y140355
4 | X19645Y140355
5 | X1974Y140355
6 | X196225Y14108
7 | X197525Y14108
8 | X19545Y14143
9 | X197325Y14168
10 | X19545Y14188
11 | X1958Y14203
12 | X197825Y14233
13 | X197525Y142705
14 | X195425Y142905
15 | X1965Y143705
16 | X196975Y143705
17 | X195975Y143705
18 | X1954Y144005
19 | X196875Y14408
20 | X1971Y144205
21 | X196875Y14433
22 | X1964Y144505
23 | X19725Y144705
24 | X1954Y14503
25 | X1964Y14573
26 | X19725Y14573
27 | X1954Y14603
28 | X19725Y14653
29 | X195925Y146705
30 | X196175Y146705
31 | X1954Y147005
32 | X1954Y147655
33 | X19685Y148405
34 | X196Y148405
35 | X1977Y148405
36 | X198275Y147655
37 | X1981Y146755
38 | X1983Y146105
39 | X1983Y145255
40 | X1983Y144305
41 | X1983Y143305
42 | X1983Y14183
43 | X1983Y141455
44 | X19815Y140355
45 | T2C.01F095S3
46 | X1962Y142855
47 | X1962Y143105
48 | T3C.02362F197S55
49 | X195443Y142224G85X195443Y142539
50 | X198258Y142224G85X198258Y142539
51 | X195443Y140768G85X195443Y141083
52 | X198258Y140768G85X198258Y141083
53 | T4C.02362F197S55
54 | X196063Y141776
55 | X197638Y141776
56 | M30
57 |
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/ncdrill.lst:
--------------------------------------------------------------------------------
1 | Drill Listing
2 | =============
3 | Drill: .00984 Tool: 1 Feed: 0 Speed: 0
4 | X 1955253 Y 1403553
5 | X 1964503 Y 1403553
6 | X 1974003 Y 1403553
7 | X 1962253 Y 1410803
8 | X 1975253 Y 1410803
9 | X 1954503 Y 1414303
10 | X 1973253 Y 1416803
11 | X 1954503 Y 1418803
12 | X 1958003 Y 1420303
13 | X 1978253 Y 1423303
14 | X 1975253 Y 1427053
15 | X 1954253 Y 1429053
16 | X 1965003 Y 1437053
17 | X 1969753 Y 1437053
18 | X 1959753 Y 1437053
19 | X 1954003 Y 1440053
20 | X 1968753 Y 1440803
21 | X 1971003 Y 1442053
22 | X 1968753 Y 1443303
23 | X 1964003 Y 1445053
24 | X 1972503 Y 1447053
25 | X 1954003 Y 1450303
26 | X 1964003 Y 1457303
27 | X 1972503 Y 1457303
28 | X 1954003 Y 1460303
29 | X 1972503 Y 1465303
30 | X 1959253 Y 1467053
31 | X 1961753 Y 1467053
32 | X 1954003 Y 1470053
33 | X 1954003 Y 1476553
34 | X 1968503 Y 1484053
35 | X 1960003 Y 1484053
36 | X 1977003 Y 1484053
37 | X 1982753 Y 1476553
38 | X 1981003 Y 1467553
39 | X 1983003 Y 1461053
40 | X 1983003 Y 1452553
41 | X 1983003 Y 1443053
42 | X 1983003 Y 1433053
43 | X 1983003 Y 1418303
44 | X 1983003 Y 1414553
45 | X 1981503 Y 1403553
46 |
47 | Drill: .01 Tool: 2 Feed: 95 Speed: 300
48 | X 1962003 Y 1428553
49 | X 1962003 Y 1431053
50 |
51 | Drill: .02362 Tool: 3 Feed: 197 Speed: 550
52 | X 1954429 Y 1422244 X 1954429 Y 1425393
53 | X 1982578 Y 1422244 X 1982578 Y 1425393
54 | X 1954429 Y 1407677 X 1954429 Y 1410826
55 | X 1982578 Y 1407677 X 1982578 Y 1410826
56 |
57 | Drill: .02362 Tool: 4 Feed: 197 Speed: 550
58 | X 1960629 Y 1417757
59 | X 1976377 Y 1417757
60 |
61 | End of Listing
62 |
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/ncdrill.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 01/ncdrill.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/01_top.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/01_top.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/Bottom_pastemask.pho:
--------------------------------------------------------------------------------
1 | *
2 | *
3 | G04 PADS 9.5 Build Number: 522968 generated Gerber (RS-274-X) file*
4 | G04 PC Version=2.1*
5 | *
6 | %IN "PCB_ESP-Moonlight_V2.0_"*%
7 | *
8 | %MOIN*%
9 | *
10 | %FSLAX35Y35*%
11 | *
12 | *
13 | *
14 | *
15 | G04 PC Standard Apertures*
16 | *
17 | *
18 | G04 Thermal Relief Aperture macro.*
19 | %AMTER*
20 | 1,1,$1,0,0*
21 | 1,0,$1-$2,0,0*
22 | 21,0,$3,$4,0,0,45*
23 | 21,0,$3,$4,0,0,135*
24 | %
25 | *
26 | *
27 | G04 Annular Aperture macro.*
28 | %AMANN*
29 | 1,1,$1,0,0*
30 | 1,0,$2,0,0*
31 | %
32 | *
33 | *
34 | G04 Odd Aperture macro.*
35 | %AMODD*
36 | 1,1,$1,0,0*
37 | 1,0,$1-0.005,0,0*
38 | %
39 | *
40 | *
41 | G04 PC Custom Aperture Macros*
42 | *
43 | *
44 | *
45 | *
46 | *
47 | *
48 | G04 PC Aperture Table*
49 | *
50 | %ADD010C,0.001*%
51 | %ADD109C,0.005*%
52 | *
53 | *
54 | *
55 | *
56 | G04 PC Circuitry*
57 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - circuitry*
58 | %LPD*%
59 | *
60 | *
61 | G04 PC Custom Flashes*
62 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - flashes*
63 | %LPD*%
64 | *
65 | *
66 | G04 PC Circuitry*
67 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - circuitry*
68 | %LPD*%
69 | *
70 | G54D10*
71 | G54D109*
72 | G01X1997244Y1488189D02*
73 | X2020079D01*
74 | Y1479528*
75 | X2023228*
76 | X2025197Y1477559D02*
77 | G75*
78 | G03X2023228Y1479528I-1969J0D01*
79 | G01X2025197Y1477559D02*
80 | Y1427165D01*
81 | X2023228Y1425197D02*
82 | G03X2025197Y1427165I0J1968D01*
83 | G01X2023228Y1425197D02*
84 | X1994094D01*
85 | X1992126Y1427165D02*
86 | G03X1994094Y1425197I1968J0D01*
87 | G01X1992126Y1427165D02*
88 | Y1477559D01*
89 | X1994094Y1479528D02*
90 | G03X1992126Y1477559I0J-1969D01*
91 | G01X1994094Y1479528D02*
92 | X1997244D01*
93 | Y1488189*
94 | G74*
95 | X0Y0D02*
96 | M02*
97 |
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/Bottom_pastemask.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/Bottom_pastemask.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/Bottom_silkscreen.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/Bottom_silkscreen.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/Bottom_soldermask.pho:
--------------------------------------------------------------------------------
1 | *
2 | *
3 | G04 PADS 9.5 Build Number: 522968 generated Gerber (RS-274-X) file*
4 | G04 PC Version=2.1*
5 | *
6 | %IN "PCB_ESP-Moonlight_V2.0_"*%
7 | *
8 | %MOIN*%
9 | *
10 | %FSLAX35Y35*%
11 | *
12 | *
13 | *
14 | *
15 | G04 PC Standard Apertures*
16 | *
17 | *
18 | G04 Thermal Relief Aperture macro.*
19 | %AMTER*
20 | 1,1,$1,0,0*
21 | 1,0,$1-$2,0,0*
22 | 21,0,$3,$4,0,0,45*
23 | 21,0,$3,$4,0,0,135*
24 | %
25 | *
26 | *
27 | G04 Annular Aperture macro.*
28 | %AMANN*
29 | 1,1,$1,0,0*
30 | 1,0,$2,0,0*
31 | %
32 | *
33 | *
34 | G04 Odd Aperture macro.*
35 | %AMODD*
36 | 1,1,$1,0,0*
37 | 1,0,$1-0.005,0,0*
38 | %
39 | *
40 | *
41 | G04 PC Custom Aperture Macros*
42 | *
43 | *
44 | *
45 | *
46 | *
47 | *
48 | G04 PC Aperture Table*
49 | *
50 | %ADD010C,0.001*%
51 | %ADD109C,0.005*%
52 | %ADD313C,0.02562*%
53 | %ADD324O,0.06106X0.07287*%
54 | %ADD336R,0.02956X0.12011*%
55 | %ADD337R,0.04924X0.12011*%
56 | *
57 | *
58 | *
59 | *
60 | G04 PC Circuitry*
61 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - circuitry*
62 | %LPD*%
63 | *
64 | *
65 | G04 PC Custom Flashes*
66 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - flashes*
67 | %LPD*%
68 | *
69 | *
70 | G04 PC Circuitry*
71 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - circuitry*
72 | %LPD*%
73 | *
74 | G54D10*
75 | G54D109*
76 | G01X1997244Y1488189D02*
77 | X2020079D01*
78 | Y1479528*
79 | X2023228*
80 | X2025197Y1477559D02*
81 | G75*
82 | G03X2023228Y1479528I-1969J0D01*
83 | G01X2025197Y1477559D02*
84 | Y1427165D01*
85 | X2023228Y1425197D02*
86 | G03X2025197Y1427165I0J1968D01*
87 | G01X2023228Y1425197D02*
88 | X1994094D01*
89 | X1992126Y1427165D02*
90 | G03X1994094Y1425197I1968J0D01*
91 | G01X1992126Y1427165D02*
92 | Y1477559D01*
93 | X1994094Y1479528D02*
94 | G03X1992126Y1477559I0J-1969D01*
95 | G01X1994094Y1479528D02*
96 | X1997244D01*
97 | Y1488189*
98 | G54D313*
99 | X2000787Y1441379D03*
100 | X2016535D03*
101 | G54D324*
102 | X1994587Y1447441D03*
103 | X2022736D03*
104 | X1994587Y1432874D03*
105 | X2022736D03*
106 | G54D336*
107 | X2011024Y1474409D03*
108 | X2006299D03*
109 | G54D337*
110 | X2000591D03*
111 | X2016732D03*
112 | G74*
113 | X0Y0D02*
114 | M02*
115 |
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/Bottom_soldermask.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/Bottom_soldermask.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/Top_pastemask.pho:
--------------------------------------------------------------------------------
1 | *
2 | *
3 | G04 PADS 9.5 Build Number: 522968 generated Gerber (RS-274-X) file*
4 | G04 PC Version=2.1*
5 | *
6 | %IN "PCB_ESP-Moonlight_V2.0_"*%
7 | *
8 | %MOIN*%
9 | *
10 | %FSLAX35Y35*%
11 | *
12 | *
13 | *
14 | *
15 | G04 PC Standard Apertures*
16 | *
17 | *
18 | G04 Thermal Relief Aperture macro.*
19 | %AMTER*
20 | 1,1,$1,0,0*
21 | 1,0,$1-$2,0,0*
22 | 21,0,$3,$4,0,0,45*
23 | 21,0,$3,$4,0,0,135*
24 | %
25 | *
26 | *
27 | G04 Annular Aperture macro.*
28 | %AMANN*
29 | 1,1,$1,0,0*
30 | 1,0,$2,0,0*
31 | %
32 | *
33 | *
34 | G04 Odd Aperture macro.*
35 | %AMODD*
36 | 1,1,$1,0,0*
37 | 1,0,$1-0.005,0,0*
38 | %
39 | *
40 | *
41 | G04 PC Custom Aperture Macros*
42 | *
43 | *
44 | *
45 | *
46 | *
47 | *
48 | G04 PC Aperture Table*
49 | *
50 | %ADD010C,0.001*%
51 | %ADD109C,0.005*%
52 | %ADD235R,0.01575X0.0189*%
53 | %ADD287O,0.02362X0.07087*%
54 | %ADD288R,0.01378X0.07087*%
55 | *
56 | *
57 | *
58 | *
59 | G04 PC Circuitry*
60 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - circuitry*
61 | %LPD*%
62 | *
63 | *
64 | G04 PC Custom Flashes*
65 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - flashes*
66 | %LPD*%
67 | *
68 | *
69 | G04 PC Circuitry*
70 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - circuitry*
71 | %LPD*%
72 | *
73 | G54D10*
74 | G54D109*
75 | G01X1997244Y1488189D02*
76 | X2020079D01*
77 | Y1479528*
78 | X2023228*
79 | X2025197Y1477559D02*
80 | G75*
81 | G03X2023228Y1479528I-1969J0D01*
82 | G01X2025197Y1477559D02*
83 | Y1427165D01*
84 | X2023228Y1425197D02*
85 | G03X2025197Y1427165I0J1968D01*
86 | G01X2023228Y1425197D02*
87 | X1994094D01*
88 | X1992126Y1427165D02*
89 | G03X1994094Y1425197I1968J0D01*
90 | G01X1992126Y1427165D02*
91 | Y1477559D01*
92 | X1994094Y1479528D02*
93 | G03X1992126Y1477559I0J-1969D01*
94 | G01X1994094Y1479528D02*
95 | X1997244D01*
96 | Y1488189*
97 | G54D235*
98 | X2000004Y1453077D03*
99 | Y1458274D03*
100 | X2009843Y1453077D03*
101 | Y1458274D03*
102 | X2005118Y1453077D03*
103 | Y1458274D03*
104 | G54D287*
105 | X2003150Y1445866D03*
106 | X2014173D03*
107 | G54D288*
108 | X2006102D03*
109 | X2008661D03*
110 | X2011220D03*
111 | G74*
112 | X0Y0D02*
113 | M02*
114 |
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/Top_pastemask.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/Top_pastemask.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/Top_silkscreen.pho:
--------------------------------------------------------------------------------
1 | *
2 | *
3 | G04 PADS 9.5 Build Number: 522968 generated Gerber (RS-274-X) file*
4 | G04 PC Version=2.1*
5 | *
6 | %IN "PCB_ESP-Moonlight_V2.0_"*%
7 | *
8 | %MOIN*%
9 | *
10 | %FSLAX35Y35*%
11 | *
12 | *
13 | *
14 | *
15 | G04 PC Standard Apertures*
16 | *
17 | *
18 | G04 Thermal Relief Aperture macro.*
19 | %AMTER*
20 | 1,1,$1,0,0*
21 | 1,0,$1-$2,0,0*
22 | 21,0,$3,$4,0,0,45*
23 | 21,0,$3,$4,0,0,135*
24 | %
25 | *
26 | *
27 | G04 Annular Aperture macro.*
28 | %AMANN*
29 | 1,1,$1,0,0*
30 | 1,0,$2,0,0*
31 | %
32 | *
33 | *
34 | G04 Odd Aperture macro.*
35 | %AMODD*
36 | 1,1,$1,0,0*
37 | 1,0,$1-0.005,0,0*
38 | %
39 | *
40 | *
41 | G04 PC Custom Aperture Macros*
42 | *
43 | *
44 | *
45 | *
46 | *
47 | *
48 | G04 PC Aperture Table*
49 | *
50 | %ADD010C,0.001*%
51 | %ADD109C,0.005*%
52 | %ADD231C,0.004*%
53 | *
54 | *
55 | *
56 | *
57 | G04 PC Circuitry*
58 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - circuitry*
59 | %LPD*%
60 | *
61 | *
62 | G04 PC Custom Flashes*
63 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - flashes*
64 | %LPD*%
65 | *
66 | *
67 | G04 PC Circuitry*
68 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - circuitry*
69 | %LPD*%
70 | *
71 | G54D10*
72 | G54D109*
73 | G01X1997244Y1488189D02*
74 | X2020079D01*
75 | Y1479528*
76 | X2023228*
77 | X2025197Y1477559D02*
78 | G75*
79 | G03X2023228Y1479528I-1969J0D01*
80 | G01X2025197Y1477559D02*
81 | Y1427165D01*
82 | X2023228Y1425197D02*
83 | G03X2025197Y1427165I0J1968D01*
84 | G01X2023228Y1425197D02*
85 | X1994094D01*
86 | X1992126Y1427165D02*
87 | G03X1994094Y1425197I1968J0D01*
88 | G01X1992126Y1427165D02*
89 | Y1477559D01*
90 | X1994094Y1479528D02*
91 | G03X1992126Y1477559I0J-1969D01*
92 | G01X1994094Y1479528D02*
93 | X1997244D01*
94 | Y1488189*
95 | G54D231*
96 | X1998429Y1456463D02*
97 | X2001579D01*
98 | Y1454297D02*
99 | X1998429D01*
100 | Y1457053*
101 | X2001579*
102 | Y1454297*
103 | X2008268Y1456463D02*
104 | X2011417D01*
105 | Y1454297D02*
106 | X2008268D01*
107 | Y1457053*
108 | X2011417*
109 | Y1454297*
110 | X2003543Y1456463D02*
111 | X2006693D01*
112 | Y1454297D02*
113 | X2003543D01*
114 | Y1457053*
115 | X2006693*
116 | Y1454297*
117 | X1992701Y1422312D02*
118 | Y1421919D01*
119 | X1992898Y1430974D02*
120 | Y1434517D01*
121 | X1993685Y1422040D02*
122 | Y1421919D01*
123 | X1993847Y1422040D02*
124 | Y1421919D01*
125 | X1993882Y1443966D02*
126 | Y1424663D01*
127 | X1994866Y1424008D02*
128 | Y1424281D01*
129 | X1994957D02*
130 | Y1424008D01*
131 | X1995260Y1443966D02*
132 | Y1424281D01*
133 | X1995327Y1424008D02*
134 | Y1424281D01*
135 | X1995654D02*
136 | Y1421919D01*
137 | X2021964Y1424008D02*
138 | X2022866Y1422853D01*
139 | X2022425Y1424008D02*
140 | X2023606Y1422040D01*
141 | Y1423954D02*
142 | X2024591Y1422312D01*
143 | X2022334Y1424008D02*
144 | X2022866Y1422853D01*
145 | X2021638Y1424281D02*
146 | Y1421919D01*
147 | X2021964Y1424008D02*
148 | Y1424281D01*
149 | X2022031D02*
150 | Y1443966D01*
151 | X2022334Y1424008D02*
152 | Y1424281D01*
153 | X2022425Y1424008D02*
154 | Y1424281D01*
155 | X2023409Y1424663D02*
156 | Y1443966D01*
157 | X2023444Y1422040D02*
158 | Y1421919D01*
159 | X2023606Y1422040D02*
160 | Y1421919D01*
161 | X2024394Y1434517D02*
162 | Y1430974D01*
163 | X2024591Y1422312D02*
164 | Y1421919D01*
165 | X1994957Y1424008D02*
166 | X1994425Y1422853D01*
167 | X1993686Y1423954D02*
168 | X1992701Y1422312D01*
169 | X1994866Y1424008D02*
170 | X1993685Y1422040D01*
171 | X1995327Y1424008D02*
172 | X1994425Y1422853D01*
173 | X2021638Y1421919D02*
174 | X1995654D01*
175 | X1992701D02*
176 | X1993847D01*
177 | X2023444D02*
178 | X2024591D01*
179 | X2023606Y1422040D02*
180 | X2023444D01*
181 | X1993847D02*
182 | X1993685D01*
183 | X1995654Y1422312D02*
184 | X2021638D01*
185 | Y1423954D02*
186 | X1995654D01*
187 | X2022425Y1424008D02*
188 | X2021964D01*
189 | X1995327D02*
190 | X1994866D01*
191 | X1995654Y1424281D02*
192 | X1993828D01*
193 | X2021638D02*
194 | X2023463D01*
195 | X2023409Y1424663D02*
196 | X1993882D01*
197 | X2024394Y1430974D02*
198 | X2023409D01*
199 | X1993882D02*
200 | X1992898D01*
201 | Y1434517D02*
202 | X1993882D01*
203 | X2023409D02*
204 | X2024394D01*
205 | X1993882Y1443966D02*
206 | X2023409D01*
207 | Y1424663D02*
208 | G03X2023606Y1423953I1378J-0D01*
209 | G01X1993685D02*
210 | G03X1993882Y1424663I-1181J710D01*
211 | G01X2008318Y1470803D02*
212 | X2008227Y1471028D01*
213 | X2008045Y1471253*
214 | X2007863Y1471366*
215 | X2007499*
216 | X2007318Y1471253*
217 | X2007136Y1471028*
218 | X2007045Y1470803*
219 | X2006954Y1470466*
220 | Y1469903*
221 | X2007045Y1469566*
222 | X2007136Y1469341*
223 | X2007318Y1469116*
224 | X2007499Y1469003*
225 | X2007863*
226 | X2008045Y1469116*
227 | X2008227Y1469341*
228 | X2008318Y1469566*
229 | Y1469903*
230 | X2007863D02*
231 | X2008318D01*
232 | X2009136Y1471366D02*
233 | Y1469003D01*
234 | Y1471366D02*
235 | X2010408Y1469003D01*
236 | Y1471366D02*
237 | Y1469003D01*
238 | X2011227Y1471366D02*
239 | Y1469003D01*
240 | Y1471366D02*
241 | X2011863D01*
242 | X2012136Y1471253*
243 | X2012318Y1471028*
244 | X2012408Y1470803*
245 | X2012499Y1470466*
246 | Y1469903*
247 | X2012408Y1469566*
248 | X2012318Y1469341*
249 | X2012136Y1469116*
250 | X2011863Y1469003*
251 | X2011227*
252 | G74*
253 | X0Y0D02*
254 | M02*
255 |
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/Top_silkscreen.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/Top_silkscreen.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/Top_soldermask.pho:
--------------------------------------------------------------------------------
1 | *
2 | *
3 | G04 PADS 9.5 Build Number: 522968 generated Gerber (RS-274-X) file*
4 | G04 PC Version=2.1*
5 | *
6 | %IN "PCB_ESP-Moonlight_V2.0_"*%
7 | *
8 | %MOIN*%
9 | *
10 | %FSLAX35Y35*%
11 | *
12 | *
13 | *
14 | *
15 | G04 PC Standard Apertures*
16 | *
17 | *
18 | G04 Thermal Relief Aperture macro.*
19 | %AMTER*
20 | 1,1,$1,0,0*
21 | 1,0,$1-$2,0,0*
22 | 21,0,$3,$4,0,0,45*
23 | 21,0,$3,$4,0,0,135*
24 | %
25 | *
26 | *
27 | G04 Annular Aperture macro.*
28 | %AMANN*
29 | 1,1,$1,0,0*
30 | 1,0,$2,0,0*
31 | %
32 | *
33 | *
34 | G04 Odd Aperture macro.*
35 | %AMODD*
36 | 1,1,$1,0,0*
37 | 1,0,$1-0.005,0,0*
38 | %
39 | *
40 | *
41 | G04 PC Custom Aperture Macros*
42 | *
43 | *
44 | *
45 | *
46 | *
47 | *
48 | G04 PC Aperture Table*
49 | *
50 | %ADD010C,0.001*%
51 | %ADD109C,0.005*%
52 | %ADD309R,0.01775X0.0209*%
53 | %ADD310O,0.02562X0.07287*%
54 | %ADD311R,0.01578X0.07287*%
55 | %ADD312O,0.04137X0.07287*%
56 | %ADD313C,0.02562*%
57 | %ADD319R,0.19885X0.06106*%
58 | *
59 | *
60 | *
61 | *
62 | G04 PC Circuitry*
63 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - circuitry*
64 | %LPD*%
65 | *
66 | *
67 | G04 PC Custom Flashes*
68 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - flashes*
69 | %LPD*%
70 | *
71 | *
72 | G04 PC Circuitry*
73 | G04 Layer Name PCB_ESP-Moonlight_V2.0_ - circuitry*
74 | %LPD*%
75 | *
76 | G54D10*
77 | G54D109*
78 | G01X1997244Y1488189D02*
79 | X2020079D01*
80 | Y1479528*
81 | X2023228*
82 | X2025197Y1477559D02*
83 | G75*
84 | G03X2023228Y1479528I-1969J0D01*
85 | G01X2025197Y1477559D02*
86 | Y1427165D01*
87 | X2023228Y1425197D02*
88 | G03X2025197Y1427165I0J1968D01*
89 | G01X2023228Y1425197D02*
90 | X1994094D01*
91 | X1992126Y1427165D02*
92 | G03X1994094Y1425197I1968J0D01*
93 | G01X1992126Y1427165D02*
94 | Y1477559D01*
95 | X1994094Y1479528D02*
96 | G03X1992126Y1477559I0J-1969D01*
97 | G01X1994094Y1479528D02*
98 | X1997244D01*
99 | Y1488189*
100 | G54D309*
101 | X2000004Y1453077D03*
102 | Y1458274D03*
103 | X2009843Y1453077D03*
104 | Y1458274D03*
105 | X2005118Y1453077D03*
106 | Y1458274D03*
107 | G54D310*
108 | X2003150Y1445866D03*
109 | X2014173D03*
110 | G54D311*
111 | X2006102D03*
112 | X2008661D03*
113 | X2011220D03*
114 | G54D312*
115 | X1994587Y1447441D03*
116 | X2022736D03*
117 | X1994587Y1432874D03*
118 | X2022736D03*
119 | G54D313*
120 | X2000787Y1441379D03*
121 | X2016535D03*
122 | G54D319*
123 | X2008661Y1476378D03*
124 | G74*
125 | X0Y0D02*
126 | M02*
127 |
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/Top_soldermask.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/Top_soldermask.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/bottom.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/bottom.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/drilldrawing.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/drilldrawing.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/ncdrill.drl:
--------------------------------------------------------------------------------
1 | %
2 | T1C.00984F0S0
3 | X2003Y14273
4 | X199475Y14273
5 | X201325Y14273
6 | X20155Y14348
7 | X200375Y143505
8 | X19945Y14378
9 | X20135Y14408
10 | X19945Y14423
11 | X199825Y144405
12 | X20155Y145055
13 | X1994Y145255
14 | X2012Y14583
15 | X20005Y146055
16 | X1994Y146055
17 | X200475Y146055
18 | X2009Y146155
19 | X201125Y146255
20 | X2009Y14643
21 | X2013Y14663
22 | X20085Y14668
23 | X200175Y146705
24 | X199925Y146705
25 | X1994Y146905
26 | X1994Y14773
27 | X20005Y14848
28 | X20085Y14848
29 | X20165Y14848
30 | X20235Y14773
31 | X20235Y146555
32 | X20205Y14598
33 | X202325Y14528
34 | X202275Y14423
35 | X202275Y143805
36 | X20225Y14273
37 | T2C.01F095S3
38 | X200225Y145155
39 | X200225Y14543
40 | T3C.02362F197S55
41 | X199459Y144587G85X199459Y144902
42 | X202274Y144587G85X202274Y144902
43 | X199459Y14313G85X199459Y143445
44 | X202274Y14313G85X202274Y143445
45 | T4C.02362F197S55
46 | X200079Y144138
47 | X201654Y144138
48 | M30
49 |
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/ncdrill.lst:
--------------------------------------------------------------------------------
1 | Drill Listing
2 | =============
3 | Drill: .00984 Tool: 1 Feed: 0 Speed: 0
4 | X 2003003 Y 1427303
5 | X 1994753 Y 1427303
6 | X 2013253 Y 1427303
7 | X 2015503 Y 1434803
8 | X 2003753 Y 1435053
9 | X 1994503 Y 1437803
10 | X 2013503 Y 1440803
11 | X 1994503 Y 1442303
12 | X 1998253 Y 1444053
13 | X 2015503 Y 1450553
14 | X 1994003 Y 1452553
15 | X 2012003 Y 1458303
16 | X 2000503 Y 1460553
17 | X 1994003 Y 1460553
18 | X 2004753 Y 1460553
19 | X 2009003 Y 1461553
20 | X 2011253 Y 1462553
21 | X 2009003 Y 1464303
22 | X 2013003 Y 1466303
23 | X 2008503 Y 1466803
24 | X 2001753 Y 1467053
25 | X 1999253 Y 1467053
26 | X 1994003 Y 1469053
27 | X 1994003 Y 1477303
28 | X 2000503 Y 1484803
29 | X 2008503 Y 1484803
30 | X 2016503 Y 1484803
31 | X 2023503 Y 1477303
32 | X 2023503 Y 1465553
33 | X 2020503 Y 1459803
34 | X 2023253 Y 1452803
35 | X 2022753 Y 1442303
36 | X 2022753 Y 1438053
37 | X 2022503 Y 1427303
38 |
39 | Drill: .01 Tool: 2 Feed: 95 Speed: 300
40 | X 2002253 Y 1451553
41 | X 2002253 Y 1454303
42 |
43 | Drill: .02362 Tool: 3 Feed: 197 Speed: 550
44 | X 1994586 Y 1445866 X 1994586 Y 1449015
45 | X 2022736 Y 1445866 X 2022736 Y 1449015
46 | X 1994586 Y 1431299 X 1994586 Y 1434448
47 | X 2022736 Y 1431299 X 2022736 Y 1434448
48 |
49 | Drill: .02362 Tool: 4 Feed: 197 Speed: 550
50 | X 2000787 Y 1441379
51 | X 2016535 Y 1441379
52 |
53 | End of Listing
54 |
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/ncdrill.rep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_V2.0_N_XX_20200421_V0.3/03_Gerber/Sub Board 02/ncdrill.rep
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_datasheet/051-Buck-Silergy-SY8089-(High_Efficiency_2A_continuous_3A_peak_1MHz_Synchronous_Step_Down_Regulator)-(SOT23-5).pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_datasheet/051-Buck-Silergy-SY8089-(High_Efficiency_2A_continuous_3A_peak_1MHz_Synchronous_Step_Down_Regulator)-(SOT23-5).pdf
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_datasheet/DMIC MSM261S4030H0R.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_datasheet/DMIC MSM261S4030H0R.pdf
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_datasheet/PowerCharge-Chipown-AP5056-(output4.2V_1Amax).pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_datasheet/PowerCharge-Chipown-AP5056-(output4.2V_1Amax).pdf
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_datasheet/SMD5050 灯珠RGB 共阳 .PDF:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_datasheet/SMD5050 灯珠RGB 共阳 .PDF
--------------------------------------------------------------------------------
/hardware/ESP-Moonlight_datasheet/震动传感器 SW-58010TP颖鑫.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/hardware/ESP-Moonlight_datasheet/震动传感器 SW-58010TP颖鑫.pdf
--------------------------------------------------------------------------------
/model_3d/ESP-Moonlight-bottom_V2.0.stl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/model_3d/ESP-Moonlight-bottom_V2.0.stl
--------------------------------------------------------------------------------
/model_3d/esp-moonlight-bottom-V2.1.stl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/espressif/esp-moonlight/4359aa91b0053ab56cfa7ff80237491985b15b09/model_3d/esp-moonlight-bottom-V2.1.stl
--------------------------------------------------------------------------------
/tools/build_apps.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | """
6 | This file is used in CI generate binary files for different kinds of apps
7 | """
8 |
9 | import argparse
10 | import sys
11 | import os
12 | import re
13 | from pathlib import Path
14 | from typing import List
15 |
16 | from idf_build_apps import LOGGER, App, build_apps, find_apps, setup_logging
17 |
18 | PROJECT_ROOT = Path(__file__).parent.parent.absolute()
19 | APPS_BUILD_PER_JOB = 30
20 | IGNORE_WARNINGS = [
21 | r'1/2 app partitions are too small',
22 | r'This clock source will be affected by the DFS of the power management',
23 | r'The current IDF version does not support using the gptimer API',
24 | r'DeprecationWarning: pkg_resources is deprecated as an API',
25 | r'\'ADC_ATTEN_DB_11\' is deprecated',
26 | ]
27 |
28 | def _get_idf_version():
29 | if os.environ.get('IDF_VERSION'):
30 | return os.environ.get('IDF_VERSION')
31 | version_path = os.path.join(os.environ['IDF_PATH'], 'tools/cmake/version.cmake')
32 | regex = re.compile(r'^\s*set\s*\(\s*IDF_VERSION_([A-Z]{5})\s+(\d+)')
33 | ver = {}
34 | with open(version_path) as f:
35 | for line in f:
36 | m = regex.match(line)
37 | if m:
38 | ver[m.group(1)] = m.group(2)
39 | return '{}.{}'.format(int(ver['MAJOR']), int(ver['MINOR']))
40 |
41 | def get_cmake_apps(
42 | paths,
43 | target,
44 | config_rules_str,
45 | default_build_targets,
46 | ): # type: (List[str], str, List[str]) -> List[App]
47 | idf_ver = _get_idf_version()
48 | apps = find_apps(
49 | paths,
50 | recursive=True,
51 | target=target,
52 | build_dir=f'{idf_ver}/build_@t_@w',
53 | config_rules_str=config_rules_str,
54 | build_log_path='build_log.txt',
55 | size_json_path='size.json',
56 | check_warnings=True,
57 | preserve=True,
58 | default_build_targets=default_build_targets,
59 | manifest_files=[
60 | ],
61 | )
62 | return apps
63 |
64 |
65 | def main(args): # type: (argparse.Namespace) -> None
66 | default_build_targets = args.default_build_targets.split(',') if args.default_build_targets else None
67 | apps = get_cmake_apps(args.paths, args.target, args.config, default_build_targets)
68 | if args.exclude_apps:
69 | apps_to_build = [app for app in apps if app.name not in args.exclude_apps]
70 | else:
71 | apps_to_build = apps[:]
72 |
73 | LOGGER.info('Found %d apps after filtering', len(apps_to_build))
74 | LOGGER.info(
75 | 'Suggest setting the parallel count to %d for this build job',
76 | len(apps_to_build) // APPS_BUILD_PER_JOB + 1,
77 | )
78 |
79 | ret_code = build_apps(
80 | apps_to_build,
81 | parallel_count=args.parallel_count,
82 | parallel_index=args.parallel_index,
83 | dry_run=False,
84 | collect_size_info=args.collect_size_info,
85 | keep_going=True,
86 | ignore_warning_strs=IGNORE_WARNINGS,
87 | copy_sdkconfig=True,
88 | )
89 |
90 | sys.exit(ret_code)
91 |
92 |
93 | if __name__ == '__main__':
94 | parser = argparse.ArgumentParser(
95 | description='Build all the apps for different test types. Will auto remove those non-test apps binaries',
96 | formatter_class=argparse.ArgumentDefaultsHelpFormatter,
97 | )
98 | parser.add_argument('paths', nargs='*', help='Paths to the apps to build.')
99 | parser.add_argument(
100 | '-t', '--target',
101 | default='all',
102 | help='Build apps for given target. could pass "all" to get apps for all targets',
103 | )
104 | parser.add_argument(
105 | '--config',
106 | default=['sdkconfig.ci=default', 'sdkconfig.ci.*=', '=default'],
107 | action='append',
108 | help='Adds configurations (sdkconfig file names) to build. This can either be '
109 | 'FILENAME[=NAME] or FILEPATTERN. FILENAME is the name of the sdkconfig file, '
110 | 'relative to the project directory, to be used. Optional NAME can be specified, '
111 | 'which can be used as a name of this configuration. FILEPATTERN is the name of '
112 | 'the sdkconfig file, relative to the project directory, with at most one wildcard. '
113 | 'The part captured by the wildcard is used as the name of the configuration.',
114 | )
115 | parser.add_argument(
116 | '--parallel-count', default=1, type=int, help='Number of parallel build jobs.'
117 | )
118 | parser.add_argument(
119 | '--parallel-index',
120 | default=1,
121 | type=int,
122 | help='Index (1-based) of the job, out of the number specified by --parallel-count.',
123 | )
124 | parser.add_argument(
125 | '--collect-size-info',
126 | type=argparse.FileType('w'),
127 | help='If specified, the test case name and size info json will be written to this file',
128 | )
129 | parser.add_argument(
130 | '--exclude-apps',
131 | nargs='*',
132 | help='Exclude build apps',
133 | )
134 | parser.add_argument(
135 | '--default-build-targets',
136 | default=None,
137 | help='default build targets used in manifest files',
138 | )
139 | parser.add_argument(
140 | '-v', '--verbose',
141 | action='count', default=0,
142 | help='Show verbose log message',
143 | )
144 |
145 | arguments = parser.parse_args()
146 | if not arguments.paths:
147 | arguments.paths = [PROJECT_ROOT]
148 | setup_logging(verbose=arguments.verbose) # Info
149 | main(arguments)
150 |
--------------------------------------------------------------------------------