Commit graph

166 commits

Author SHA1 Message Date
Jan Niehusmann 280de7cb99 Enable critical-section-impl by default only from board crates, not from hal
There are a lot of non-binary crates depending on rp2040-hal. That way,
the default-features of rp2040-hal may be activated unintentionally
through an indirect dependency. Therefore, a binary crate which wants
to disable the `critical-section-impl` feature to provide its own one
could have a hard time to do so.

In contrast, the board support crates are usually only used by top-level
binary crates. So disabling the default features on those should usually
just work.

Binary crates depending on rp2040-hal directly, which don't use any
board support crate, might need to activate the feature manually. This
is reasonable because those binary crates need to replicate some
boilerplate from the board crates anyhow.
2022-08-24 14:31:43 +00:00
Jan Niehusmann 6ef6838132
Merge pull request #428 from jannic/fix-embedded-sdmmc-2
Minimal fix for embedded-sdmmc build failure
2022-08-23 09:41:04 +02:00
Jan Niehusmann d5331d1ac7 Minimal fix for embedded-sdmmc build failure
Just pin the git dependency on the most recent working version
2022-08-23 07:28:28 +00:00
Wilfried Chauveau 42e929d7e1
Use rp2040-hal in all example (possibly through their bsp) (#423)
* Use rp2040-hal in all example (possibly through their bsp)

Some of the examples were using the cortex_m_rt::entry method which
misses the device specific spinlock re-initialisation.

This commits makes the usage more consistent by using rp2040_hal exported
macro as the only `entry` method used across examples.
2022-08-21 19:01:45 +01:00
Wilfried Chauveau 51db37a4cb
replace cortex_m::interrupt::Mutex with critical_section::Mutex in examples (#422) 2022-08-21 19:00:57 +01:00
Jan Niehusmann 68eb48be44 Enable rp2040-hal/defmt feature in dev-dependencies
This is a little bit hacky, as it relies on rp2040-hal actually
using (and therefore linking) some defmt code when the defmt feature is
enabled.

However this solution has the advantage that it only affects
dev-dependencies and therefore has no impact on the board crates
themselves.

Closes #420
2022-08-18 16:05:10 +00:00
Wilfried Chauveau 7bfab4ffd2
Implements USB enumeration workaround (RP2040-E5). (#120)
* Implement rp2040-E5 workaround for usb enumeration.

* Expand documentation and add to pico_usb_serial & pico_usb_twitchy_mouse

* Fix errata-5 documentation around the bus-keep state.

* Update CHANGELOG.md
2022-08-17 22:22:36 +01:00
Alexandria 26356428bf
Update pico_usb_twitchy_mouse.rs
typo
2022-08-12 16:08:46 -07:00
Jan Niehusmann 575aba4bfe
Merge pull request #408 from jannic/wfi
Use wfi in otherwise empty infinite loops in examples
2022-08-04 16:49:06 +02:00
Jan Niehusmann 5448a12b31
Merge pull request #398 from jannic/defmt-0.3
Update examples to defmt 0.3
2022-08-02 22:00:11 +02:00
Wilfried Chauveau 60677df099
bump usb-device to 0.2.9 2022-08-02 20:43:00 +01:00
Jan Niehusmann 44019781e2 Use wfi in otherwise empty infinite loops in examples
- Clippy warns about empty loops, https://github.com/rust-lang/rust-clippy/issues/6161
- wfi allows to CPU to save some power

WFI was avoided in examples for fear of ill interactions with debuggers.
However the rp2040 debug port does continue to work, as long as the
relevant clocks are not disabled in SLEEP_EN0/SLEEP_EN1. (By default,
all clocks stay enabled in sleep mode.)

This patch replaces several different workarounds with just calling wfi.
2022-08-01 14:54:03 +00:00
Jan Niehusmann dfaeba5315 Remove defmt dependencies from boards/vcc-gnd-yd-rp2040/Cargo.toml
Nothing in that crate depends on defmt
2022-07-31 15:35:49 +00:00
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 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
nleguen b71dc3678b
Add BSP for VCC-GND YD-RP2040 (#388) 2022-07-18 15:35:00 +10:00
9names 69c2dd2c2b
Initial BSP for Pimoroni Badger2040 (#334) 2022-07-11 19:45:44 +10:00
9names 5e4805ab2c Fix incorrect pin for speaker 2022-07-10 14:29:10 +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
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
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
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
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
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
TyPott cd692427f6
Initial BSP for SparkFun Thing Plus RP2040 (#336) 2022-05-09 19:19:20 +10:00
mqy 623457a498 fixed typos 2022-04-30 12:51:45 +10:00
Jan Niehusmann 5f793cde69 Add adafruit-macropad_blinky example
Also adds const XOSC_CRYSTAL_FREQ = 12_000_000, which is the right
value according to https://learn.adafruit.com/assets/103270

Fixes #302
2022-04-30 12:27:48 +10:00
Wilfried Chauveau bb07402fc9 Abstract alarms 2022-04-30 11:54:54 +10:00
9names e9a4f7e40b Update rtic example to reset spinlocks in init 2022-04-30 11:33:22 +10:00
9names 12cbab967c Update all BSP examples to use the BSP's re-exported entry macro 2022-04-10 21:54:56 +10:00
9names f38847a318 Update BSPs to use rp2040_hal::entry instead of cortex_m_rt::entry 2022-04-10 21:43:15 +10:00
9names 7aefb8680d
Update BSPs prior to release (#313)
* Update BSP authors to include 'rp-rs developers'

* Update BSP readme's to reflect current release version

* Update BSP changelogs

* Fix version number in HAL README
2022-03-12 22:43:16 +11:00
9names b81955c2a8
Prep for 0.4.0 release (#312)
* Update changelog for 0.4.0 release

* Enable rt feature for irq example in Cargo.toml

* Bump pio/pio-proc deps to 0.2.0, update pio examples

* Update BSPs to latest ws2812-pio, remove unused pio dep

* Fix usage of pio_proc in doc comment

* Clean up pio doc-example

* Update rp-pico to latest i2c-pio

Co-authored-by: Jan Niehusmann <jan@gondor.com>
2022-03-11 22:37:34 +11:00
Eivind Alexander Bergem da2372b19c Fixed broken link in rp-pico Cargo.toml 2022-03-04 21:27:43 +11:00
Mike Bell 70be6ac766
Add Tiny2040 board support (#305)
* Add Tiny2040 board support

* Remove unnecessary dev-dependencies

* Remove unnecessary dependencies
2022-03-01 07:21:52 +11:00
Jonathan 'theJPster' Pallant 8bdecd2058
Merge pull request #283 from Sizurka/rom-functions
Improve ROM function access
2022-02-04 09:53:59 +00:00