Skip to content

Instantly share code, notes, and snippets.

@9names
9names / i2c.rs
Created January 2, 2024 22:40
rp2040-hal i2c0 on gpio24/gpio25
//! # I²C Example
//!
//! This application demonstrates how to talk to I²C devices with an RP2040.
//!
//! It may need to be adapted to your particular board layout and/or pin assignment.
//!
//! See the `Cargo.toml` file for Copyright and license details.
#![no_std]
#![no_main]
@9names
9names / Cargo.toml
Created November 29, 2023 12:45
Testing probe-rs attach with LPC55S69
[package]
name = "attach_test"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
probe-rs = { git = "https://github.com/9names/probe-rs", rev = "d9ab28d43c72790ac066b771e8391fa3bae043bc" }
@9names
9names / 2serial4u.rs
Last active June 20, 2023 11:25
implementing 2 cdc serial ports on rp2040
//! # Pico USB Two Serial port Example
//!
//! Creates two USB Serial devices on a Pico board, with the USB driver running in
//! the main thread.
//!
//! This will create two USB Serial device echoing anything they receives.
//! On the first port incoming ASCII characters are converted to uppercase.
//! On the second port incoming ASCII characters are converted to lowercase.
//!
//! See the `Cargo.toml` file for Copyright and license details.
@9names
9names / Cargo.toml
Created April 4, 2023 13:31
basic PAC blinky for ch32v003
[package]
name = "hello-wch"
version = "0.1.0"
edition = "2021"
[dependencies]
panic-halt = "0.2.0"
riscv-rt = "0.11.0"
embedded-hal = "0.2.7"
riscv64-unknown-elf-size target/riscv32ec-unknown-none-elf/release/hello-wch --radix=10
text data bss dec hex filename
496 0 2048 2544 9f0 target/riscv32ec-unknown-none-elf/release/hello-wch
riscv64-unknown-elf-nm target/riscv32ec-unknown-none-elf/release/hello-wch --print-size --size-sort --radix=d
00000396 00000002 T DefaultExceptionHandler
00000398 00000002 T DefaultInterruptHandler
00000400 00000004 T default_pre_init
00000404 00000020 T default_mp_hook
00000424 00000022 T default_setup_interrupts
00000352 00000044 T main
@9names
9names / Cargo.toml
Created February 5, 2023 05:04
enabling critical-section for stm32f4
[package]
name = "stm32f4-test"
version = "0.1.0"
edition = "2021"
publish = false
[dependencies]
cortex-m = { version = "0.7.7", features = ["critical-section-single-core"] }
stm32f4 = { path = "../stm32f4", features = ["rt", "critical-section"] }
embedded-hal = { version="0.2.7", features = ["unproven"] }
@9names
9names / Cargo.toml
Last active January 18, 2023 11:30
bl702 LCD test
[package]
name = "bl702-hal"
version = "0.0.3"
edition = "2021"
license = "MIT OR MulanPSL-2.0"
keywords = ["hal", "bl702", "riscv"]
categories = ["embedded", "no-std", "hardware-support"]
repository = "https://github.com/9names/bl702-hal"
description = "HAL for the Bouffalo Lab BL702 microcontroller family"
@9names
9names / watchdog_spinlock_test.rs
Last active January 5, 2023 23:16
watchdog spinlock test
//! Blinks the LED on a Pico board
//!
//! This will blink an LED attached to GP25, which is the pin the Pico uses for the on-board LED.
#![no_std]
#![no_main]
use cortex_m::prelude::_embedded_hal_watchdog_Watchdog;
use cortex_m_rt::entry;
use defmt::*;
use defmt_rtt as _;
@9names
9names / text_on_test_image.rs
Created November 29, 2022 07:58
test program for mipidsi w/ rp2040-hal and pico-display
//! Blinks the LED on a Pico board
//!
//! This will blink an LED attached to GP25, which is the pin the Pico uses for the on-board LED.
#![no_std]
#![no_main]
use bsp::{entry, hal};
use cortex_m::delay::Delay;
use defmt::*;
use defmt_rtt as _;
@9names
9names / build_release_commit.sh
Last active October 1, 2023 02:16
bflb-mcu-tool git rebuild
#!/bin/bash
export GIT_AUTHOR_NAME="""bouffalolab"""
export GIT_AUTHOR_EMAIL="""jxtan@bouffalolab.com"""
export GIT_AUTHOR_DATE="$2"
export GIT_COMMITTER_NAME="""bouffalolab"""
export GIT_COMMITTER_EMAIL="""jxtan@bouffalolab.com"""
export GIT_COMMITTER_DATE="$2"
rm "*" -rf
tar -xvf ../bflb-mcu-tool-$1.tar.gz --strip-components=1