One PIO block often implements multiple functions that are used in
different parts of the codebase. Previously, that would be impossible, as
PIO contained all StateMachine instances.
Now, StateMachine instances use atomic operations whenever accessing shared
registers, so they can be used concurrently.
Implement rand_core::RngCore for RingOscillator from the get_random_bit
function. This is not suitable for security purposes so
rand_core::CryptoRng has not been implemented.
* Implement GPIO override
Interrupt status, input, output enable and output can be overridden.
See documentation for GPIO0_CTRL.
* Fix override enum names
* Use override_value instead of raw identifier
Set interrupt enable flags in USB driver. The flags were already being cleared in the USB driver.
Update USB examples to remove interrupt flag set/check as it is no longer necessary.
Initial implementation of PIO
Add all of the infrastructure required to include PIO programs and interact with PIO peripheral registers.
This was a massive effort between @devsnek and @henkkuli. It's great that it's now ready to go.
Co-authored-by: Gus Caplan <me@gus.host>
Implement usb_device for rp2040
Limitations
- RP2040-E5 (Device enumeration workaround) is not implemented
- Suspend/resume is not implemented
- VBus detection is not tested and may not be fully implemented
Fix: The divider for watchdog tick generation is now being set to the
source clock frequency in MHz, instead of the clock frequency in Hz.
Watchdog ticks will now be generated at 1 microsecond intervals
as intended.
* Add standalone UART example
* Add UART example to docs in UART module
* Add core::fmt::write_str to UART module to allow easy use of format! macro in user code
The newer version of svd2rust used in the PAC marks write_with_zero calls as unsafe, where the old one did not.
This PR wraps the only 2 calls instances of this in the HAL with unsafe blocks to fix the compile errors.
* Improve clock frequency stuff for uninitialized clocks
- Made clocks singletons so the frequency handling actually works as expected
- Added initial frequencies
- Improved the docs
- Added a Clock trait
* Add pico examples.
These have the benefit of knowing which external crystal is attached.
Even though it always should be a 12 MHz crystal.
Thus we can setup the clocks properly
I also changed the rp2040 examples to work out of the box for pico boards since that will probably be used most of the time
* PWM functionality
* Updated prelude.rs
* Added example, cleaned up the PWM HAL.
* Renamed a file for clarity
* Changes to address C-CTOR recommendations, only 8 PWM channels, restructuring
* Forgot to remove a test function, and added a quick comment.
* Cleaned up code now that PWM channels are clustered in the PAC.