-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This file makes sure that Github Pages doesn't process mdBook's output. |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[build] | ||
target = "thumbv7em-none-eabihf" | ||
|
||
[target.thumbv7em-none-eabihf] | ||
runner = "probe-rs run --chip nRF52833_xxAA" | ||
rustflags = [ | ||
"-C", "linker=rust-lld", | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[package] | ||
name = "rtt-check" | ||
version = "0.1.0" | ||
authors = ["Henrik Böving <[email protected]>"] | ||
edition = "2021" | ||
|
||
[dependencies] | ||
cortex-m-rt = "0.7.3" | ||
panic-rtt-target = "0.1.3" | ||
rtt-target = "0.5.0" | ||
|
||
[dependencies.nrf52833-pac] | ||
version = "0.12.2" | ||
features = ["cortex-m-rt"] | ||
|
||
[dependencies.cortex-m] | ||
version = "0.7.7" | ||
features = ["inline-asm", "critical-section-single-core"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[default.probe] | ||
protocol = "Swd" | ||
|
||
[default.general] | ||
chip = "nrf52833_xxAA" | ||
|
||
[default.rtt] | ||
enabled = true | ||
|
||
[default.gdb] | ||
enabled = false |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
//! This build script copies the `memory.x` file from the crate root into | ||
//! a directory where the linker can always find it at build time. | ||
//! For many projects this is optional, as the linker always searches the | ||
//! project root directory (wherever `Cargo.toml` is). However, if you | ||
//! are using a workspace or have a more complicated build setup, this | ||
//! build script becomes required. Additionally, by requesting that | ||
//! Cargo re-run the build script whenever `memory.x` is changed, | ||
//! a rebuild of the application with new memory settings is ensured after updating `memory.x`. | ||
|
||
use std::env; | ||
use std::fs::File; | ||
use std::io::Write; | ||
use std::path::PathBuf; | ||
|
||
fn main() { | ||
// Put `memory.x` in our output directory and ensure it's | ||
// on the linker search path. | ||
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); | ||
File::create(out.join("memory.x")) | ||
.unwrap() | ||
.write_all(include_bytes!("memory.x")) | ||
.unwrap(); | ||
println!("cargo:rustc-link-search={}", out.display()); | ||
|
||
// By default, Cargo will re-run a build script whenever | ||
// any file in the project changes. By specifying `memory.x` | ||
// here, we ensure the build script is only re-run when | ||
// `memory.x` is changed. | ||
println!("cargo:rerun-if-changed=memory.x"); | ||
} |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* Linker script for the nRF52833 */ | ||
MEMORY | ||
{ | ||
/* NOTE K = KiBi = 1024 bytes */ | ||
FLASH : ORIGIN = 0x00000000, LENGTH = 512K | ||
RAM : ORIGIN = 0x20000000, LENGTH = 128K | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#![no_main] | ||
#![no_std] | ||
|
||
use cortex_m::asm::wfi; | ||
use panic_rtt_target as _; | ||
use nrf52833_pac as _; | ||
use rtt_target::{rprintln, rtt_init_print}; | ||
|
||
use cortex_m_rt::entry; | ||
|
||
#[entry] | ||
fn main() -> ! { | ||
rtt_init_print!(); | ||
rprintln!("Hello World"); | ||
loop { | ||
wfi(); | ||
} | ||
} |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[build] | ||
target = "thumbv7em-none-eabihf" | ||
|
||
[target.thumbv7em-none-eabihf] | ||
runner = "probe-rs run --chip nRF52833_xxAA" | ||
rustflags = [ | ||
"-C", "linker=rust-lld", | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[package] | ||
name = "meet-your-software" | ||
version = "0.1.0" | ||
authors = ["Henrik Böving <[email protected]>"] | ||
edition = "2021" | ||
|
||
[dependencies] | ||
cortex-m-rt = "0.7.3" | ||
panic-halt = "0.2.0" | ||
panic-rtt-target = "0.1.3" | ||
rtt-target = "0.5.0" | ||
microbit-v2 = "0.15.0" | ||
embedded-hal = "1.0.0" | ||
|
||
[dependencies.cortex-m] | ||
version = "0.7.7" | ||
features = ["inline-asm", "critical-section-single-core"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[default.general] | ||
chip = "nrf52833_xxAA" | ||
|
||
[default.reset] | ||
halt_afterwards = true | ||
|
||
[default.rtt] | ||
enabled = false | ||
|
||
[default.gdb] | ||
enabled = true |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#![deny(unsafe_code)] | ||
#![no_main] | ||
#![no_std] | ||
|
||
use cortex_m_rt::entry; | ||
use embedded_hal::delay::DelayNs; | ||
use microbit::board::Board; | ||
use microbit::hal::timer::Timer; | ||
use panic_rtt_target as _; | ||
use rtt_target::{rprintln, rtt_init_print}; | ||
|
||
#[entry] | ||
fn main() -> ! { | ||
rtt_init_print!(); | ||
let board = Board::take().unwrap(); | ||
|
||
let mut timer = Timer::new(board.TIMER0); | ||
|
||
loop { | ||
timer.delay_ms(1000u32); | ||
rprintln!("1000 ms passed"); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#![deny(unsafe_code)] | ||
#![no_main] | ||
#![no_std] | ||
|
||
use cortex_m::asm::wfi; | ||
use cortex_m_rt::entry; | ||
use microbit as _; | ||
use panic_halt as _; | ||
|
||
#[entry] | ||
fn main() -> ! { | ||
#[allow(clippy::needless_late_init)] | ||
let _y; | ||
let x = 42; | ||
_y = x; | ||
|
||
// infinite loop; just so we don't leave this stack frame | ||
loop { | ||
wfi(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#![deny(unsafe_code)] | ||
#![no_main] | ||
#![no_std] | ||
|
||
use cortex_m_rt::entry; | ||
use embedded_hal::digital::OutputPin; | ||
use microbit::board::Board; | ||
use panic_halt as _; | ||
|
||
#[entry] | ||
fn main() -> ! { | ||
let mut board = Board::take().unwrap(); | ||
|
||
board.display_pins.col1.set_low().unwrap(); | ||
board.display_pins.row1.set_high().unwrap(); | ||
|
||
loop {} | ||
} |