Commit graph

606 commits

Author SHA1 Message Date
Jan Niehusmann 62f1ab2159
Merge pull request #411 from jannic/fix-usb-sie_status
Fix clearing usb sie_status flags
2022-08-03 10:20:08 +02:00
Jan Niehusmann b636afb7b5 Clear sie_status.suspended / sie_status.resume flags in poll()
usb_device ignores PollResult::Suspend when already suspended,
and PollResult::Resume when not suspended.

This may lead to repeatedly triggered interrupts if for some reason
the Suspend flag gets set while the device is already suspended.

I observed such a situation when a reset was triggered while the device
was suspended.

To make sure that this can't cause interrupt storms, clear the flags
before returning from poll()
2022-08-02 22:17:54 +00:00
Jan Niehusmann 786062aa74 To clear a bit in sie_status, just write that single bit 2022-08-02 22:11:14 +00: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
Jan Niehusmann fb9bac5064
Merge pull request #410 from ithinuel/bump-usb-device-to-0-2-9
bump usb-device to 0.2.9
2022-08-02 21:58:17 +02:00
Jan Niehusmann 1be329a907
Merge pull request #407 from FlorianUekermann/main
Implement NonPwmPinMode for gpio::Disabled
2022-08-02 21:46:18 +02:00
Wilfried Chauveau 60677df099
bump usb-device to 0.2.9 2022-08-02 20:43:00 +01:00
Jan Niehusmann 6dafcc1ac0
Merge pull request #405 from ithinuel/fix-usb-ep0-out
Fix usb missed ep0 out packet and add recommended sync delays
2022-08-01 15:32:45 +02:00
Florian Uekermann 03e791ab31 Implement NonPwmPinMode for gpio::Disabled
Fixes #397
2022-08-01 15:20:54 +02: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 b1fcb7eff8
Merge pull request #406 from ithinuel/add-suspend-and-remote-wakeup-support
Add suspend, resume and remote wakeup support.
2022-07-31 14:51:50 +02:00
Wilfried Chauveau 5dd095bd45
Add suspend, resume and remote wakeup support. 2022-07-30 20:51:01 +01:00
Wilfried Chauveau fa7c9275b4
Fix missed ep0-data-out transaction
The ep0-out buffer must not be marked as available unless required.
Otherwise, the controller will acknowledge the data-out packet but
won't reflect that in its status registers.

This patch forces the controller to nack the data-out phase until we have
processed the setup packet.
2022-07-30 10:09:20 +01:00
Wilfried Chauveau 067f1396d9
Add the required synchronisation delays
As per 4.1.2.5.1, the access to the DPSRAM should "be considered asynchronous
and not atomic".
It is recommended to write to buffer control register in two steps.
A first one to configure all bits but Available.
Wait clk_sys/clk_usb (typically 125MHz/48MHz).
Then set the available bit (if required).
2022-07-30 10:03:03 +01:00
Jan Niehusmann 6e325ba099
Remove unnecessary cortex_m::interrupt::free in timer.rs (#402)
The only thing accessed by those methods is `&mut self`, which is
guaranteed to be a unique reference. So an interrupt can not
interfere with the correctness of the operation.
2022-07-28 10:26:24 +10:00
9names c7acafda3c
GPIO IRQ example: add check for interrupt source (#401) 2022-07-28 10:14:20 +10:00
Jan Niehusmann 96552b28c5
Merge pull request #399 from jannic/issue_390
Fix handling of duty cycle while PWM channels is disabled
2022-07-26 15:09:16 +02:00
Jan Niehusmann c0c72c4db3 Fix handling of duty cycle while PWM channels is disabled
Fixes #390
2022-07-26 08:22:53 +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