-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac4c91b
commit 9a325cc
Showing
4 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//! This is not intended to be used on a real system | ||
#![no_main] | ||
#![no_std] | ||
|
||
#[allow(unused)] | ||
use panic_halt; | ||
|
||
use stm32f0xx_hal as hal; | ||
|
||
use crate::hal::i2c::*; | ||
use crate::hal::prelude::*; | ||
use crate::hal::spi::*; | ||
use crate::hal::stm32; | ||
|
||
use cortex_m_rt::entry; | ||
#[entry] | ||
fn main() -> ! { | ||
const MODE: Mode = Mode { | ||
polarity: Polarity::IdleHigh, | ||
phase: Phase::CaptureOnSecondTransition, | ||
}; | ||
|
||
if let Some(p) = stm32::Peripherals::take() { | ||
let rcc = p.RCC.constrain(); | ||
let clocks = rcc.cfgr.freeze(); | ||
|
||
let pins = unsafe { (NoSck::new(), NoMiso::new(), NoMosi::new()) }; | ||
let _ = Spi::spi1(p.SPI1, pins, MODE, 100_000.hz(), clocks); | ||
|
||
let pins = unsafe { (NoScl::new(), NoSda::new()) }; | ||
let _ = I2c::i2c1(p.I2C1, pins, 400.khz()); | ||
} | ||
loop { | ||
continue; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters