Commit graph

588 commits

Author SHA1 Message Date
Jan Niehusmann 365ac70ae4 Fix building of examples which do not use defmt
Uses build.rs in board directories to set the linker options locally.
The file .cargo/config can't be used for that, as in a workspace the
local .cargo/config is ignored if the build is triggered from the
workspace root.
2022-07-31 15:35:49 +00:00
Jan Niehusmann 46110c0d32 Update examples to defmt 0.3
Current version of probe-run is 0.3.3, which uses defmt 0.3.2.

With a firmware using defmt 0.2, this causes the following error
message:

```
Error: defmt wire format version mismatch: firmware is using 0.2, `probe-run` supports 3
suggestion: `cargo install` a different version of `probe-run` that supports defmt 0.2
```

Therefore, upgrade defmt dependency, and also fix the linker script
in .cargo/config.
2022-07-25 19:39:14 +00:00
Jan Niehusmann 32411b8652
Merge pull request #394 from jannic/use-ref-for-clock-to-herz
Implement conversion from Clock to Hertz using reference
2022-07-25 20:38:21 +02:00
Philip L. McMahon d0eaca63ef
Match Seeeduino XIAO pin name to function (#396) 2022-07-24 20:50:12 +10:00
Jan Niehusmann 595e0a9974 i2c is driven from system_clock, noch peripheral_clock. Update example accordingly. 2022-07-22 20:34:56 +00:00
Jan Niehusmann f8984a9eac Implement conversion from Clock to Hertz using reference
Implementing `impl From<SystemClock> for Hertz` is a footgun, as
SystemClock is not Copy, so the automatic conversion consumes the
owned clock.

This is visible in the example i2c.rs:

```
    let mut i2c = hal::I2C::i2c1(
        pac.I2C1,
        sda_pin,
        scl_pin, // Try `not_an_scl_pin` here
        400.kHz(),
        &mut pac.RESETS,
        clocks.peripheral_clock,
    );
```

If the user wants to use both `i2c0` and `i2c1` at the same time,
copying from this example won't work:

```
error[E0382]: use of moved value: `clocks.peripheral_clock`
   --> rp2040-hal/examples/i2c.rs:106:9
    |
97  |         clocks.peripheral_clock,
    |         ----------------------- value moved here
...
106 |         clocks.peripheral_clock,
    |         ^^^^^^^^^^^^^^^^^^^^^^^ value used here after move
    |
    = note: move occurs because `clocks.peripheral_clock` has type
`PeripheralClock`, which does not implement the `Copy` trait
```

As getting the frequency from a clock doesn't really need ownership,
changing it to `impl From<&SystemClock> for Hertz` is both more
logical and provides better usability.

This is, however, a breaking change: Code relying on this trait
implementation needs to be changed by adding a `&`.
2022-07-22 20:17:26 +00:00
9names 12387bcf09
Add docs and doc-example for Timer (#386) 2022-07-18 15:35:21 +10:00
nleguen b71dc3678b
Add BSP for VCC-GND YD-RP2040 (#388) 2022-07-18 15:35:00 +10:00
Jacob Ohpea 83b990ee30
Formatting Readme (#385) 2022-07-15 17:49:54 +10:00
9names 69c2dd2c2b
Initial BSP for Pimoroni Badger2040 (#334) 2022-07-11 19:45:44 +10:00
Jan Niehusmann 7d11e2f15e
Merge pull request #381 from 9names/adafruit_macropad_fix_speaker_pin
Fix pin number for speaker in adafruit macropad bsp
2022-07-10 13:04:41 +02:00
9names 5e4805ab2c Fix incorrect pin for speaker 2022-07-10 14:29:10 +10:00
Jan Niehusmann 3c4d8f0b43
Merge pull request #372 from 9names/fix_bsp_pins_docs
Add missing open paren in bsp_pins doc macro
2022-07-09 12:40:16 +02:00
Jan Niehusmann 0f5bc072cd
Use ignore instead of text (#378)
While the code block fails to compile, it's still code and not random text. Marking it with `ignore` allows for proper syntax highlighting, for example.

According to https://github.com/rust-lang/rust/issues/97030#issuecomment-1134499264 this is the proper fix, so this closes #374
2022-07-08 20:58:09 +10:00
Philip L. McMahon 803f582e0f
Add BSP for Seeeduino XIAO RP2040 (#369)
* Add BSP for Seeeduino XIAO RP2040

* Add missing link target

* Add top-level README mention of XIAO RP2040
2022-07-06 20:41:47 +10:00
9names 711694881d
Wrap intrinsics docstring to avoid breakage (#375)
* Wrap code in intrinsics docstring with a text block to fix CI breakage
2022-07-06 19:52:31 +10:00
9names 319c1749fc Fix unmatched parens in bsp_pins doc macro 2022-06-28 22:00:58 +10:00
Hmvp b12aecb51c
Add pio pwm example (#365)
* Add pio pwm example

This adds a more advance pio example which uses side set and instruction injection
2022-06-26 22:11:41 +10:00
Jan Niehusmann e5897ca7a4
Fix PIO rx fifo status (#367)
* Implement embedded-hal 1.0.0-alpha.8 traits

* Add comment about missing SPI traits

* Fix doc of rx.is_empty() and add rx.is_full()
2022-06-24 08:24:27 +10:00
Jan Niehusmann 99dfeaf6f2
Implement embedded-hal 1.0.0-alpha.8 traits (#366)
* Implement embedded-hal 1.0.0-alpha.8 traits

* Add comment about missing SPI traits
2022-06-24 08:19:41 +10:00
Hmvp f7cfeec0d7
Add bsp_pin example (#364) 2022-06-23 21:10:58 +10:00
Hmvp 0f114677d5
Explorer base improvements (#363)
* Improve comments

* Expose pins and all pins naming struct.

This allows users to set the interrupts on the button pins and to skip the PicoExplorer struct but still use proper naming

* Use correct interrupt names in timer::alarms macro in HAL
2022-06-23 19:19:32 +10:00
9names 6ae0698b7a
BSP fixes (#362)
* Update BSP README's to use current version number

* Update ws2812-pio and i2c-pio to release 0.3.0

* Bump patch number for BSPs so we can push with correct docs
2022-06-21 16:36:02 +10:00
9names 1dee2353fa
Remove unused embassy/embassy-traits deps (#359) 2022-06-14 20:04:20 +10:00
Jan Niehusmann 6be536c670
Bump version of board support crates (#358)
* Bump versions of board support crates

* Update changelogs of BSPs and remove broken links
2022-06-14 19:25:12 +10:00
Jan Niehusmann fa77dd54d2
Update dev-dependency on cortex-m-rtic to 1.1.2 (#357)
Also remove dependency in two places where it is not used
2022-06-14 19:23:42 +10:00
9names 1574a36f7e
Prep for HAL 0.5.0 release (#351)
* Update changelog, readme and version number for HAL 0.5.0 release

* Bump HAL version in BSP deps

* Point ws2812-pio and i2c-pio-rs at hal_0.5.0 branches

* Update changelog with latest commits and release date
2022-06-14 18:04:00 +10:00
9names 9641c0b4a4
Change pio::Tx::write to write u32 instead of <T>* (#352)
* Change pio::Tx::write to write u32 instead of <T>*

* Use i2c-pio branch that supports new SIO FIFO API so the PIO FIFO changes don't break CI
2022-06-13 18:24:05 +10:00
Kasil 9bce594db2
Add accessor for installed pio program offset (#355) 2022-06-05 21:56:46 +10:00
Jan Niehusmann ed7148a1e7
Take possible PIO program length of 32 into account (#350)
Avoid overflow of left-shift operation by special-casing the value 32.

Fixes #349
2022-06-02 07:03:04 +10:00
9names d66b47920e
Merge pull request #311 from Liamolucko/multicore-no-alloc
Remove the `alloc` requirement for `Core::spawn`
2022-06-01 20:52:11 +10:00
Liam Murphy e9534ace04 Add a fence after writing the arguments to the stack
Co-authored-by: Jan Niehusmann <jan@gondor.com>
2022-06-01 17:33:37 +10:00
9names e9f367f26c
Restrict PIO FIFO writes to unsigned integers (#318)
* Change pio::Tx::write to write u32 instead of <T>*

* Add replicated u8/u16 writes to pio::Tx::write

* Switching back to generic version of pio::fifo.write()

* Fix links to make cargo doc happy

Co-authored-by: Jan Niehusmann <jan@gondor.com>

Co-authored-by: Jan Niehusmann <jan@gondor.com>
2022-06-01 06:13:33 +10:00
9names 895bae90b5
Merge pull request #324 from 9names/bsp_use_hal_entry_macro
Add reexport of rp2040::entry to BSPs
2022-05-31 23:41:45 +10:00
paddywwoof f8720fcbd2
Port HD44780 display example from rp2040-hal to rp-pico (#347) 2022-05-31 23:08:02 +10:00
Liam Murphy 9848f849bd Write core 1 arguments directly to RAM without casting to usize 2022-05-29 19:56:20 +10:00
Jacob Vanderkarr 882db12855
Add BSP for Arduino RP2040 Nano Connect (#345)
* Modifies:
* Cargo toml to include arduino_nano_connect package
* README to update documentation to reflect a board being added

Adds:
* Basic support package for Arduino's RP2040 Nano Connect board
* blinky example

Co-authored-by: splicedbread <jacob.vanderkarr@oit.edu>
Co-authored-by: 9names <60134748+9names@users.noreply.github.com>
2022-05-29 08:42:05 +10:00
luca zulian 3842ef2700
Add Pico PWM micro servo example (#346)
* Add micro servo with pwm working example

Signed-off-by: lucazulian <lucagiuggia@gmail.com>

* Add duty value suggestion

Signed-off-by: lucazulian <lucagiuggia@gmail.com>

* Fix code formatting

* Use CountDown instead of Delay
2022-05-26 22:25:49 +10:00
Christian Maniewski 99b8845d74
Add missing GPIO I2C trait implmentations (#344) 2022-05-25 09:03:29 +10:00
Paul Daniel Faria a4b04862ae
Add missing copi pin for sparkfun-pro-micro-2040 (#341) 2022-05-20 15:31:05 +10:00
Jan Niehusmann db1b5d36b5 Set device_class of twitchy_mouse example to 0
This fixes the mouse on Mac.

Closes #327
2022-05-16 22:32:08 +10:00
TyPott 27509090bf
Fix typo in License section of READMEs (#338) 2022-05-13 17:00:26 +10:00
Jordan Williams cf86e08749
Add the Pimoroni Plasma 2040 board (#337)
* Add the Pimoroni Plasma 2040 board

This PR adds the board support package and a simple example.
The example just blinks the on-board RGB LED.

An example should be added for using the board to control an LED strip.
This should probably use smart-leds with the associated PIO driver.

An example or functionality should be added for the current sensor.

* Rename LED data line from dat to data to match schematic

* Add an example for driving WS2812 LEDs

This is pretty much a copy-paste of the awesome pico_ws2812_led example.

* Remove reference in README to rp-pico

* Remove reference to pico board clock speed

I have removed this in the Plasma 2040 repository and where I copied it from, tiny2040_blinky.

* Remove redundant namespace

* Add self-reference in README to the current board's GitHub README

Fix the erroneous link in the pimoroni-tiny2040 README from which I copied.
2022-05-12 11:17:11 +10:00
Wilfried Chauveau 38692dfcb9
Add defmt feature (as optional dep) and allow i2c::Error to be formatted (#328) 2022-05-09 19:22:41 +10:00
TyPott cd692427f6
Initial BSP for SparkFun Thing Plus RP2040 (#336) 2022-05-09 19:19:20 +10:00
Evan Older f4abf18be5
Merge branch 'main' into main 2022-05-08 13:31:54 -04:00
Liam Murphy 0e5fdcfd9c Fix example 2022-05-08 20:14:40 +10:00
Liam Murphy 3e1e762d20 Add multicore_polyblink example 2022-05-08 18:29:27 +10:00
Liam Murphy c0fafc7694 Make Multicore take SioFifo rather than the whole Sio & make the spawn closure the last argument 2022-05-08 18:24:49 +10:00
Liam Murphy b932663cc9
Merge branch 'main' into multicore-no-alloc 2022-05-03 17:40:22 +10:00