max6675 library works
This commit is contained in:
parent
145d1f8ef9
commit
69ed2fc701
|
@ -64,6 +64,7 @@ fn configure_peripherals(rcc: &mut hcl::platform::rcc::RCC,
|
|||
.set_output_config(7, gpio::OutputConfig::AfPushPull)
|
||||
// MISO1
|
||||
.set_mode(6, gpio::PinMode::Input)
|
||||
.set_input_config(6, gpio::InputConfig::PullUpDown)
|
||||
// NSS1
|
||||
.set_mode(4, gpio::PinMode::Output50MHz)
|
||||
.set_output_config(4, gpio::OutputConfig::PushPull)
|
||||
|
@ -92,7 +93,6 @@ fn run(mut scs: scs::Instance, mut p: hcl::platform::Instance) {
|
|||
|
||||
|
||||
loop {
|
||||
for i in 0u16..0xffff {
|
||||
|
||||
let res = max6675::read(spi, gpio, 4);
|
||||
|
||||
|
@ -102,6 +102,9 @@ fn run(mut scs: scs::Instance, mut p: hcl::platform::Instance) {
|
|||
};
|
||||
|
||||
printer.print(msg);
|
||||
|
||||
for y in 0u32..0xFFFFFF {
|
||||
unsafe { asm!("nop" :::: "volatile") };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@ pub fn read<SPIAddr, GPIOAddr>(spi: &mut PeripheralRef<spi::SPI, SPIAddr>,
|
|||
.set_clock_divider(128)
|
||||
.set_data_16bit(true)
|
||||
.set_clock_skip_first(true)
|
||||
// required for master mode, even if ss is done manually
|
||||
.set_slave_select_output_enabled(true)
|
||||
});
|
||||
|
||||
nss_gpio.reset_bit(nss_idx);
|
||||
|
|
Loading…
Reference in New Issue