Commit graph

384 commits

Author SHA1 Message Date
Mathias Gottschlag 2fc42e07f2 pio: Rename read_rx/write_tx to read/write. 2021-10-01 08:47:16 +02:00
Mathias Gottschlag 207f5aebdb pio: Split RX and TX FIFO functions into different types.
We need separate types for any blocking or DMA operations - otherwise, it
would not be possible to perform both RX and TX transfers at the same time.
2021-09-30 09:07:15 +02:00
Mathias Gottschlag dbe7f48699 pio: Identify state machines via generic parameters.
Eventually, the read and write FIFOs need to be split into separate
objects for DMA. To be able to safely rejoin them only when they belong to
the same state machine, the state machine index needs to be encoded into
the type.
2021-09-29 21:42:05 +02:00
Mathias Gottschlag 64fa8441d8 pio: Fix bugs spotted in the review. 2021-09-29 20:55:24 +02:00
Mathias Gottschlag 684f483859 pio: Improve documentation and add an example that uses pio_proc::pio!(). 2021-09-28 21:48:05 +02:00
Mathias Gottschlag 515eac5553 pio: Differentiate between uninitialized/stopped/running state machines.
Some operations must only be performed in a specific state. For example,
pin directions must not be changed while the state machine is running, as
the operation modifies PINCTRL. The new API makes wrong usage a lot harder.

Also, the code now supports uninitializing state machines to free
instruction space or to select a different function.
2021-09-28 21:15:28 +02:00
Mathias Gottschlag 4d97d9fe75 pio: Enable code sharing between SMs via objects for installed programs.
Multiple state machines may want to execute the same program (e.g., two
state machines are used to implement two I2C buses), in which code sharing
saves space.
2021-09-28 20:27:40 +02:00
Mathias Gottschlag 959f714fb9 pio: Fix marking used instruction space. 2021-09-28 20:27:40 +02:00
Mathias Gottschlag 2ff9ae156f pio: Fix some doc comments. 2021-09-28 20:27:40 +02:00
Mathias Gottschlag e5a7c325b0 pio: Split PIO into multiple objects that can be moved around separately.
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.
2021-09-28 20:27:22 +02:00
Jonathan Pallant da89888ccb
Merge pull request #137 from 42-technology-ltd/ensure-hal-examples-non-board-specific
Working on README and examples
2021-09-28 10:46:42 +01:00
Jonathan Pallant (42 Technology) fc0075a381 Addressing review comments. 2021-09-28 09:26:31 +01:00
Jonathan Pallant (42 Technology) 0beedde69b Ugh. Thanks, rustfmt. 2021-09-27 19:03:07 +01:00
Jonathan Pallant (42 Technology) d251627e47 Make trait comments more consistent. 2021-09-27 19:01:46 +01:00
Jonathan Pallant (42 Technology) 8876159687 Ah, rustfmt. 2021-09-27 18:58:16 +01:00
Jonathan Pallant (42 Technology) c04f439020 Polish the watchdog example. 2021-09-27 18:57:19 +01:00
Jonathan Pallant (42 Technology) b005128a73 Oh, make sure uart example actually builds. 2021-09-27 18:57:10 +01:00
Jonathan Pallant (42 Technology) 7e03772687 Polish the UART example. 2021-09-27 18:52:13 +01:00
Jonathan Pallant (42 Technology) b894ab9ce7 Cleaning up. 2021-09-27 18:43:01 +01:00
Jonathan Pallant (42 Technology) 225eabb449 Use peripheral clock to describe the clock signal given to peripherals. 2021-09-27 18:42:36 +01:00
Jonathan Pallant (42 Technology) 17afa25d2a Polish PWM blink example. 2021-09-27 18:37:29 +01:00
Jonathan Pallant (42 Technology) b370bb5270 Polish SPI example. 2021-09-27 18:37:20 +01:00
Jonathan Pallant (42 Technology) 0336458344 Update LCD example. 2021-09-27 18:14:54 +01:00
Jonathan Pallant (42 Technology) b7acc7c373 Polish I2C example. 2021-09-27 17:30:29 +01:00
Jonathan Pallant (42 Technology) 193972bb9f Polish GPIO example. 2021-09-27 17:30:18 +01:00
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 77787e760d
Merge pull request #133 from jannic/pio-blinky-example
Add a simple example for PIO.
2021-09-27 15:35:26 +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 fbe2a8834f Update comment on top of pio_blink.rs 2021-09-27 12:36:23 +00:00
Jan Niehusmann c93ea0b97c Update comments in examples/pio_blink.rs 2021-09-26 13:51:48 +00: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
Jan Niehusmann b79f859d72 Add a simple example for PIO. 2021-09-25 13:22:13 +00: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
Jonathan Nilsson 1bf47df553 Deny warnings in ci 2021-07-25 02:17:43 +10:00
Jonathan Nilsson 077cba68f5
I2C (#56)
* I2C implementation based on C SDK

* Basic I2C Example
2021-07-25 02:16:07 +10:00
Marcuss2 a02c8131ff
Add HD44780 example (#60)
* Added HD44780 lcd example

* Formatting lcd_display.rs

* Formatting Cargo.toml

* Fixed import formatting issue

* Fixed line with spaces
2021-07-23 18:37:36 +10:00
Hmvp f310d92b64
Refactor clocks (#54)
* Remove unneeded lines

* Reduce macro boilerplate

* Refactor clocks
2021-07-08 20:58:48 +10:00
9names d2aa2b238d Run pwm.rs and pwm_blink.rs through cargo-fmt 2021-07-07 23:55:45 +10:00
Tyler Stowell f87d7ba768
PWM implementation (#44)
* 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.
2021-07-07 23:44:57 +10:00
Hmvp 17e65c4fd5
Initial ADC impl (#52)
* Initial ADC + temp sensor support
2021-07-07 23:38:25 +10:00
Andrea Nall 17f8a5ab99
Add 'rt' feature (#53)
For the HAL, currently just passes the feature to the PAC.

Also pass the 'rt' feature through to the HAL for all the BSP crates.
2021-07-07 19:33:36 +10:00
Hmvp 614180eda3
Clock init (#49)
Add preliminary clock init function
2021-07-07 01:30:44 +10:00
Hmvp 1c6a336104
Spi (#50)
Add SPI support to the HAL
2021-07-06 09:42:05 +10:00
Andrea Nall 711c0230b1 fix minor issues 2021-07-03 10:32:43 +10:00
Andrea Nall e3be4f8025 Massive GPIO refactor
Bring in line with atsamd-hal GPIO v2

Copied as much as possible. Docs lifted mostly as-is.

Also add sample BSP for the Feather RP2040 in boards/feather_rp2040

May include a few random fixes from currently futile attempt to get doctests working.
2021-07-03 10:32:43 +10:00
Andrea Nall 71a7057b76 split rom_data into safe and unsafe functions 2021-06-29 19:36:19 +10:00
Hmvp e7c2ef39c4 Add missing clocks
Also reorderd the macro invocations to match the datasheet
2021-06-29 19:35:08 +10:00
Hmvp 6edfc60960 Fix gpio docs
The sio argument does not work with a bare pac SIO struct
2021-06-28 23:18:22 +10:00
Andrea Nall 90a6f8414d fix clippy, run fmt 2021-06-27 14:50:06 +10:00
Nic0w 0d19834b2e Change all write to modify 2021-06-27 14:50:06 +10:00
Nic0w 4220b45c24 Cargo fmt 2021-06-27 14:50:06 +10:00
Nic0w ef7f8fe9b7 Initial commit on clocks 2021-06-27 14:50:06 +10:00
jspaulsen c4cd2ffe52 Add documentation to public functions and struct, fix logic issue with max period 2021-06-25 18:18:07 +10:00
jspaulsen c568f0d3df Panic if period exceeds maximum value, fmt 2021-06-25 18:18:07 +10:00
jspaulsen cdd9a553ad Add pause_on_debug, disable watchdog prior to enabling 2021-06-25 18:18:07 +10:00
jspaulsen fe72637972 Fix logic issue with delay_ms 2021-06-25 18:18:07 +10:00
jspaulsen 596bea309b Initial watchdog implementation 2021-06-25 18:18:07 +10:00
Rudo a14cbb5819
Hardware divide/modulo support (#40)
* Initial SIO div/mod implementation
* Implement signed/unsigned methods for HwDivider
2021-05-29 22:26:49 +10:00
Andrea Nall 8d0fde20c6 Add SubsystemReset trait to handle subsystem resets
dd a `SubsystemReset` trait which adds a `reset_bring_up` function to the
relevant PAC types to handle bringing subsystems out of reset.

Also, correct that the PLL and UART modules did not bring the relevant
subsystems out of reset and refactor the GPIO module to use the
SubsystemReset trait.
2021-05-16 13:12:26 -05:00
Andrea Nall 35464a1c4b typo fix, rustfmt 2021-05-10 08:29:59 -05:00
Andrea Nall 2ef1343c05 add module to manage ownership of parts of SIO 2021-05-09 22:33:36 -05:00
9names 877c967466
Merge pull request #28 from Nic0w/uart
Working implementation of an UART HAL.
2021-05-09 18:07:05 +10:00
9names c5da7659c9
Merge pull request #27 from Nic0w/pll
Working HAL for PLLs
2021-05-09 17:59:27 +10:00
Nic0w 9b082b012d Clippy, second pass for errors in CI. 2021-05-09 09:53:22 +02:00
Nic0w a663b1f552 Clippy, second pass for errors in CI. 2021-05-09 09:42:31 +02:00
Nic0w e18111d564 Merge branch 'uart' of github.com:Nic0w/rp-hal into uart 2021-05-05 08:10:34 +02:00
Nic0w 020c9d9a3d cargo clippy & fmt 2021-05-05 08:06:47 +02:00
Nic0w c35358f475 Change comment on baudrate calculation 2021-05-05 08:02:53 +02:00
Nic0w 64dee52dd5 Satisfies clippy 2021-05-05 07:55:51 +02:00
9names 72127aa8e7
Remove duplicate entry in Cargo.toml
Remove accidental duplication of embedded-time dependency introduced when performing merge-conflict resolution
2021-05-05 12:48:40 +10:00
9names 31b0230da1
Merge branch 'main' into uart 2021-05-05 12:46:06 +10:00
9names d26e13c5ef
Merge branch 'main' into basic-gpio 2021-05-05 08:23:03 +10:00
Nic0w 8586f98c02 Better comments and renamed variable names for more clarity. 2021-05-04 22:16:04 +02:00
Nic0w be78a5c792 Consistency re. clear_bit/set_bit. 2021-05-04 19:56:36 +02:00
Nic0w ac2af7582e Pulling the integer out of the frequency first. 2021-05-04 19:54:15 +02:00
Nic0w d9b1b2b1ec Fix comments on {read,write}_raw() functions 2021-05-04 19:48:40 +02:00
9names 416baf6405 Add #Safety tag to unsafe rationale docstring 2021-05-04 18:08:06 +10:00
9names 7588f76844
Merge branch 'main' into basic-gpio 2021-05-04 16:35:46 +10:00
Nic0w 8d29464ee3 Propagate read errors. 2021-05-02 09:04:05 +02:00
Nic0w 992bcdf47b Cargo fmt 2021-05-02 08:42:51 +02:00
Nic0w abf91a3687 Move serial traits impl. back to uart.rs 2021-05-02 08:41:20 +02:00
Nic0w 835ad7a5c1 Read errors. 2021-05-02 08:27:29 +02:00
Nic0w 5620bdbd07 Move checks in new() so initialize() cannot fail. 2021-04-29 21:06:11 +02:00
Nic0w eb4ebc782a Cargo fmt pass. 2021-04-29 20:35:47 +02:00
Nic0w e91e124484 Merge branch 'pll' of github.com:Nic0w/rp-hal into pll 2021-04-29 20:21:02 +02:00
Nic0w eb376cf47b Using modify() to clear specific bits instead of a blanket 0 on all bits. 2021-04-29 20:16:52 +02:00
Nic0w 5726bef879 Fix typo on post_div check
Co-authored-by: tdittr <tdittr@users.noreply.github.com>
2021-04-29 20:16:52 +02:00
Nic0w 20c35d5e14 Fix type conversion issue 2021-04-29 20:16:52 +02:00
Nic0w 649998189f Move PLL parameters into a struct to help testability and reconfiguration of the PLL. 2021-04-29 20:16:52 +02:00
Nic0w 9be7c41400 Working implementation of a PLL HAL. 2021-04-29 20:16:52 +02:00
9names 010a5cabf3 Remove redundant field name 2021-04-29 11:19:47 +10:00
9names f21648de93 Autoformatted using cargo fmt 2021-04-29 11:15:41 +10:00
9names 1b42913077 Remove unneeded unsafe 2021-04-29 11:11:11 +10:00
9names 3bdc338a0d
Merge pull request #29 from tdittr/feature/doc-tests-in-ci
Add `cargo test` to CI run and fix an error found by it
2021-04-28 14:02:07 +10:00
9names f728de5efb
Merge pull request #25 from Nic0w/xosc
Working HAL for the XOSC
2021-04-28 14:01:10 +10:00
tdittr 39f02c4a44 Add cargo test to CI run and fix an error found by it
Besides the normal usage of unit-tests this also ensures that
example in doc-comments do at least compile.
2021-04-27 12:08:47 +02:00
Nic0w f3fba80a71 Implement embedded_hal::serial traits for the UART. 2021-04-26 22:05:37 +02:00
Nic0w 50a428e2ad Error needs to derive Debug if we want to unwrap. 2021-04-26 21:25:52 +02:00
Jennifer Wilcox 0ff51520f5 Merge branch 'main' of github.com:rp-rs/rp-hal into basic-gpio 2021-04-26 11:57:19 -05:00
Nic0w 920d0dc897 Merge branch 'uart' of github.com:Nic0w/rp-hal into uart 2021-04-26 09:20:22 +02:00
Nic0w 4d949f7310 Multiple changes addressing @tdittr 's comments. 2021-04-26 09:14:32 +02:00
Nic0w aa3fe8fd20 Disable the UART for real when disabling UART. 2021-04-25 20:25:29 +02:00
Nic0w c50a5b6001 Cosmetics. 2021-04-25 20:24:56 +02:00
Nic0w f9254fdffa
Increment byte_written after write has happened.
Co-authored-by: tdittr <tdittr@users.noreply.github.com>
2021-04-25 20:00:56 +02:00
Nic0w 2462c430b9
Fix typo on post_div check
Co-authored-by: tdittr <tdittr@users.noreply.github.com>
2021-04-25 19:48:09 +02:00
Nic0w c3bc1bbaf8 Fix type conversion issue 2021-04-25 19:45:45 +02:00
Jennifer Wilcox c4ae152fda
Update rp2040-hal/src/gpio.rs
Co-authored-by: tdittr <tdittr@users.noreply.github.com>
2021-04-25 12:17:05 -05:00
Jennifer Wilcox eaea9ae1ed Concentrate the unsafe register constructs
This moves almost all of the unsafe stuff together. The last remaining bit is going to need a PAC fix.
2021-04-25 12:13:44 -05:00
Jennifer Wilcox 8290368c10 Pull pads out of reset and wait
We're technically supposed to wait for these resets to finish before poking at registers. This seems to fix the instability I was seeing on the input example especially (TBH I have no idea how it ever worked)
2021-04-25 11:43:44 -05:00
Jennifer Wilcox 7e45c96a65 Do reset in a good way instead of a wacky way 2021-04-25 11:17:33 -05:00
Jennifer Wilcox b3b7677f82 More review comments 2021-04-25 11:13:21 -05:00
Nic0w 6157ce552f Move PLL parameters into a struct to help testability and reconfiguration of the PLL. 2021-04-25 17:51:03 +02:00
Jennifer Wilcox 037fc665b2
Apply suggestions from code review
Co-authored-by: tdittr <tdittr@users.noreply.github.com>
2021-04-25 10:15:32 -05:00
Nic0w 2a704a73f0 Adding blocking helper method to setup the XOSC easily. 2021-04-25 16:34:48 +02:00
Nic0w b9080d0a92 Working implementation of an UART HAL. 2021-04-25 10:51:46 +02:00
Nic0w ff418b0453 Working implementation of a PLL HAL. 2021-04-25 10:12:38 +02:00
Nic0w 8f6aea6a31 Fix compilation issues. 2021-04-25 09:03:20 +02:00
Nic0w 72694a07b5 Fix frequency range check. 2021-04-25 08:58:43 +02:00
Jennifer Wilcox 422a45fbc5 Add documentation 2021-04-24 18:41:12 -05:00
Jennifer Wilcox 94f67f7eca Finish configuration options for IOs 2021-04-24 18:03:03 -05:00
Nic0w d5cbd44ade Fixing calculation bug pointed out by @tdittr 2021-04-25 00:36:46 +02:00
Jennifer Wilcox 3536604b9e Block input reads on Unknown state 2021-04-24 17:28:33 -05:00
Nic0w 568cafe2d1 Multiple changes related to @tdittr 's comments 2021-04-24 23:38:49 +02:00
Jennifer Wilcox 2e5c1fc0e3 Cleanup wacky imports in examples 2021-04-24 16:22:27 -05:00
Jennifer Wilcox 2c3a0956fa Add input support, examples, SIO/PADS ownership
Sorry this is a large commit :(

This adds support for input pins, including pulling them high or low.

It also adds two examples: the start of a classic blinky LED example, and an example for reading input.
2021-04-24 16:18:57 -05:00
Nic0w ed1e847618 Remove line as it builds fine without it. 2021-04-24 22:26:26 +02:00
Nic0w d0d9291cde Working HAL for the XOSC 2021-04-24 13:38:17 +02:00
Jennifer Wilcox 45580ec4c8 Add basic output support for GPIOs 2021-04-17 18:22:15 -05:00
Jennifer Wilcox d318d05067 Run cargo fmt 2021-04-17 14:11:47 -05:00
Jan Niehusmann 5494ce7539 rom function git_revision() does return an u32, not a &str 2021-02-15 23:28:13 +00:00
Jan Niehusmann d6231bd3ec fix rom_table_lookup
It seems like the rom_table_lookup missed one level of
pointer dereferencing.

After comparing it to the working call to reset_usb_boot() in
https://github.com/jannic/rp-microcontroller-rs/blob/master/util/rp2040-panic-usb-boot/src/lib.rs,
I changed the code until it generated basically the same assembly.

With that change, I was able to successfully call rom_data::reset_to_usb_boot()

I still don't like the type RomTableLookupFn, which just returns
some generic T without any checks, and I think rom_table_lookup
should be unsafe. But as none of those are pub, it doesn't matter too
much. So I just made the changes necessary to make the code work.
2021-02-15 22:16:43 +00:00
Asaf Fisher 913c5fb0b2 rom: Fix type error 2021-02-03 21:49:48 +02:00
Asaf Fisher 1848789ca3 rom: Make rom_funcs functions call function instead of returning it 2021-02-03 21:43:14 +02:00
Asaf Fisher a9a8df8c79 rom: Add comments to rom content 2021-02-03 15:57:44 +02:00
Asaf Fisher 6eccce595c rom: Change rom_table_lookup to use the rom's built in one 2021-02-03 15:57:44 +02:00
Gus Caplan 1c75ed3844 rom: Add rom content 2021-02-03 03:10:00 +02:00
evan 98baabec93 Added skeleton for HAL and updated readme 2021-01-25 15:42:43 -05:00
evan 22a3669a9d Initial Commit: Updated author information. 2021-01-22 09:18:12 -05:00