px4flow_bsp

Rust no_std embedded hal board support package for the PX4FLOW optical flow sensor hardware.

Embedded Examples

The examples are designed to be used with a debug probe that supports J-Link / RTT. We provide a couple different ways to run these: - With the Segger tools (This is currently the default.) - With probe-run (This is WIP and may not work as expected.)

With the Segger tools installed

With probe-run installed

Running examples

shell script cargo run --example play --features rttdebug

Interrupt Handling

Currently you need to configure your application to forward interrupts from app-level interrupt handlers, ie:

```rust /// should be called whenever DMA2 completes a transfer

[interrupt]

fn DMA2STREAM1() { // forward to board's interrupt handler unsafe { (*BOARDPTR.load(Ordering::SeqCst)).handledma2stream1_interrupt(); } }

/// should be called whenever DCMI completes a frame

[interrupt]

fn DCMI() { // forward to board's interrupt handler unsafe { (*BOARDPTR.load(Ordering::SeqCst)).handledcmi_interrupt(); } } ```

This assumes you are using the cortex-m-rt crate to construct your embedded application, and using its #[interrupt] to handle interrupts.

Status

Work in progress

Notes

MCU Pin Map

| Pin | Configuration | | :--- | :--- | | PA0 | UART4TX ("TIM5CH1" - N/C) | | PA1 | "TIM5CH2" (unused - N/C) | | PA2 | TIM5CH3EXPOSURE (pulled low) | | PA3 | TIM5CH4STANDBY (pulled low) | | PA4 | DCMIHSYNC | | PA5 | CAMNRESET (tied to high) | | PA6 | DCMIPIXCK | | PB6 | DCMID5 | | PB7 | DCMIVSYNC | | PB8 | I2C1 SCL | | PB9 | I2C1 SDA | | PB10 | I2C2 SCL | | PB11 | I2C2 SDA | | PB12 | spicsgyro | | PB13 | SPI2 SCLK | | PB14 | SPI2 CIPO | | PB15 | SPI2 COPI | | PC6 | DCMID0 | | PC7 | DCMID1 | | PC8 | XCLK | | PC9 | "TIM8CH4LEDOUT" (unused) | | PC10 | DCMID8 | | PC11 | UART4RX | | PC12 | DCMID9 | | PD0 | TBD | | PD5 | TBD | | PD6 | TBD | | PD7 | TBD | | PD15 | TBD | | PE0 | DCMID2 | | PE1 | DCMID3 | | PE2 | userled0 | | PE3 | userled1 | | PE4 | DCMID4 | | PE5 | DCMID6 | | PE6 | DCMID7 | | PE7 | userled2 |