Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
de607b1950 | |||
c954fd185d | |||
732f3e3bc8 | |||
bdbe666a2c | |||
b9d4d7214c | |||
0bc7e0f341 | |||
59463fbaba | |||
439e1d43e7 | |||
2abf35bb6e | |||
a1c0fb90e0 |
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
@ -16,14 +16,11 @@ jobs:
|
||||
override: true
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: true
|
||||
command: check
|
||||
args: --target thumbv6m-none-eabi
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: true
|
||||
command: check
|
||||
args: --examples --target thumbv6m-none-eabi
|
||||
args: --examples
|
||||
|
||||
fmt:
|
||||
name: Rustfmt
|
||||
@ -55,9 +52,8 @@ jobs:
|
||||
- run: rustup component add clippy
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: true
|
||||
command: clippy
|
||||
args: --target thumbv6m-none-eabi -- -D warnings
|
||||
args: -- -D warnings
|
||||
|
||||
ci:
|
||||
if: ${{ success() }}
|
||||
|
@ -8,6 +8,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [unreleased]
|
||||
|
||||
## [v0.4.3]
|
||||
|
||||
- Various smaller fixes for READMEs, update of links in documentation
|
||||
- Simplified CI for github, do not use `cross`
|
||||
- New `blinky-pac` example
|
||||
- Use HAL delay in `blinky` example
|
||||
|
||||
## [v0.4.2]
|
||||
|
||||
### Added
|
||||
|
10
Cargo.toml
10
Cargo.toml
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "va108xx-hal"
|
||||
version = "0.4.2"
|
||||
version = "0.4.3"
|
||||
authors = ["Robin Mueller <muellerr@irs.uni-stuttgart.de>"]
|
||||
edition = "2021"
|
||||
description = "HAL for the Vorago VA108xx family of microcontrollers"
|
||||
@ -36,10 +36,16 @@ debug = true
|
||||
lto = false
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
# Problematic because RTT won't work
|
||||
lto = false
|
||||
debug = true
|
||||
opt-level = "s"
|
||||
|
||||
# Commented until named-profiles feature is stabilized
|
||||
# [profile.release-lto]
|
||||
# inherits = "release"
|
||||
# lto = true
|
||||
|
||||
[[example]]
|
||||
name = "timer-ticks"
|
||||
required-features = ["rt"]
|
||||
|
@ -85,4 +85,4 @@ is contained within the
|
||||
|
||||
7. Flashing the board might work differently for different boards and there is usually
|
||||
more than one way. You can find example instructions for the REB1 development board
|
||||
[here](https://github.com/robamu-org/vorago-reb1-rs).
|
||||
[here](https://egit.irs.uni-stuttgart.de/rust/vorago-reb1).
|
||||
|
47
examples/blinky-pac.rs
Normal file
47
examples/blinky-pac.rs
Normal file
@ -0,0 +1,47 @@
|
||||
//! Blinky examples using only the PAC
|
||||
//!
|
||||
//! Additional note on LEDs:
|
||||
//! Pulling the GPIOs low makes the LEDs blink. See REB1
|
||||
//! schematic for more details.
|
||||
#![no_main]
|
||||
#![no_std]
|
||||
|
||||
use cortex_m_rt::entry;
|
||||
use panic_halt as _;
|
||||
use va108xx as pac;
|
||||
|
||||
// REB LED pin definitions. All on port A
|
||||
const LED_D2: u32 = 1 << 10;
|
||||
const LED_D3: u32 = 1 << 7;
|
||||
const LED_D4: u32 = 1 << 6;
|
||||
|
||||
#[entry]
|
||||
fn main() -> ! {
|
||||
let dp = pac::Peripherals::take().unwrap();
|
||||
// Enable all peripheral clocks
|
||||
dp.SYSCONFIG
|
||||
.peripheral_clk_enable
|
||||
.modify(|_, w| unsafe { w.bits(0xffffffff) });
|
||||
dp.PORTA
|
||||
.dir()
|
||||
.modify(|_, w| unsafe { w.bits(LED_D2 | LED_D3 | LED_D4) });
|
||||
dp.PORTA
|
||||
.datamask()
|
||||
.modify(|_, w| unsafe { w.bits(LED_D2 | LED_D3 | LED_D4) });
|
||||
for _ in 0..10 {
|
||||
dp.PORTA
|
||||
.clrout()
|
||||
.write(|w| unsafe { w.bits(LED_D2 | LED_D3 | LED_D4) });
|
||||
cortex_m::asm::delay(5_000_000);
|
||||
dp.PORTA
|
||||
.setout()
|
||||
.write(|w| unsafe { w.bits(LED_D2 | LED_D3 | LED_D4) });
|
||||
cortex_m::asm::delay(5_000_000);
|
||||
}
|
||||
loop {
|
||||
dp.PORTA
|
||||
.togout()
|
||||
.write(|w| unsafe { w.bits(LED_D2 | LED_D3 | LED_D4) });
|
||||
cortex_m::asm::delay(25_000_000);
|
||||
}
|
||||
}
|
@ -9,7 +9,7 @@
|
||||
use cortex_m_rt::entry;
|
||||
use embedded_hal::digital::v2::ToggleableOutputPin;
|
||||
use panic_halt as _;
|
||||
use va108xx_hal::{gpio::PinsA, pac, prelude::*};
|
||||
use va108xx_hal::{gpio::PinsA, pac, prelude::*, timer::set_up_ms_timer};
|
||||
|
||||
#[entry]
|
||||
fn main() -> ! {
|
||||
@ -18,22 +18,29 @@ fn main() -> ! {
|
||||
let mut led1 = porta.pa10.into_push_pull_output();
|
||||
let mut led2 = porta.pa7.into_push_pull_output();
|
||||
let mut led3 = porta.pa6.into_push_pull_output();
|
||||
let mut delay = set_up_ms_timer(
|
||||
&mut dp.SYSCONFIG,
|
||||
&mut dp.IRQSEL,
|
||||
50.mhz().into(),
|
||||
dp.TIM0,
|
||||
pac::Interrupt::OC0,
|
||||
);
|
||||
for _ in 0..10 {
|
||||
led1.set_low().ok();
|
||||
led2.set_low().ok();
|
||||
led3.set_low().ok();
|
||||
cortex_m::asm::delay(5_000_000);
|
||||
delay.delay_ms(200_u16);
|
||||
led1.set_high().ok();
|
||||
led2.set_high().ok();
|
||||
led3.set_high().ok();
|
||||
cortex_m::asm::delay(5_000_000);
|
||||
delay.delay_ms(200_u16);
|
||||
}
|
||||
loop {
|
||||
led1.toggle().ok();
|
||||
cortex_m::asm::delay(5_000_000);
|
||||
delay.delay_ms(200_u16);
|
||||
led2.toggle().ok();
|
||||
cortex_m::asm::delay(5_000_000);
|
||||
delay.delay_ms(200_u16);
|
||||
led3.toggle().ok();
|
||||
cortex_m::asm::delay(5_000_000);
|
||||
delay.delay_ms(200_u16);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
//!
|
||||
//! ## Examples
|
||||
//!
|
||||
//! - [REB1 I2C temperature sensor example](https://github.com/robamu-org/vorago-reb1-rs/blob/main/examples/temp-sensor.rs)
|
||||
//! - [REB1 I2C temperature sensor example](https://egit.irs.uni-stuttgart.de/rust/vorago-reb1/src/branch/main/examples/adt75-temp-sensor.rs)
|
||||
use crate::{
|
||||
clock::{enable_peripheral_clock, PeripheralClocks},
|
||||
pac::{I2CA, I2CB, SYSCONFIG},
|
||||
|
Reference in New Issue
Block a user