-
Notifications
You must be signed in to change notification settings - Fork 58
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
77a6dad
commit eb7c5d1
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 mut flash = p.FLASH; | ||
let mut rcc = p.RCC.configure().sysclk(8.mhz()).freeze(&mut flash); | ||
|
||
let pins = unsafe { (NoSck::new(), NoMiso::new(), NoMosi::new()) }; | ||
let _ = Spi::spi1(p.SPI1, pins, MODE, 100_000.hz(), &mut rcc); | ||
|
||
let pins = unsafe { (NoScl::new(), NoSda::new()) }; | ||
let _ = I2c::i2c1(p.I2C1, pins, 400.khz(), &mut rcc); | ||
} | ||
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