Skip to content

Commit

Permalink
hide WIP assignments
Browse files Browse the repository at this point in the history
  • Loading branch information
AdinAck committed Sep 30, 2024
1 parent 7f9d74d commit 85be1f8
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 2 deletions.
48 changes: 47 additions & 1 deletion content/assignments/full-stack/BLE/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,52 @@
title: BLE
type: docs
prev: assignments/full-stack/
next: assignments/full-stack/ble/tutorial
next: assignments/full-stack/ble/firmware
weight: 2
---

Let's take a look at the hierarchy of the system we are about to design:

```mermaid
graph LR
subgraph "DevBoard (Rust)"
subgraph "Front End"
A2(LED)
end
subgraph "Back End"
B2(BLE)
C2(Events)
D2(Logic)
end
B2 --> C2 --> D2 --> A2
D2 --> B2
end
subgraph "Phone (Swift)"
subgraph "Front End"
A1(UI)
B1(Alerts)
end
subgraph "Back End"
C1(Delegate)
D1(Logic)
E1(BLE)
end
A1 --> C1 --> D1 <--> E1
D1 --> B1
end
B2 <--> E1
```

Now, I know this looks complicated, but we will tackle each block one by one, nice and slow.

Once you are done with this, you will have a solid understanding of creating systems involving
bidirectional communication between 2 devices, which is *super* useful for *a ton* of
applications (including your final project).

So let's get started.
53 changes: 53 additions & 0 deletions content/assignments/full-stack/BLE/firmware.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
title: Firmware
type: docs
prev: assignments/full-stack/ble
next: assignments/full-stack/ble/client
weight: 1
---

## Setup

Create a new project with:

```sh
cargo embassy init {project_name} --chip esp32c3
```

Then run:

```sh
cargo add esp-wifi --features esp32c3,ble
```

to add the `esp-wifi` crate with BLE capability enabled.

And add the following dependency:

```toml
bleps = { git = "https://github.com/bjoernQ/bleps", package = "bleps", rev = "a5148d8ae679e021b78f53fd33afb8bb35d0b62e", features = [
"macros",
"async",
] }
```
> This crate provides a simple hardware agnostic BLE interface.
Then add an additional linker arg in `build.rs`:

```diff
fn main() {
println!("cargo:rustc-link-arg-bins=-Tlinkall.x");
+ println!("cargo::rustc-link-arg=-Trom_functions.x")
}
```

And like previously, patch the esp32 deps in `Cargo.toml`:

```toml
[patch.crates-io]
esp-hal = { git = "https://github.com/esp-rs/esp-hal/", rev = "f95ab0def50130a9d7da0ba0101c921e239ecdb5" }
esp-hal-embassy = { git = "https://github.com/esp-rs/esp-hal/", rev = "f95ab0def50130a9d7da0ba0101c921e239ecdb5" }
esp-backtrace = { git = "https://github.com/esp-rs/esp-hal/", rev = "f95ab0def50130a9d7da0ba0101c921e239ecdb5" }
esp-println = { git = "https://github.com/esp-rs/esp-hal/", rev = "f95ab0def50130a9d7da0ba0101c921e239ecdb5" }
esp-wifi = { git = "https://github.com/esp-rs/esp-hal/", rev = "f95ab0def50130a9d7da0ba0101c921e239ecdb5" }
```
2 changes: 2 additions & 0 deletions content/assignments/full-stack/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ type: docs
prev: assignments/spinning-and-blinking/
next: assignments/full-stack/tutorial
weight: 5
sidebar:
exclude: true
---

## Preamble
Expand Down
2 changes: 2 additions & 0 deletions content/assignments/spinning-and-blinking/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ type: docs
prev: assignments/vu-meter/
next: assignments/spinning-and-blinking/getting-started
weight: 4
sidebar:
exclude: true
---

In this assignment you will learn to create a **G**raphical **U**ser **I**nterface (GUI) to interact with a microcontroller.
Expand Down
2 changes: 1 addition & 1 deletion content/assignments/vu-meter/submission.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Submission
type: docs
next: assignments/spinning-and-blinking/
# next: assignments/spinning-and-blinking/
weight: 3
---

Expand Down

0 comments on commit 85be1f8

Please sign in to comment.