Skip to content

Commit

Permalink
Merge pull request #601 from peterwang2050/control-rp2040-for-windows
Browse files Browse the repository at this point in the history
feat: add control RP2040 on Windows docs for x2l/x4l
  • Loading branch information
peterwang2050 authored Dec 5, 2024
2 parents fa1960d + 73793f6 commit 000d39c
Show file tree
Hide file tree
Showing 44 changed files with 866 additions and 133 deletions.
40 changes: 34 additions & 6 deletions docs/common/dev/_pico-fan.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { PreView } from "@site/src/utils/docs";

##### 风扇

本段示例旨在为用户提供一个 {props.product_name} CPU 与 MCU RP2040 通信的例子,通过获取 {props.product_name} CPU 的温度,当达到指定温度时,让风扇转起来。
Expand Down Expand Up @@ -188,12 +190,38 @@ sudo apt-get install minicom
###### 7. 编译
```bash
cd pico-example/build
rm -rf *
cmake ..
make -j$(nproc)
```
{" "}
{" "}
<div>
{props.platform === "Linux" ? (
<div>
<PreView>
cd pico-examples/build
<br />
rm -rf *<br />
cmake ..
<br />
make -j$(nproc)
<br />
</PreView>{" "}
</div>
) : null}
{props.platform === "Windows" ? (
<div>
<PreView>
cd pico-examples/build/
<br />
rm -rf *<br />
cmake -G "Ninja" ..
<br />
ninja
<br />
</PreView>{" "}
</div>
) : null}
</div>
成功编译后,在 build/pwm/pwm_fan 目录下会产生一个名为 pwm_fan.uf2 的文件
Expand Down
34 changes: 28 additions & 6 deletions docs/common/dev/_pico-gpio-controlled-by-intel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,34 @@ import { PreView } from "@site/src/utils/docs";

- 编译

```bash
cd pico-examples/build
rm -rf *
cmake ..
make -j$(nproc)
```
<div>
{props.platform === "Linux" ? (
<div>
<PreView>
cd pico-examples/build
<br />
rm -rf *<br />
cmake ..
<br />
make -j$(nproc)
<br />
</PreView>{" "}
</div>
) : null}
{props.platform === "Windows" ? (
<div>
<PreView>
cd pico-examples/build/
<br />
rm -rf *<br />
cmake -G "Ninja" ..
<br />
ninja
<br />
</PreView>{" "}
</div>
) : null}
</div>

编译成功后, pico-examples/build/pwm/led_fade/ 目录下会产生一个名为 hello_uart.uf2 的文件

Expand Down
36 changes: 30 additions & 6 deletions docs/common/dev/_pico-gpio.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { PreView } from "@site/src/utils/docs";

#### GPIO

##### 1. 准备
Expand Down Expand Up @@ -69,12 +71,34 @@
- 编译
```bash
cd pico-examples/build
rm -rf *
cmake ..
make -j$(nproc)
```
<div>
{props.platform === "Linux" ? (
<div>
<PreView>
cd pico-examples/build
<br />
rm -rf *<br />
cmake ..
<br />
make -j$(nproc)
<br />
</PreView>{" "}
</div>
) : null}
{props.platform === "Windows" ? (
<div>
<PreView>
cd pico-examples/build/
<br />
rm -rf *<br />
cmake -G "Ninja" ..
<br />
ninja
<br />
</PreView>{" "}
</div>
) : null}
</div>
成功编译后,在 pico-examples/build/blink/ 目录下会产生一个名为 blink.uf2 的文件
Expand Down
36 changes: 30 additions & 6 deletions docs/common/dev/_pico-i2c.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { PreView } from "@site/src/utils/docs";

#### I2C

##### 1. 准备
Expand Down Expand Up @@ -202,12 +204,34 @@
- 编译
```bash
cd pico-examples/build
rm -rf *
cmake ..
make -j$(nproc)
```
<div>
{props.platform === "Linux" ? (
<div>
<PreView>
cd pico-examples/build
<br />
rm -rf *<br />
cmake ..
<br />
make -j$(nproc)
<br />
</PreView>{" "}
</div>
) : null}
{props.platform === "Windows" ? (
<div>
<PreView>
cd pico-examples/build/
<br />
rm -rf *<br />
cmake -G "Ninja" ..
<br />
ninja
<br />
</PreView>{" "}
</div>
) : null}
</div>
成功编译后,在 pico-examples/build/i2c/lcd_1602_i2c/ 目录下会产生一个名为 lcd_1602_i2c.uf2 的文件
Expand Down
35 changes: 29 additions & 6 deletions docs/common/dev/_pico-poe-fan.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PreView } from "@site/src/utils/docs";
import { Image } from "@site/src/utils/docs";

#### PoE FAN
Expand Down Expand Up @@ -107,12 +108,34 @@ int main() {

- 编译

```bash
cd pico-examples/build
rm -rf *
cmake ..
make -j$(nproc)
```
<div>
{props.platform === "Linux" ? (
<div>
<PreView>
cd pico-examples/build
<br />
rm -rf *<br />
cmake ..
<br />
make -j$(nproc)
<br />
</PreView>{" "}
</div>
) : null}
{props.platform === "Windows" ? (
<div>
<PreView>
cd pico-examples/build/
<br />
rm -rf *<br />
cmake -G "Ninja" ..
<br />
ninja
<br />
</PreView>{" "}
</div>
) : null}
</div>

成功编译后,在 pico-examples/build/pio/onewire/ 目录下会产生一个名为 pio_onwire.uf2 的文件

Expand Down
36 changes: 30 additions & 6 deletions docs/common/dev/_pico-pwm.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { PreView } from "@site/src/utils/docs";

#### PWM

##### 1. 准备
Expand Down Expand Up @@ -100,12 +102,34 @@ int main() {

- 编译

```bash
cd pico-examples/build
rm -rf *
cmake ..
make -j$(nproc)
```
<div>
{props.platform === "Linux" ? (
<div>
<PreView>
cd pico-examples/build
<br />
rm -rf *<br />
cmake ..
<br />
make -j$(nproc)
<br />
</PreView>{" "}
</div>
) : null}
{props.platform === "Windows" ? (
<div>
<PreView>
cd pico-examples/build/
<br />
rm -rf *<br />
cmake -G "Ninja" ..
<br />
ninja
<br />
</PreView>{" "}
</div>
) : null}
</div>

编译成功后, 在 pico-examples/build/pwm/led_fade/ 目录下会产生一个名为 pwm_led_fade.uf2 的文件

Expand Down
99 changes: 99 additions & 0 deletions docs/common/dev/_pico-sdk-windows.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
### 安装必要工具

- [Git for Windows](https://github.com/git-for-windows/git/releases/download/v2.47.1.windows.1/Git-2.47.1-64-bit.exe)

该工具主要方便用户使用 git 命令, 以及为用户提供一些 Linux 命令, 我们可以在该工具下进行编译

{" "}

<img
src="/img/x/git_for_windows.webp"
style={{ width: "80%" }}
alt="git for windows"
/>

- [Vscode for Windows](https://code.visualstudio.com/download)

{" "}

<img
src="/img/x/vscode_install.webp"
style={{ width: "80%" }}
alt="vscode for windows"
/>

- [CMAKE](https://github.com/Kitware/CMake/releases/download/v3.31.1/cmake-3.31.1-windows-x86_64.msi)

{" "}

<img
src="/img/x/vscode_install.webp"
style={{ width: "80%" }}
alt="cmake for windows"
/>

- [Pico Setup Windows](https://github.com/raspberrypi/pico-setup-windows/releases/latest/download/pico-setup-windows-x64-standalone.exe)

{" "}

<img
src="/img/x/pico-sdk_install.webp"
style={{ width: "80%" }}
alt="cmake for windows"
/>

- [Ninja](https://github.com/ninja-build/ninja/releases)

下载后解压即可,

- [Python3 for Windows](https://www.python.org/downloads/windows/)

### 设置环境变量

- 在搜索栏搜索 "编辑系统环境"

- 点击 "环境变量"

- 添加系统变量或者用户变量

- 添加变量 PICO_INSTALL_PATH 和 PICO-SDK_PATH

{" "}

<img
src="/img/x/pico_install_path.webp"
style={{ width: "80%" }}
alt="pico install path"
/>

{" "}

<img
src="/img/x/pico-sdk_path.webp"
style={{ width: "80%" }}
alt="pico sdk path"
/>

- 添加 PATH

{" "}

<img
src="/img/x/pico_var_env.webp"
style={{ width: "80%" }}
alt="pico path env"
/>

### 构建编译

打开 git bash, 进入到 pico-examples/build 目录下,执行以下命令进行构建编译

```bash
cmake -G "Ninja" ..

ninja
```

<img src="/img/x/cmake_ninja.webp" style= {{ width: "80%"}} alt="cmake ninja" />

<img src="/img/x/ninja_build.webp" style= {{ width: "80%"}} alt="ninja build" />
Loading

0 comments on commit 000d39c

Please sign in to comment.