You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
161: readme: add instructions for tests r=korken89 a=andresv
It took me some time to figure out which features must be used for tests. So this pull request removes some friction.
162: histbuf: replace slow modulo operations r=korken89 a=andresv
STM32G081 Cortex-M0 64MHz
thumbv6m-none-eabi
Rust 1.43.1
RTFM application where data from ADC channels is added to `HistoryBuffers`:
```Rust
// this is shared with DMA
static mut ADC_DATA: [u16; 6] = [0; 6];
...
// this interrupt fires when DMA has finished sequencing all ADC channels
#[task(binds = DMA_CHANNEL1, resources = [pa9, adc_data, hist0, hist1, hist2, hist3, hist4, hist5])]
fn adc_data_ready(ctx: adc_data_ready::Context) {
let dma = unsafe { &(*stm32::DMA::ptr()) };
// transfer complete flag clear
dma.ifcr.write(|w| w.ctcif1().set_bit());
ctx.resources.pa9.set_high().unwrap();
ctx.resources.hist0.write(ctx.resources.adc_data[0]);
ctx.resources.hist1.write(ctx.resources.adc_data[1]);
ctx.resources.hist2.write(ctx.resources.adc_data[2]);
ctx.resources.hist3.write(ctx.resources.adc_data[3]);
ctx.resources.hist4.write(ctx.resources.adc_data[4]);
ctx.resources.hist5.write(ctx.resources.adc_data[5]);
ctx.resources.pa9.set_low().unwrap();
}
```
Time is measured from `PA9` pin using logic analyzer.
```
[profile.release]
opt-level = "s"
codegen-units = 1
debug = true
lto = true
```
- before `27.6 us`
- with fix `4.4 us`
```
[profile.release]
opt-level = 2
codegen-units = 1
debug = true
lto = true
```
- before `25.9 us`
- with fix `2.9 us`
Co-authored-by: Andres Vahter <andres.vahter@gmail.com>
0 commit comments