Skip to content

Commit

Permalink
template
Browse files Browse the repository at this point in the history
  • Loading branch information
ImplFerris committed Oct 24, 2024
1 parent 26859cc commit 1d51e37
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- [Introduction](./index.md)
- [Dev Environment](./setup.md)
- [Quick Start](./quick-start.md)
- [Project Template](./cargo-generate.md)
- [Running the Program](./running.md)

- [Blink LED](./blinky/index.md)
Expand Down
41 changes: 41 additions & 0 deletions src/cargo-generate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Project Template with `cargo-generate`

"cargo-generate is a developer tool to help you get up and running quickly with a new Rust project by leveraging a pre-existing git repository as a template."

Read more about [here](https://github.com/cargo-generate/cargo-generate).

## Prerequisites

Before starting, ensure you have the following tools installed:

- [Rust](https://www.rust-lang.org/tools/install)
- [cargo-generate](https://github.com/cargo-generate/cargo-generate) for generating the project template.

You can install `cargo-generate` using the following command:
```sh
cargo install cargo-generate
```

## Step 1: Generate the Project
Run the following command to generate the project from the template:

```sh
cargo generate --git https://github.com/ImplFerris/pico2-template.git
```

This will prompt you to answer a few questions:
Project name: Name your project.
HAL choice: You can choose between embassy or rp-hal.

## Step 2: Default LED Blink Example
By default, the project will be generated with a simple LED blink example. The code structure may look like this:

src/main.rs: Contains the default blink logic.
Cargo.toml: Includes dependencies for the selected HAL.

## Step 3: Choose Your HAL and Modify Code
Once the project is generated, you can decide to keep the default LED blink code or remove it and replace it with your own code based on the HAL you selected.

## Removing Unwanted Code
You can remove the blink logic from src/main.rs and replace it with your own code. Modify the Cargo.toml dependencies and project structure as needed for your project.

0 comments on commit 1d51e37

Please sign in to comment.