Commit graph

155 commits

Author SHA1 Message Date
Jonathan Pallant (42 Technology) d5a07bc398 Remove hard coded clock speed from blink example. 2021-09-27 17:30:06 +01:00
Jonathan Pallant (42 Technology) 07c183a636 Remove hard coded clock speed from ADC example. 2021-09-27 17:29:50 +01:00
Jonathan Pallant (42 Technology) b0bcbe68d8 Update blinky example. 2021-09-27 14:47:25 +01:00
Jonathan Pallant (42 Technology) ed27dc9949 Update ADC example. 2021-09-27 14:42:19 +01:00
Jonathan Pallant (42 Technology) 0fa6bf9e0e README updates.
Trying to clarify what is HAL specific and what is RP specific.
2021-09-27 14:32:11 +01:00
Jan Niehusmann 105dcfddd7
Implement bus keep inputs, as documented in C SDK (#134)
When both pull-up and pull-down are enabled, the RP2040 enters a
so-called "bus keep" function, which uses a weak pull to tue current
high/low state of the GPIO.

See for example
https://raspberrypi.github.io/pico-sdk-doxygen/group__hardware__gpio.html#gab6bf9552da32b3dd0a5d0db45d8374fc
2021-09-26 23:38:07 +10:00
Rob Young d93c4fc4c8
Implement RngCore for RingOscillator (#135)
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.
2021-09-26 20:51:01 +10:00
9names b0c15ccc77
Update changelog and bump verson for hal release 0.3.0 (#121)
* Update CHANGELOG.md and Cargo.toml for release 0.3.0

* Bump BSP hal dep version
2021-09-22 20:43:30 +10:00
Jonathan Nilsson be4a7e0498
Make Spi::set_baudrate public (#116) 2021-09-22 20:41:21 +10:00
Jonathan Pallant (42 Technology) 3e036cf9b0 Polishing the blinky examples. 2021-09-21 10:03:47 +01:00
Henrik Lievonen 904b6f0ab9
Implement GPIO override (#123)
* 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
2021-09-20 19:38:12 +10:00
Henrik Lievonen 25e477b73e
Fix PWM set/clr_inverted (#122) 2021-09-20 12:20:42 +10:00
9names ac7a17f6e1
Add doc example for i2c (#112) 2021-09-19 22:34:11 +10:00
9names 0942a170f1
Add basic SPI example (#113) 2021-09-19 22:33:36 +10:00
Wilfried Chauveau 1d5dd15092 Work around enumeration issues with small ep0 max packet size.
Prevents DataIn of the previous request from being sent to the host when
a new setup is received.
2021-09-19 22:27:17 +10:00
9names 98b8e3ae9c
Handle usb interrupt flags in driver (#106)
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.
2021-09-17 09:40:10 +10:00
Wilfried Chauveau c509b9d22f
Add embedded_hal::timer support (#110)
* Add embedded_hal::timer support

* fixup: add pico countdown based blinky example & rework get_counter(&self) -> u16
2021-09-16 18:47:34 +10:00
Gus Caplan 833b69819e use pio instruction encoding apis 2021-09-16 17:40:25 +10:00
Jonathan Nilsson b399c96cf5
Fixed u8 overflow in spi with large postdiv (#111) 2021-09-16 10:12:58 +10:00
Henrik Lievonen d941f5637b
PIO support (#74)
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>
2021-09-16 00:32:00 +10:00
Jonathan Nilsson 8a42d6cf8a
Update pac so we can use rt 0.7 (#107)
* Update pac so we can use rt 0.7

* Update pac in all board crates
2021-09-15 15:07:25 +10:00
9names 7afa19a82b
Usb fixes (#104)
* Remove check for ep0 buffer.len == 64

* Simplify EP buffer check
2021-09-11 18:31:45 +10:00
Jonathan Nilsson 0e5d582363 Fix adc giving wrong values on sequential reads of multiple channels 2021-09-10 20:34:24 +10:00
Wilfried Chauveau db11231f49
Implement usb_device for rp2040 (#98)
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
2021-09-09 17:55:30 +10:00
9names 9d2e18dc70
Add ADC example and doc-example (#93) 2021-09-02 22:40:13 +10:00
9names 301281cba8
i2c lockup fix (#94)
* Fix check for empty tx-fifo

* Add read trait

* Move from asserts to Err for read/write errors
2021-09-02 22:34:12 +10:00
Hmvp ffa39f65f5
Pwm improvements (#61)
* Reimplement PWM driver using typestates
* Improve docs
2021-09-02 09:37:17 +10:00
Hmvp 216aad2c76 Update and move readmes
The READMEs that go to crates.io need to be in the crate dir
2021-08-26 00:18:55 +10:00
Jonathan 'theJPster' Pallant db7217192a
Merge pull request #96 from 9names/gpio-doc
Add doc example for gpio
2021-08-23 22:31:36 +01:00
9names 4c38af0079 Add doc-example to gpio 2021-08-23 23:15:20 +10:00
Jonathan 'theJPster' Pallant ee5e6ee1cb
Merge pull request #90 from 9names/i2c-hacks
I2c fixes
2021-08-21 19:43:04 +01:00
9names fae1caaca9
Watchdog example (#86)
* Add watchdog example

* Add watchdog doc-example

* Add changes to the change log
2021-08-21 21:05:55 +10:00
9names 151b754d90 Remove setting fields set by default() 2021-08-21 15:17:51 +10:00
9names 021221ede3 Switch the modify where C SDK does 2021-08-21 02:16:25 +10:00
9names 31b9aa85d1 Ensure only pull-up or pull-down is enabled 2021-08-21 02:09:26 +10:00
9names e00a432ed5 Enable internal pullups for i2c 2021-08-21 02:07:56 +10:00
9names dbcaf1933a Fix limits on acceptable ranges 2021-08-21 01:47:11 +10:00
9names 50dbb8a22f Fix transposed variable names 2021-08-21 01:46:39 +10:00
Gus Caplan 04424fb7d4 implement timer counter 2021-08-15 12:42:56 +10:00
Hmvp d4ec87b2f7 Prepare for first release 2021-08-14 20:03:02 +10:00
Hmvp bfe6903751 Correct clobbering registers in pwm subsystem 2021-08-14 18:49:14 +10:00
Hmvp d3cb29b113
Fix doc examples and add checking (#76)
* Fix doc examples for peripheral drivers
* Add no_run to doc examples so they can be built by CI
* Enable building doc examples in CI check workflow
2021-08-11 10:53:42 +10:00
Derek Witt a03052355e
Correctly configure watchdog tick generation (#78)
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.
2021-08-09 13:47:50 +10:00
9names 369ac5a23f
Add UART example + core::fmt support to UART (#73)
* 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
2021-08-08 15:36:56 +10:00
Rudo2204 2d1086915c Fix unsigned hardware divide/modulo 2021-07-30 10:50:58 +10:00
Hmvp bcfbd72ed1 Update embedded time 2021-07-27 09:41:03 +10:00
9names 512172179a
Add unsafe blocks around write_with_zero calls (#68)
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.
2021-07-27 09:31:19 +10:00
Hmvp 4970075974 Also clippy check examples 2021-07-26 20:37:08 +10:00
Hmvp ffa97842e2
Improve clock frequency stuff for uninitialized clocks and add some examples (#64)
* 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
2021-07-26 20:24:58 +10:00
Jonathan Nilsson 148cc2b8ea Warn missing docs, deny in ci 2021-07-25 02:17:43 +10:00