Commit graph

453 commits

Author SHA1 Message Date
Jan Niehusmann e9923cbcd2 Use InstalledProgram::share() in examples/pio_synchronized.rs 2022-10-11 21:04:04 +00:00
Derek Hageman 39190c357f
Fix watchdog counter load (#464)
Fix the watchdog load to reflect the 1us tick rate.  This was changed
in #361, which presumably used the field name (delay_ms) and assumed
it was in milliseconds.  So this also fixes the name to reflect that
it's microseconds.
2022-10-10 12:15:24 +01: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 fc110f07c3 Add comments for HAL features 2022-10-03 11:43:09 +11:00
Jan Niehusmann d5bfb0ca8d Fix typo in changelog 2022-09-30 16:53:37 +00:00
Jan Niehusmann 819f051cc2 Update changelog 2022-09-28 21:59:09 +00:00
Jan Niehusmann fcd6f7c19d Remove unnecessary custom Infallible types 2022-09-28 21:59:09 +00:00
Jan Niehusmann e4deaabb51 Upgraded embedded-hal alpha dependency to 1.0.0-alpha.9
For now, disabled non-blocking implementations.
2022-09-28 21:59:09 +00:00
Jan Niehusmann 8d9b4538c9
Merge pull request #453 from jannic/update-jmp-offset
simplify jump offset calculation when loading PIO programs
2022-09-27 22:25:22 +02:00
Olivier 69c047136c added SPI is_busy function 2022-09-19 15:27:46 +02:00
Jan Niehusmann 6a5747b213 Use u8 instead of usize for pio address calculation 2022-09-18 10:48:09 +00:00
Jan Niehusmann 7cca9a71d7 simplify jump offset calculation when loading PIO programs 2022-09-17 17:22:34 +00:00
Jan Niehusmann fa83510277 Provide rp2040_hal::gpio::pin::Pin::into_push_pull_output_in_state 2022-09-17 13:31:11 +00:00
Jan Niehusmann cbed25944a
Merge pull request #449 from papyDoctor/main
Added set_fifos/set_rx_watermark/set_tx_watermark
2022-09-17 10:25:52 +02: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
Wilfried Chauveau 322bba2cc0
pio: Move interrupt related (en|dis)abling/forcing methods to the statemachine (#447)
* pio: Move interrupt related (en|dis)abling/forcing methods to the statemachine

The SM knows its id using the type system so there's no need for checking it.
This commit also adds a `PioIRQ` enum to select the output IRQ.

* Move the interrupt control to Rx & Tx and make all accesses to inte atomic
* Adjust the ergonomics of IRQ handling.
* Elide lifetimes where they can be (clippy's advice)
2022-09-14 21:07:03 +01:00
Wilfried Chauveau 42fc266e67
timer: Mark Timer & Alarm* Send and Sync (#451) 2022-09-14 21:06:08 +01:00
Olivier b29cc2630c Added set_fifos/set_rx_watermark/set_tx_watermark
that permit to enable/disable the Rx/Tx FIFOs and to set
the watermarks for the DMA/interrupts triggering
2022-09-12 17:06:27 +02: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 39ffe70dab
Use rp2040_boot2::BOOT_LOADER_GENERIC_03H in the vector-table example (#445) 2022-09-02 08:02:34 +01:00
A. Gavin 993487443a
examples: clarify usage of boot2 section (#443) 2022-09-02 06:38:58 +01:00
Wilfried Chauveau 5ce10ff94e
timer: Use a fixed type in Alarm::schedule (#442) 2022-08-31 21:45:08 +01:00
Wilfried Chauveau 0e2b4cf7be
Add a method to allow setting the PIO's clock divisor without floats (#440)
* pio: Changes `PIOBuilder::clock_divisor` from f32 to fixed point)
* pio: mark clock_divisor as deprecated
2022-08-31 21:44:53 +01:00
Wilfried Chauveau 6d75cd8291
usb: Use the dedicated write_bitmask_* functions (#441) 2022-08-31 13:41:35 +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 f30df4a0c7
doc: Fix the link under the logo in rp2040-hal's readme (#438) 2022-08-26 12:15:24 +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 dbc691fb09
Temporary disable sticky-bit in set_pins too (#433) 2022-08-25 18:19:01 +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
Jan Niehusmann 00f5e8d184
Merge pull request #432 from jannic/fix-set_pindirs
Temporarily disable out_sticky in set_pindirs
2022-08-25 12:02:55 +02:00
Jan Niehusmann 6b0ea14ec1 Temporarily disable out_sticky in set_pindirs
Otherwise, it will change unrelated pindirs as well, if sticky is set
2022-08-25 07:49:59 +00:00
Wilfried Chauveau 47d8f4fc21
Add Debug and defmt::Format to the public types of rp2040_hal::gpio::dynpin (#431) 2022-08-25 05:54:26 +01:00
Wilfried Chauveau 93ec18be07 migrate rp2040-hal from embedded_time to fugit 2022-08-24 22:46:34 +01:00
Wilfried Chauveau 6a29b3bb73 Make the i2c error render as text if eh1_0_alpha is on. 2022-08-24 18:23:16 +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
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
camrbuss fea35b48bb doc: fix clocks extended usage xosc order 2022-08-21 02:51:53 -04:00
Jan Niehusmann c1c5e05989 Feature-gate critical-section-impl
For compatibility with earlier versions, this feature is activated by
default. This decision can be revisited later.
2022-08-18 06:35:04 +00:00
Jan Niehusmann b4d0d613e3 Update to critical-section 1.0.0 2022-08-18 06:34:28 +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
Jan Niehusmann c1df2bea2b Fix clippy warnings
Fixes a few instances of derive-partial-eq-without-eq and needless-borrow
clippy warnings.
2022-08-11 21:45:26 +00:00
Jan Niehusmann 96e15ee6de
Merge pull request #415 from jannic/features-vector_table
Enable feature "rt" when compiling vector_table example
2022-08-11 19:21:07 +02:00
Jan Niehusmann 0f33d2b8a6 Enable feature "rt" when compiling vector_table example
Without this change, building the vector_table example fails when
building from the rp2040-hal directory:

```
rp2040-hal$ cargo build --release --example vector_table
   Compiling rp2040-hal v0.5.0 (rp2040-hal)
error[E0432]: unresolved import `pac::interrupt`
  --> rp2040-hal/examples/vector_table.rs:30:5
   |
30 | use pac::interrupt;
   |     ^^^^^---------
   |     |    |
   |     |    help: a similar name exists in the module (notice the capitalization): `Interrupt`
   |     no `interrupt` in the root

error: cannot determine resolution for the attribute macro `interrupt`
   --> rp2040-hal/examples/vector_table.rs:148:3
    |
148 | #[interrupt]
    |   ^^^^^^^^^
    |
    = note: import resolution is stuck, try simplifying macro imports
```
2022-08-11 12:09:20 +00:00
Jan Niehusmann d4743061fa Use generic boot loader for rp2040-hal examples
Those examples should be independent of a specific board.
The generic boot loader increases their compatibility.
2022-08-11 11:56:41 +00:00
9names 2bbc52ffce
RAM-based interrupt vector tables (#321)
* Add struct VectorTable to represent an interrupt vector table

* Add member function to VectorTable to initialise based on the current Interrupt Vector Table from VTOR

* Add member function to VectorTable to register an extern "C" function to call on interrupt

* Add example using VectorTable to demonstrate initialisation and interrupt function registration
2022-08-06 14:58:43 +10: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 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