Skip to content

Commit

Permalink
Clean up temp-hal a bit more.
Browse files Browse the repository at this point in the history
  • Loading branch information
cr1901 committed Jan 29, 2022
1 parent ac3c7da commit ddffead
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 4 additions & 2 deletions examples/temp-hal/hal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl I2c {
.ucb0ctl0
.modify(|_, w| w.ucsync().set_bit().ucmode().ucmode_3().ucmst().set_bit()); // I2C mode

inner.ucb0br0.write(|w| w.bits(9)); // INT(1.1MHz/11) = 100kHz
inner.ucb0br0.write(|w| w.bits(11)); // INT(1.1MHz/11) = 100kHz
inner.ucb0br1.write(|w| w.bits(0));

inner.ucb0ctl1.modify(|_, w| w.ucswrst().clear_bit());
Expand Down Expand Up @@ -245,7 +245,7 @@ pub struct SfrIfg {
}

impl SfrIfg {
pub fn new(token: {{device}}::SPECIAL_FUNCTION) -> Self {
pub fn new(_token: {{device}}::SPECIAL_FUNCTION) -> Self {

// SAFETY: Thanks to the input arg, we have already either:
// 1. Safely acquired the peripherals at this point, and thus another thread can't acquire
Expand Down Expand Up @@ -279,6 +279,7 @@ impl Ucb0TxIfg {
Ucb0TxIfg { inner }
}

#[allow(unused)]
fn bit_is_set(&self) -> bool {
self.inner.ifg2.read().ucb0txifg().bit_is_set()
}
Expand All @@ -297,6 +298,7 @@ impl Ucb0RxIfg {
Ucb0RxIfg { inner }
}

#[allow(unused)]
fn bit_is_set(&self) -> bool {
self.inner.ifg2.read().ucb0rxifg().bit_is_set()
}
Expand Down
10 changes: 8 additions & 2 deletions examples/temp-hal/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
//! Temperature sensor demo for the [MSP-EXP430G2](http://www.ti.com/tool/MSP-EXP430G2)
//! development kit. Make sure jumpers are set to HW UART, (possibly) disconnect the green LED
//! jumper, and attach a [TCN75A](https://www.microchip.com/en-us/product/TCN75A) to pins 1.6
//! (SCK) and 1.7 (SDA). Push the button attached to 1.3 to toggle between F, C, and K!
//!
//! ---
#![no_main]
#![no_std]
#![feature(abi_msp430_interrupt)]
Expand Down Expand Up @@ -67,7 +74,7 @@ fn main(cs: CriticalSection) -> ! {
let mut timer = Timer::new(p.TIMER0_A3);
timer.start(6000u16).unwrap();

let mut serial = Serial::new(p.USCI_A0_UART_MODE);
let serial = Serial::new(p.USCI_A0_UART_MODE);

let i2c_flags = SfrIfg::new(p.SPECIAL_FUNCTION);
let i2c = I2c::new(p.USCI_B0_I2C_MODE, i2c_flags.ucb0ifg);
Expand All @@ -85,7 +92,6 @@ fn main(cs: CriticalSection) -> ! {
mspint::enable();
}

let mut cnt: u8 = 0;
loop {
mspint::free(|cs| {
let mut t_ref = TIMER.borrow(*cs).borrow_mut();
Expand Down

0 comments on commit ddffead

Please sign in to comment.