diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f012e25..5286a830 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,16 +7,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +## [v0.9.0] - 2022-03-02 + ### Added - Reexport gpio pins to `gpio` mod - Added the ability to specify the word size (8 or 9 bits) for `Serial` (USART). When using parity, the parity bit is included in the number of bits of the word. - `blocking::serial::Write` for `Tx` and `Serial`. `core::fmt::Write` for `Serial` - `Instance` for Timer's, rtic-monotonic fugit impl -- Serial can now be reconfigured, allowing to change e.g. the baud rate after initialisation. +- Serial can now be reconfigured, allowing to change e.g. the baud rate after initialization. ### Changed +- Use `embedded-dma` 0.2.0 - Connectivity line devices configuration supports ADC2 - replace `GetBusFreq` with `BusClock` and `BusTimerClock` @@ -302,7 +305,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - First tagged version -[Unreleased]: https://github.com/stm32-rs/stm32f1xx-hal/compare/v0.8.0...HEAD +[Unreleased]: https://github.com/stm32-rs/stm32f1xx-hal/compare/v0.9.0...HEAD +[v0.9.0]: https://github.com/stm32-rs/stm32f1xx-hal/compare/v0.8.0...v0.9.0 [v0.8.0]: https://github.com/stm32-rs/stm32f1xx-hal/compare/v0.7.0...v0.8.0 [v0.7.0]: https://github.com/stm32-rs/stm32f1xx-hal/compare/v0.6.1...v0.7.0 [v0.6.1]: https://github.com/stm32-rs/stm32f1xx-hal/compare/v0.6.0...v0.6.1 diff --git a/Cargo.toml b/Cargo.toml index e9fb3411..fca57954 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ repository = "https://github.com/stm32-rs/stm32f1xx-hal" documentation = "https://docs.rs/stm32f1xx-hal" readme = "README.md" edition = "2018" -version = "0.8.0" +version = "0.9.0" [package.metadata.docs.rs] features = ["stm32f103", "rt"] @@ -17,13 +17,13 @@ default-target = "x86_64-unknown-linux-gnu" [dependencies] cortex-m = "0.7.4" -cortex-m-rt = "0.7" +cortex-m-rt = "0.7.1" nb = "1" stm32f1 = "0.14.0" -embedded-dma = "0.1.2" +embedded-dma = "0.2.0" bxcan = "0.6" void = { default-features = false, version = "1.0.2" } -embedded-hal = { features = ["unproven"], version = "0.2.6" } +embedded-hal = { features = ["unproven"], version = "0.2.7" } fugit = "0.3.5" fugit-timer = "0.1.3" rtic-monotonic = { version = "1.0", optional = true } @@ -39,7 +39,7 @@ panic-semihosting = "0.5.6" panic-itm = "0.4.1" cortex-m-rtic = "1.0.0" cortex-m-semihosting = "0.3.7" -heapless = "0.7.9" +heapless = "0.7.10" mfrc522 = "0.2.0" usb-device = "0.2.8" usbd-serial = "0.1.1" diff --git a/README.md b/README.md index 1aa9941c..8ed711a1 100644 --- a/README.md +++ b/README.md @@ -186,7 +186,7 @@ be specified as part of the `Cargo.toml` definition. ```toml [dependencies.stm32f1xx-hal] -version = "0.6.1" +version = "0.9.0" features = ["stm32f100", "rt"] ``` diff --git a/src/adc.rs b/src/adc.rs index adfc3969..873b5b58 100644 --- a/src/adc.rs +++ b/src/adc.rs @@ -11,7 +11,7 @@ use crate::rcc::{Clocks, Enable, Reset}; use crate::time::kHz; use core::sync::atomic::{self, Ordering}; use cortex_m::asm::delay; -use embedded_dma::StaticWriteBuffer; +use embedded_dma::WriteBuffer; use crate::pac::{self, RCC}; @@ -735,13 +735,13 @@ macro_rules! adcdma { impl crate::dma::CircReadDma for AdcDma<$ADCX, PINS, MODE, $dmarxch> where Self: TransferPayload, - &'static mut [B; 2]: StaticWriteBuffer, + &'static mut [B; 2]: WriteBuffer, B: 'static, { fn circ_read(mut self, mut buffer: &'static mut [B; 2]) -> CircBuffer { // NOTE(unsafe) We own the buffer now and we won't call other `&mut` on it // until the end of the transfer. - let (ptr, len) = unsafe { buffer.static_write_buffer() }; + let (ptr, len) = unsafe { buffer.write_buffer() }; self.channel.set_peripheral_address( unsafe { &(*<$ADCX>::ptr()).dr as *const _ as u32 }, false, @@ -775,12 +775,12 @@ macro_rules! adcdma { impl crate::dma::ReadDma for AdcDma<$ADCX, PINS, MODE, $dmarxch> where Self: TransferPayload, - B: StaticWriteBuffer, + B: WriteBuffer, { fn read(mut self, mut buffer: B) -> Transfer { // NOTE(unsafe) We own the buffer now and we won't call other `&mut` on it // until the end of the transfer. - let (ptr, len) = unsafe { buffer.static_write_buffer() }; + let (ptr, len) = unsafe { buffer.write_buffer() }; self.channel.set_peripheral_address( unsafe { &(*<$ADCX>::ptr()).dr as *const _ as u32 }, false, diff --git a/src/dma.rs b/src/dma.rs index 857e8781..d215861c 100644 --- a/src/dma.rs +++ b/src/dma.rs @@ -5,7 +5,7 @@ use core::{ marker::PhantomData, sync::atomic::{compiler_fence, Ordering}, }; -use embedded_dma::{StaticReadBuffer, StaticWriteBuffer}; +use embedded_dma::{ReadBuffer, WriteBuffer}; #[derive(Debug)] #[non_exhaustive] @@ -35,7 +35,7 @@ where impl CircBuffer where - &'static mut [BUFFER; 2]: StaticWriteBuffer, + &'static mut [BUFFER; 2]: WriteBuffer, BUFFER: 'static, { pub(crate) fn new(buf: &'static mut [BUFFER; 2], payload: PAYLOAD) -> Self { @@ -563,7 +563,7 @@ pub trait Transmit { /// Trait for circular DMA readings from peripheral to memory. pub trait CircReadDma: Receive where - &'static mut [B; 2]: StaticWriteBuffer, + &'static mut [B; 2]: WriteBuffer, B: 'static, Self: core::marker::Sized, { @@ -573,7 +573,7 @@ where /// Trait for DMA readings from peripheral to memory. pub trait ReadDma: Receive where - B: StaticWriteBuffer, + B: WriteBuffer, Self: core::marker::Sized + TransferPayload, { fn read(self, buffer: B) -> Transfer; @@ -582,7 +582,7 @@ where /// Trait for DMA writing from memory to peripheral. pub trait WriteDma: Transmit where - B: StaticReadBuffer, + B: ReadBuffer, Self: core::marker::Sized + TransferPayload, { fn write(self, buffer: B) -> Transfer; @@ -591,8 +591,8 @@ where /// Trait for DMA simultaneously reading and writing within one synchronous operation. Panics if both buffers are not of equal length. pub trait ReadWriteDma: Transmit where - RXB: StaticWriteBuffer, - TXB: StaticReadBuffer, + RXB: WriteBuffer, + TXB: ReadBuffer, Self: core::marker::Sized + TransferPayload, { fn read_write(self, rx_buffer: RXB, tx_buffer: TXB) -> Transfer; diff --git a/src/serial.rs b/src/serial.rs index 9d913529..396dec4b 100644 --- a/src/serial.rs +++ b/src/serial.rs @@ -83,7 +83,7 @@ use core::convert::Infallible; use core::marker::PhantomData; use core::ops::Deref; use core::sync::atomic::{self, Ordering}; -use embedded_dma::{StaticReadBuffer, StaticWriteBuffer}; +use embedded_dma::{ReadBuffer, WriteBuffer}; use embedded_hal::serial::Write; use crate::afio::MAPR; @@ -968,13 +968,13 @@ macro_rules! serialdma { impl crate::dma::CircReadDma for $rxdma where - &'static mut [B; 2]: StaticWriteBuffer, + &'static mut [B; 2]: WriteBuffer, B: 'static, { fn circ_read(mut self, mut buffer: &'static mut [B; 2]) -> CircBuffer { // NOTE(unsafe) We own the buffer now and we won't call other `&mut` on it // until the end of the transfer. - let (ptr, len) = unsafe { buffer.static_write_buffer() }; + let (ptr, len) = unsafe { buffer.write_buffer() }; self.channel.set_peripheral_address(unsafe{ &(*$USARTX::ptr()).dr as *const _ as u32 }, false); self.channel.set_memory_address(ptr as u32, true); self.channel.set_transfer_length(len); @@ -998,12 +998,12 @@ macro_rules! serialdma { impl crate::dma::ReadDma for $rxdma where - B: StaticWriteBuffer, + B: WriteBuffer, { fn read(mut self, mut buffer: B) -> Transfer { // NOTE(unsafe) We own the buffer now and we won't call other `&mut` on it // until the end of the transfer. - let (ptr, len) = unsafe { buffer.static_write_buffer() }; + let (ptr, len) = unsafe { buffer.write_buffer() }; self.channel.set_peripheral_address(unsafe{ &(*$USARTX::ptr()).dr as *const _ as u32 }, false); self.channel.set_memory_address(ptr as u32, true); self.channel.set_transfer_length(len); @@ -1025,12 +1025,12 @@ macro_rules! serialdma { impl crate::dma::WriteDma for $txdma where - B: StaticReadBuffer, + B: ReadBuffer, { fn write(mut self, buffer: B) -> Transfer { // NOTE(unsafe) We own the buffer now and we won't call other `&mut` on it // until the end of the transfer. - let (ptr, len) = unsafe { buffer.static_read_buffer() }; + let (ptr, len) = unsafe { buffer.read_buffer() }; self.channel.set_peripheral_address(unsafe{ &(*$USARTX::ptr()).dr as *const _ as u32 }, false); diff --git a/src/spi.rs b/src/spi.rs index 7ebd568f..dc39cc66 100644 --- a/src/spi.rs +++ b/src/spi.rs @@ -49,7 +49,7 @@ use crate::rcc::{BusClock, Clocks, Enable, Reset}; use crate::time::Hertz; use core::sync::atomic::{self, Ordering}; -use embedded_dma::{StaticReadBuffer, StaticWriteBuffer}; +use embedded_dma::{ReadBuffer, WriteBuffer}; /// SPI error #[derive(Debug)] @@ -625,12 +625,12 @@ macro_rules! spi_dma { impl crate::dma::ReadDma for SpiRxDma<$SPIi, REMAP, PIN, $RCi> where - B: StaticWriteBuffer, + B: WriteBuffer, { fn read(mut self, mut buffer: B) -> Transfer { // NOTE(unsafe) We own the buffer now and we won't call other `&mut` on it // until the end of the transfer. - let (ptr, len) = unsafe { buffer.static_write_buffer() }; + let (ptr, len) = unsafe { buffer.write_buffer() }; self.channel.set_peripheral_address( unsafe { &(*<$SPIi>::ptr()).dr as *const _ as u32 }, false, @@ -668,12 +668,12 @@ macro_rules! spi_dma { impl crate::dma::WriteDma for SpiTxDma<$SPIi, REMAP, PIN, $TCi> where - B: StaticReadBuffer, + B: ReadBuffer, { fn write(mut self, buffer: B) -> Transfer { // NOTE(unsafe) We own the buffer now and we won't call other `&mut` on it // until the end of the transfer. - let (ptr, len) = unsafe { buffer.static_read_buffer() }; + let (ptr, len) = unsafe { buffer.read_buffer() }; self.channel.set_peripheral_address( unsafe { &(*<$SPIi>::ptr()).dr as *const _ as u32 }, false, @@ -712,8 +712,8 @@ macro_rules! spi_dma { impl crate::dma::ReadWriteDma for SpiRxTxDma<$SPIi, REMAP, PIN, $RCi, $TCi> where - RXB: StaticWriteBuffer, - TXB: StaticReadBuffer, + RXB: WriteBuffer, + TXB: ReadBuffer, { fn read_write( mut self, @@ -722,8 +722,8 @@ macro_rules! spi_dma { ) -> Transfer { // NOTE(unsafe) We own the buffer now and we won't call other `&mut` on it // until the end of the transfer. - let (rxptr, rxlen) = unsafe { rxbuffer.static_write_buffer() }; - let (txptr, txlen) = unsafe { txbuffer.static_read_buffer() }; + let (rxptr, rxlen) = unsafe { rxbuffer.write_buffer() }; + let (txptr, txlen) = unsafe { txbuffer.read_buffer() }; if rxlen != txlen { panic!("receive and send buffer lengths do not match!");