Commit graph

196 commits

Author SHA1 Message Date
Jan Niehusmann 89d4083dca Move board crates to separate repository rp-hal-boards 2022-12-10 13:06:23 +00:00
René van Dorst d7177345af
Add board waveshare-rp2040-lcd-0.96 (#513)
* Add board waveshare-rp2040-lcd-0.96

* Update product page links in readme
2022-12-10 13:10:08 +11:00
Jan Niehusmann 1c6a816182 Use generic boot loader for arduino nano connect
Fixes #503
2022-11-28 11:31:12 +00:00
Jan Niehusmann 0055dbaf87
Fix some clippy warnings flagged by current beta (#505)
* Fix some clippy warnings flagged by current beta

(One warning was just silenced because I consider the current code more readable)

* cargo fmt
2022-11-25 17:08:20 +00:00
Jan Niehusmann d1377acc19
Update dependencies on defmt-rtt to 0.4.0 (#504)
Version 0.3.0 depends on deprecated critical-section 0.2
2022-11-25 09:05:04 +00:00
TilCreator c5309f6a86
Add board waveshare-rp2040-zero (#500) 2022-11-17 08:53:00 +11:00
Jan Niehusmann 4c6600e036 Extend pico_usb_serial example with some string formatting 2022-10-30 17:24:08 +00:00
Thiébaud Weksteen 578657a829 Bump rp-pico version in README.md 2022-10-21 15:11:14 +11:00
Jan Niehusmann b81ad6f599 Use UartConfig::new constructor instead of common_configs in examples 2022-10-15 17:14:43 +00:00
Wilfried Chauveau eac51cdd16
remove unused future dependency (#463) 2022-10-06 21:39:48 +01:00
Wilfried Chauveau 305dfc9d1f
Add rtic-monotonic support for timer & alarms (feature gated) (#459)
* Add rtic-monotonic support for timer & alarms
* Force Alarm interrupt if timer is set too soon
* timer: Remove non_exhaustive attribute from ScheduleAlarmError
* timer: TooSoon is no longer emitted so it can be removed
2022-10-06 18:31:31 +01:00
9names 2d31d91ba1 Add rom-func-cache as a default feature in BSPs 2022-10-03 19:52:10 +11:00
9names 0cd990c3c1 Comment and pass-through HAL features in BSPs 2022-10-03 12:04:58 +11:00
Paul Daniel Faria 4f440d286d Update Servo 2040 board examples in README
Add the PWM Servo example to the readme.
Fix typo in rainbow animation.
Add images to boath examples showing working examples.
2022-09-21 18:00:37 +10:00
Paul Daniel Faria d3b0156269 Fix servo example in rp2040-servo, remove unusable aliases.
The servo example included phase correction, which does not work with the
provided divider. Updated comments to explain numbers and also explain
alternate calculation with phase correction enabled.

Remove unusable aliases from all servo pins. The board includes a 180 Ohm
resistor on all servo data pins, which makes the lines not very usable for
Spi, Uart or I2C. The aliases were removed given they will rarely, if ever,
be used with this board.
2022-09-21 18:00:37 +10:00
Jan Niehusmann fa83510277 Provide rp2040_hal::gpio::pin::Pin::into_push_pull_output_in_state 2022-09-17 13:31:11 +00:00
Paul Daniel Faria 19e2fbea1c
Add the Pimoroni Servo 2040 board (#450)
* Add the Pimoroni Servo 2040 board

This PR adds the board support package and two simple examples.
* Animates a rainbow wheel across the RGB LEDs on the board.
* Moves a servo that's connected to GPIO0 back and forth.

* Format pimoroni-servo2040 board files

* Use us_to_duty function in servo example, clean up comments.

* Fix bad types

* Add Servo2040 description to top-level readme
2022-09-17 12:04:16 +01:00
Wilfried Chauveau 4ddad4e74c
fix concurrent accesses to sm_execctrl and sm_instr when sideset isn't optional (#448)
* fix concurrent accesses to sm_execctrl and sm_instr when sideset isn't optional
* review & document unsafe blocks
2022-09-16 17:19:54 +01:00
Jan Niehusmann e681b67d9c
Merge pull request #444 from jannic/critical-section-default
Enable critical-section-impl by default only from board crates, not from hal
2022-09-02 12:12:45 +02:00
Wilfried Chauveau 5ce10ff94e
timer: Use a fixed type in Alarm::schedule (#442) 2022-08-31 21:45:08 +01:00
Wilfried Chauveau 4dbd5667a6
Use TimerInstant in Timer::GetCounter & add Alarm::schedule_at (#439) 2022-08-31 06:54:57 +01:00
Wilfried Chauveau 4ead633042
Revert "Make Pimoroni Badger 2040's crate name consistent with it's directory (#435)" (#437)
This reverts commit 1de8f9016d.
2022-08-26 12:15:17 +01:00
Wilfried Chauveau 1de8f9016d
Make Pimoroni Badger 2040's crate name consistent with it's directory (#435) 2022-08-26 10:49:43 +01:00
Wilfried Chauveau 8d52f37dd1
Prepare for HAL 0.6.0 release (#430)
* Prep for HAL 0.6.0 release

* Update changelog, readme and version number for HAL 0.5.0 release
* Bump HAL version in BSP deps
* Add the missing boards to the main README.md
2022-08-26 10:05:56 +01:00
Wilfried Chauveau 13cad64c29
remove unused dependencies & add GHA flow (#429) 2022-08-26 03:42:33 +01:00
Wilfried Chauveau 3261eccd4d
Fix interpolator example post migration to fugit (#434) 2022-08-26 02:32:24 +01:00
Kasil 31469c232f
Add support for the Interpolator (#371)
* Implementation of the interpolator.
* corrected formatting
* fixed documentation code
* add clamp flag to LaneCtrl
* addition of an example for the interpolator
* put documentation behind ///
* rewording comment for clarity
* using more idiomatic fn new
2022-08-25 18:02:56 +01:00
Wilfried Chauveau bf66ae9a58 Bump -pio dependencies 2022-08-24 22:46:34 +01:00
Wilfried Chauveau e5eda48891 bump pio version on boards still using pio 0.1.0 2022-08-24 22:46:34 +01:00
Wilfried Chauveau 93ec18be07 migrate rp2040-hal from embedded_time to fugit 2022-08-24 22:46:34 +01:00
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