Skip to content

Commit e7f252d

Browse files
Lcy-131eggfly
authored andcommitted
update files
update readme file add esp-idf in example
1 parent f4d8986 commit e7f252d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+7788
-155
lines changed

README.md

+80-80
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,80 @@
1-
# AlphaPi
2-
3-
注意!!AlphaPi 电路板的硬件版本和固件随时都在更新,这个项目的固件是比较老的版本,请一定要先提取自己板子上的固件版本,先做好备份!
4-
5-
官网:
6-
7-
http://lingxi.hetao101.com/alphapi
8-
9-
10-
固件使用如下命令提取 4M flash:
11-
12-
```shell
13-
~/Library/Arduino15/packages/esp32/tools/esptool_py/4.2.1/esptool -p /dev/cu.usbmodem101 read_flash 0 0x400000 flash_contents.bin
14-
```
15-
16-
Disassemble .mpy files using:
17-
```shell
18-
$ micropython/tools/mpy-tool.py -d ./rootfs/control_board_v1.mpy > ./rootfs/control_board_v1.mpy.txt
19-
```
20-
21-
22-
```shell
23-
>>> import esp32
24-
>>> esp32.Partition.find()
25-
[<Partition type=0, subtype=0, address=65536, size=2031616, label=factory, encrypted=0>]
26-
```
27-
28-
29-
```shell
30-
# flash_read:
31-
esp.flash_read(byte_offset, length_or_buffer)¶
32-
```
33-
34-
# APIs and Docs
35-
## control_board_v1.mpy
36-
37-
### Functions
38-
39-
* control_board_v1.led_show_bytes(bytearray)
40-
41-
用 I2C 扩展芯片点亮 5x5 红色LED,参数是5个数字的bytearray。这个是同步接口。
42-
bytearray([8, 0, 0, 0, 0]) 点亮第5行第1列的灯,bytearray([16, 0, 0, 0, 0]) 点亮第4行第1列的灯,同理,bytearray([128, 0, 0, 0, 0]) 点亮第1行第1列的灯,bytearray([255, 255, 255, 255, 255]) 点亮5x5所有的灯。
43-
44-
```python
45-
import control_board_v1
46-
# 点亮最下面一行所有的灯
47-
control_board_v1.led_show_bytes(bytearray([8, 8, 8, 8, 8]))
48-
```
49-
50-
* control_board_v1.led_show_bytes_async(bytearray)
51-
同上,这个是异步接口。
52-
```python
53-
import control_board_v1
54-
control_board_v1.led_show_bytes_async(bytearray([9, 8, 0, 0, 0]))
55-
```
56-
57-
58-
### Classes
59-
* control_board_v1.PlayRecordMission
60-
61-
### Examples
62-
* 01 5X5 LED(OFFICAL METHODS)
63-
* 02 ACEL
64-
* 03 BUTTON
65-
* 04 5X5 LED(WITH SOURCE CODE)
66-
67-
68-
# GPIO对应
69-
已知:
70-
button a ————— GPIO 10
71-
button b ————— GPIO 20
72-
button c ————— GPIO 21
73-
I2C(SC7A20国产三轴) ————— SDA 6 SCL 7
74-
UART ————— TX 8 RX 9 baudrate=460800
75-
板子上还有个国产MCU,主要通过UART通信实现音频录制播放、5x5 led的功能
76-
未知:
77-
P1 ————— GPIO5
78-
P2 ————— GPIO4
79-
到此alphapi的硬件基本挖掘完毕,通过螺丝柱供电这种方式确实第一次见。
80-
TODO
1+
# AlphaPi
2+
3+
注意!!AlphaPi 电路板的硬件版本和固件随时都在更新,这个项目的固件是比较老的版本,请一定要先提取自己板子上的固件版本,先做好备份!
4+
5+
官网:
6+
7+
http://lingxi.hetao101.com/alphapi
8+
9+
10+
固件使用如下命令提取 4M flash
11+
12+
```shell
13+
~/Library/Arduino15/packages/esp32/tools/esptool_py/4.2.1/esptool -p /dev/cu.usbmodem101 read_flash 0 0x400000 flash_contents.bin
14+
```
15+
16+
使用以下命令解析 .mpy 文件:
17+
```shell
18+
$ micropython/tools/mpy-tool.py -d ./rootfs/control_board_v1.mpy > ./rootfs/control_board_v1.mpy.txt
19+
```
20+
21+
22+
```shell
23+
>>> import esp32
24+
>>> esp32.Partition.find()
25+
[<Partition type=0, subtype=0, address=65536, size=2031616, label=factory, encrypted=0>]
26+
```
27+
28+
29+
```shell
30+
# flash_read:
31+
esp.flash_read(byte_offset, length_or_buffer)¶
32+
```
33+
34+
# 所有 API 和文档
35+
## control_board_v1.mpy
36+
37+
### 方法
38+
39+
* control_board_v1.led_show_bytes(bytearray)
40+
41+
用 I2C 扩展芯片点亮 5x5 红色LED,参数是5个数字的bytearray。这个是同步接口。
42+
bytearray([8, 0, 0, 0, 0]) 点亮第5行第1列的灯,bytearray([16, 0, 0, 0, 0]) 点亮第4行第1列的灯,同理,bytearray([128, 0, 0, 0, 0]) 点亮第1行第1列的灯,bytearray([255, 255, 255, 255, 255]) 点亮5x5所有的灯。
43+
44+
```python
45+
import control_board_v1
46+
# 点亮最下面一行所有的灯
47+
control_board_v1.led_show_bytes(bytearray([8, 8, 8, 8, 8]))
48+
```
49+
50+
* control_board_v1.led_show_bytes_async(bytearray)
51+
同上,这个是异步接口。
52+
```python
53+
import control_board_v1
54+
control_board_v1.led_show_bytes_async(bytearray([9, 8, 0, 0, 0]))
55+
```
56+
57+
58+
###
59+
* control_board_v1.PlayRecordMission
60+
61+
### 示例
62+
* 01 5X5 LED(OFFICAL METHODS)
63+
* 02 ACEL
64+
* 03 BUTTON
65+
* 04 5X5 LED(WITH SOURCE CODE)
66+
67+
68+
# GPIO对应
69+
已知:
70+
button a ————— GPIO 10
71+
button b ————— GPIO 20
72+
button c ————— GPIO 21
73+
I2C(SC7A20国产三轴) ————— SDA 6 SCL 7
74+
UART ————— TX 8 RX 9 baudrate 460800
75+
板子上还有个国产MCU,主要通过UART通信实现音频录制播放、5x5 led的功能
76+
未知:
77+
P1 ————— GPIO5
78+
P2 ————— GPIO4
79+
到此alphapi的硬件基本挖掘完毕,通过螺丝柱供电这种方式确实第一次见。
80+
TODO

README_EN.md

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# AlphaPi
2+
3+
Attention: The hardware version and firmware of the AlphaPi circuit board are constantly being updated. The firmware for this project is a relatively old version, so please be sure to extract the firmware version on your own board and make a backup first!
4+
5+
Official Website:
6+
7+
http://lingxi.hetao101.com/alphapi
8+
9+
10+
The firmware extracts 4M flash using the following command:
11+
12+
```shell
13+
~/Library/Arduino15/packages/esp32/tools/esptool_py/4.2.1/esptool -p /dev/cu.usbmodem101 read_flash 0 0x400000 flash_contents.bin
14+
```
15+
16+
Disassemble .mpy files using:
17+
```shell
18+
$ micropython/tools/mpy-tool.py -d ./rootfs/control_board_v1.mpy > ./rootfs/control_board_v1.mpy.txt
19+
```
20+
21+
22+
```shell
23+
>>> import esp32
24+
>>> esp32.Partition.find()
25+
[<Partition type=0, subtype=0, address=65536, size=2031616, label=factory, encrypted=0>]
26+
```
27+
28+
29+
```shell
30+
# flash_read:
31+
esp.flash_read(byte_offset, length_or_buffer)¶
32+
```
33+
34+
# APIs and Docs
35+
## control_board_v1.mpy
36+
37+
### Functions
38+
39+
* control_board_v1.led_show_bytes(bytearray)
40+
41+
Use an I2C extension chip to light up a 5x5 red LED with a parameter of a 5-digit bytearray. This is a synchronization interface.
42+
bytearray([8, 0, 0, 0, 0]) Turn on the light in row 5, column 1, bytearray([16, 0, 0, 0, 0]) Turn on the light in row 4, column 1, Similarly, bytearray([128, 0, 0, 0, 0]) Turn on the light in row 1, column 1, bytearray([255, 255, 255, 255, 255]) Turn on all lights of 5x5.
43+
44+
```python
45+
import control_board_v1
46+
# Turn on all the lights in the bottom row
47+
control_board_v1.led_show_bytes(bytearray([8, 8, 8, 8, 8]))
48+
```
49+
50+
* control_board_v1.led_show_bytes_async(bytearray)
51+
As above, this is an asynchronous interface.
52+
```python
53+
import control_board_v1
54+
control_board_v1.led_show_bytes_async(bytearray([9, 8, 0, 0, 0]))
55+
```
56+
57+
58+
### Classes
59+
* control_board_v1.PlayRecordMission
60+
61+
### Examples
62+
* 01 5X5 LED(OFFICAL METHODS)
63+
* 02 ACEL
64+
* 03 BUTTON
65+
* 04 5X5 LED(WITH SOURCE CODE)
66+
67+
68+
# GPIO correspondence
69+
Known:
70+
button a ————— GPIO 10
71+
button b ————— GPIO 20
72+
button c ————— GPIO 21
73+
I2C (SC7A20 domestic three-axis) -- SDA 6 SCL 7
74+
UART ————— TX 8 RX 9 baudrate 460800
75+
There is also a domestically produced MCU on the board, which mainly achieves audio recording and playback, 5x5 LED functions through UART communication.
76+
Unknown:
77+
P1 ————— GPIO5
78+
P2 ————— GPIO4
79+
At this point, the hardware of alphapi has been basically excavated, and it is indeed the first time to see this method of power supply through screw posts.
80+
TODO
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
FROM espressif/idf
2+
3+
ARG DEBIAN_FRONTEND=nointeractive
4+
ARG CONTAINER_USER=esp
5+
ARG USER_UID=1050
6+
ARG USER_GID=$USER_UID
7+
8+
RUN apt-get update \
9+
&& apt install -y -q \
10+
cmake \
11+
git \
12+
libglib2.0-0 \
13+
libnuma1 \
14+
libpixman-1-0 \
15+
&& rm -rf /var/lib/apt/lists/*
16+
17+
# QEMU
18+
ENV QEMU_REL=esp_develop_8.2.0_20240122
19+
ENV QEMU_SHA256=e7c72ef5705ad1444d391711088c8717fc89f42e9bf6d1487f9c2a326b8cfa83
20+
ENV QEMU_DIST=qemu-xtensa-softmmu-${QEMU_REL}-x86_64-linux-gnu.tar.xz
21+
ENV QEMU_URL=https://github.com/espressif/qemu/releases/download/esp-develop-8.2.0-20240122/${QEMU_DIST}
22+
23+
ENV LC_ALL=C.UTF-8
24+
ENV LANG=C.UTF-8
25+
26+
RUN wget --no-verbose ${QEMU_URL} \
27+
&& echo "${QEMU_SHA256} *${QEMU_DIST}" | sha256sum --check --strict - \
28+
&& tar -xf $QEMU_DIST -C /opt \
29+
&& rm ${QEMU_DIST}
30+
31+
ENV PATH=/opt/qemu/bin:${PATH}
32+
33+
RUN groupadd --gid $USER_GID $CONTAINER_USER \
34+
&& adduser --uid $USER_UID --gid $USER_GID --disabled-password --gecos "" ${CONTAINER_USER} \
35+
&& usermod -a -G root $CONTAINER_USER && usermod -a -G dialout $CONTAINER_USER
36+
37+
RUN chmod -R 775 /opt/esp/python_env/
38+
39+
USER ${CONTAINER_USER}
40+
ENV USER=${CONTAINER_USER}
41+
WORKDIR /home/${CONTAINER_USER}
42+
43+
RUN echo "source /opt/esp/idf/export.sh > /dev/null 2>&1" >> ~/.bashrc
44+
45+
ENTRYPOINT [ "/opt/esp/entrypoint.sh" ]
46+
47+
CMD ["/bin/bash", "-c"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "ESP-IDF QEMU",
3+
"build": {
4+
"dockerfile": "Dockerfile"
5+
},
6+
"customizations": {
7+
"vscode": {
8+
"settings": {
9+
"terminal.integrated.defaultProfile.linux": "bash",
10+
"idf.espIdfPath": "/opt/esp/idf",
11+
"idf.customExtraPaths": "",
12+
"idf.pythonBinPath": "/opt/esp/python_env/idf5.4_py3.12_env/bin/python",
13+
"idf.toolsPath": "/opt/esp",
14+
"idf.gitPath": "/usr/bin/git"
15+
},
16+
"extensions": [
17+
"espressif.esp-idf-extension"
18+
]
19+
},
20+
"codespaces": {
21+
"settings": {
22+
"terminal.integrated.defaultProfile.linux": "bash",
23+
"idf.espIdfPath": "/opt/esp/idf",
24+
"idf.customExtraPaths": "",
25+
"idf.pythonBinPath": "/opt/esp/python_env/idf5.4_py3.12_env/bin/python",
26+
"idf.toolsPath": "/opt/esp",
27+
"idf.gitPath": "/usr/bin/git"
28+
},
29+
"extensions": [
30+
"espressif.esp-idf-extension",
31+
"espressif.esp-idf-web"
32+
]
33+
}
34+
},
35+
"runArgs": ["--privileged"]
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "ESP-IDF",
5+
"compilerPath": "${config:idf.toolsPathWin}\\tools\\riscv32-esp-elf\\esp-13.2.0_20240530\\riscv32-esp-elf\\bin\\riscv32-esp-elf-gcc.exe",
6+
"compileCommands": "${config:idf.buildPath}/compile_commands.json",
7+
"includePath": [
8+
"${config:idf.espIdfPath}/components/**",
9+
"${config:idf.espIdfPathWin}/components/**",
10+
"${workspaceFolder}/**"
11+
],
12+
"browse": {
13+
"path": [
14+
"${config:idf.espIdfPath}/components",
15+
"${config:idf.espIdfPathWin}/components",
16+
"${workspaceFolder}"
17+
],
18+
"limitSymbolsToIncludedHeaders": true
19+
}
20+
}
21+
],
22+
"version": 4
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"type": "gdbtarget",
6+
"request": "attach",
7+
"name": "Eclipse CDT GDB Adapter"
8+
},
9+
{
10+
"type": "espidf",
11+
"name": "Launch",
12+
"request": "launch"
13+
}
14+
]
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"C_Cpp.intelliSenseEngine": "default",
3+
"idf.adapterTargetName": "esp32c3",
4+
"idf.customExtraPaths": "C:\\esp\\Espressif\\tools\\xtensa-esp-elf-gdb\\14.2_20240403\\xtensa-esp-elf-gdb\\bin;C:\\esp\\Espressif\\tools\\riscv32-esp-elf-gdb\\14.2_20240403\\riscv32-esp-elf-gdb\\bin;C:\\esp\\Espressif\\tools\\xtensa-esp-elf\\esp-13.2.0_20240530\\xtensa-esp-elf\\bin;C:\\esp\\Espressif\\tools\\riscv32-esp-elf\\esp-13.2.0_20240530\\riscv32-esp-elf\\bin;C:\\esp\\Espressif\\tools\\esp32ulp-elf\\2.38_20240113\\esp32ulp-elf\\bin;C:\\esp\\Espressif\\tools\\cmake\\3.24.0\\bin;C:\\esp\\Espressif\\tools\\openocd-esp32\\v0.12.0-esp32-20240318\\openocd-esp32\\bin;C:\\esp\\Espressif\\tools\\ninja\\1.11.1;C:\\esp\\Espressif\\tools\\idf-exe\\1.0.3;C:\\esp\\Espressif\\tools\\ccache\\4.8\\ccache-4.8-windows-x86_64;C:\\esp\\Espressif\\tools\\dfu-util\\0.11\\dfu-util-0.11-win64;C:\\esp\\Espressif\\tools\\esp-rom-elfs\\20240305",
5+
"idf.customExtraVars": {
6+
"OPENOCD_SCRIPTS": "C:\\esp\\Espressif\\tools\\openocd-esp32\\v0.12.0-esp32-20240318/openocd-esp32/share/openocd/scripts",
7+
"IDF_CCACHE_ENABLE": "1",
8+
"ESP_ROM_ELF_DIR": "C:\\esp\\Espressif\\tools\\esp-rom-elfs\\20240305/"
9+
},
10+
"idf.espIdfPathWin": "C:/esp/Espressif/frameworks/esp-idf-v5.3/",
11+
"idf.openOcdConfigs": [
12+
"board/esp32c3-builtin.cfg"
13+
],
14+
"idf.portWin": "COM6",
15+
"idf.pythonBinPathWin": "C:/esp/Espressif/python_env/idf5.3_py3.11_env/Scripts/python.exe",
16+
"idf.toolsPathWin": "C:\\esp\\Espressif"
17+
}

0 commit comments

Comments
 (0)