Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release/0.3.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
persello committed Mar 6, 2023
2 parents 2f35025 + 25c78cf commit 221a7bc
Show file tree
Hide file tree
Showing 36 changed files with 1,070 additions and 785 deletions.
3 changes: 2 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ linker = "ldproxy"
[target.riscv32imc-esp-espidf]
linker = "ldproxy"
rustflags = ["-C", "default-linker-libraries"]
runner = "espflash flash --monitor -b 2000000 "

[env]
ESP_IDF_SDKCONFIG_DEFAULTS = "sdkconfig.defaults"
Expand All @@ -25,4 +26,4 @@ ESP_IDF_GLOB_CONFIG_FILES_1 = { value = "/partitions.csv" }
build-std = ["std", "panic_abort"]

[net]
git-fetch-with-cli = true
git-fetch-with-cli = true
109 changes: 64 additions & 45 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#file: noinspection SpellCheckingInspection,SpellCheckingInspection,SpellCheckingInspection,SpellCheckingInspection
name: build

on: [push, pull_request]
Expand All @@ -6,68 +7,86 @@ env:
rust_toolchain: nightly

jobs:
compile:
name: Build
format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Remove `rust-toolchain.toml`
run: rm rust-toolchain.toml
- name: Cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cargo/bin
target
key: bluedroid-build
- name: Python setup
uses: actions/setup-python@v2
with:
python-version: 3.10.8
- name: Install libclang
run: sudo apt update && sudo apt-get install clang libclang-dev -y
- name: Rust setup
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.rust_toolchain }}
components: rustfmt, clippy #, rust-src
default: true
- name: Install `rust-src`
run: rustup component add rust-src --toolchain ${{ env.rust_toolchain }}-x86_64-unknown-linux-gnu
- name: Install `ldproxy`
uses: actions-rs/[email protected]
with:
crate: ldproxy
version: latest
use-tool-cache: true
- name: Format check

- name: Setup
uses: pulse-loop/esp32-rust-action@v1

- name: Format
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
continue-on-error: true
# - name: Clippy
# uses: actions-rs/cargo@v1
# with:
# command: clippy
# args: --no-deps --target riscv32imc-esp-espidf -Zbuild-std=std,panic_abort -Zbuild-std-features=panic_immediate_abort -- -Dwarnings
# continue-on-error: true
- name: Clippy with comments

clippy:
name: Clippy
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup
uses: pulse-loop/esp32-rust-action@v1

- name: Cache
uses: actions/cache@v2
with:
path: target
key: target

- name: Clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --no-deps --target riscv32imc-esp-espidf -Zbuild-std=std,panic_abort -Zbuild-std-features=panic_immediate_abort
continue-on-error: true
args: --no-deps --target riscv32imc-esp-espidf -Zbuild-std=std,panic_abort -Zbuild-std-features=panic_immediate_abort -- -Dwarnings

build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup
uses: pulse-loop/esp32-rust-action@v1

- name: Cache
uses: actions/cache@v2
with:
path: target
key: target

- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --target riscv32imc-esp-espidf -Zbuild-std=std,panic_abort -Zbuild-std-features=panic_immediate_abort

examples:
name: Build examples
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup
uses: pulse-loop/esp32-rust-action@v1

- name: Cache
uses: actions/cache@v2
with:
path: target
key: target

- name: Build examples
uses: actions-rs/cargo@v1
with:
command: build
args: --examples --target riscv32imc-esp-espidf -Zbuild-std=std,panic_abort -Zbuild-std-features=panic_immediate_abort
args: --examples --target riscv32imc-esp-espidf -Zbuild-std=std,panic_abort -Zbuild-std-features=panic_immediate_abort
26 changes: 4 additions & 22 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Remove `rust-toolchain.toml`
run: rm rust-toolchain.toml
- name: Python setup
uses: actions/setup-python@v2
with:
python-version: 3.10.8
- name: Install libclang
run: sudo apt update && sudo apt-get install clang libclang-dev -y
- name: Rust setup
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.rust_toolchain }}
components: rustfmt, clippy #, rust-src
default: true
- name: Install `rust-src`
run: rustup component add rust-src --toolchain ${{ env.rust_toolchain }}-x86_64-unknown-linux-gnu
- name: Install `ldproxy`
uses: actions-rs/[email protected]
with:
crate: ldproxy
version: latest
use-tool-cache: true

- name: Setup
uses: pulse-loop/esp32-rust-action@v1

- name: Publish
uses: actions-rs/cargo@v1
with:
Expand Down
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/bluedroid.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/markdown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 4 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
[package]
name = "bluedroid"
version = "0.3.6"
version = "0.3.7"
edition = "2021"
license = "MIT"
description = "A wrapper for the ESP32 Bluedroid Bluetooth stack."
repository = "https://github.com/pulse-loop/bluedroid"
keywords = ["bluetooth", "bluedroid", "esp32", "embedded", "ble"]
categories = ["embedded"]
categories = ["embedded", "hardware-support"]
readme = "README.md"
documentation = "https://docs.rs/bluedroid"
authors = ["Riccardo Persello <[email protected]>"]

exclude = [
".embuild",
".idea",
".vscode",
"target",
"Cargo.lock",
]
exclude = [".embuild", ".idea", ".vscode", "target", "Cargo.lock"]

[package.metadata.esp-idf-sys]
esp_idf_tools_install_dir = "out"
Expand Down Expand Up @@ -53,4 +47,4 @@ required-features = ["esp-idf-sys/binstart"]
[profile.release]
strip = true
opt-level = "z"
lto = true
lto = true
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ It allows you to build a GATT server with a declarative API and supports multith
Declare a characteristic:

```rust
let manufacturer_name_characteristic = Characteristic::new(BleUuid::Uuid16(0x2A29))
.name("Manufacturer Name String")
.permissions(AttributePermissions::new().read().write())
.properties(CharacteristicProperties::new().read().write().notify())
.max_value_length(20)
.on_write(|data, param| {
info!("Received write request: {:?} {:?}", data, param);
})
.show_name()
.set_value("Hello, world!".as_bytes().to_vec())
.build();
let manufacturer_name_characteristic = Characteristic::new(BleUuid::Uuid16(0x2A29))
.name("Manufacturer Name String")
.permissions(AttributePermissions::new().read().write())
.properties(CharacteristicProperties::new().read().write().notify())
.max_value_length(20)
.on_write(|data, param| {
info!("Received write request: {:?} {:?}", data, param);
})
.show_name()
.set_value("Hello, world!".as_bytes().to_vec())
.build();
```

Declare a service:
Expand Down
6 changes: 3 additions & 3 deletions examples/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ fn main() {
notifying_characteristic
.write()
.unwrap()
.set_value(format!("Counter: {}", counter).as_bytes().to_vec());
.set_value(format!("Counter: {counter}").as_bytes().to_vec());
indicating_characteristic
.write()
.unwrap()
.set_value(format!("Counter: {}", counter).as_bytes().to_vec());
.set_value(format!("Counter: {counter}").as_bytes().to_vec());
std::thread::sleep(std::time::Duration::from_secs(1));
}
});
Expand All @@ -119,7 +119,7 @@ fn main() {
unsafe {
let x = esp_get_free_heap_size();
let y = esp_get_free_internal_heap_size();
log::info!("Free heap: {} bytes, free internal heap: {} bytes", x, y);
info!("Free heap: {} bytes, free internal heap: {} bytes", x, y);
}
});

Expand Down
Loading

0 comments on commit 221a7bc

Please sign in to comment.