forked from M-Labs/ionpak-thermostat
delay: is unsafe
This commit is contained in:
parent
44f48f6e0f
commit
4437a4195e
|
@ -11,9 +11,9 @@ pub struct Delay {
|
|||
}
|
||||
|
||||
impl Delay {
|
||||
pub fn new() -> Self {
|
||||
let mut cp = unsafe { tm4c129x::CorePeripherals::steal() };
|
||||
let mut syst = cp.SYST;
|
||||
/// unsafe: must only be used once to avoid concurrent use of systick
|
||||
pub unsafe fn new() -> Self {
|
||||
let mut syst = CorePeripherals::steal().SYST;
|
||||
// PIOSC
|
||||
syst.set_clock_source(SystClkSource::External);
|
||||
syst.disable_interrupt();
|
||||
|
|
|
@ -137,6 +137,7 @@ impl<'d, SCK: OutputPin, MOSI: OutputPin, MISO: InputPin, D: FnMut()> SyncSoftSp
|
|||
}
|
||||
|
||||
impl<'d, SCK: OutputPin, MOSI: OutputPin, MISO: InputPin, D: FnMut()> Transfer<u8> for SyncSoftSpi<'d, SCK, MOSI, MISO, D> {
|
||||
// TODO: proper type
|
||||
type Error = ();
|
||||
fn transfer<'w>(&mut self, words: &'w mut [u8]) -> Result<&'w [u8], Self::Error> {
|
||||
for b in words.iter_mut() {
|
||||
|
|
|
@ -53,6 +53,7 @@ mod ethmac;
|
|||
|
||||
static ADC_IRQ_COUNT: Mutex<Cell<u64>> = Mutex::new(Cell::new(0));
|
||||
|
||||
// TODO: remove
|
||||
fn get_time_ms() -> u64 {
|
||||
let adc_irq_count = cortex_m::interrupt::free(|cs| {
|
||||
ADC_IRQ_COUNT.borrow(cs).get()
|
||||
|
@ -115,8 +116,8 @@ fn main() -> ! {
|
|||
| |
|
||||
|_|
|
||||
"#);
|
||||
let mut delay = board::delay::Delay::new();
|
||||
// SCK
|
||||
let mut delay = unsafe { board::delay::Delay::new() };
|
||||
// CSn
|
||||
let pb4 = board::gpio::PB4.into_output();
|
||||
// SCLK
|
||||
let pb5 = board::gpio::PB5.into_output();
|
||||
|
|
Loading…
Reference in New Issue