Commit graph

355 commits

Author SHA1 Message Date
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) 49ad970d31 Typo: micontroller 2021-09-28 10:05:25 +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) c531eb976e Say nothing about the default input clock frequency - it's given! 2021-09-27 18:37:59 +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) 29dd755b30 Ensure the bootloader static gets documented. 2021-09-27 17:30:50 +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 (42 Technology) b3b0c0c63a Add picotool to README 2021-09-27 16:26:57 +01:00
Jonathan Pallant (42 Technology) 02ea5a4ac8 Link to pio-rs 2021-09-27 16:26:09 +01:00
Jonathan Pallant (42 Technology) 6d014328ed Expand on page title a little bit 2021-09-27 16:25:53 +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
Jan Niehusmann 389e0ea715 fix pico_usb_twitchy_mouse with usbd-hid >= 0.5.1
usbd-hid 0.5.1 contained an accidental semver breaking change

fix example accordingly
2021-09-25 20:33:31 +10:00
MGlolenstine 87b29bf9f4 Fixed a formatting typo 2021-09-25 00:53:30 +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 58242bcc00
Merge pull request #128 from 42-technology-ltd/update-pico-examples
Update Pico BSP examples
2021-09-22 09:06:44 +01:00
Jonathan Pallant (42 Technology) cbff22b911 Fix the pico lipo example. 2021-09-21 16:38:03 +01:00
Jonathan Pallant (42 Technology) 1e6d14abb0 Correct typo. 2021-09-21 16:18:19 +01:00
Jonathan Pallant (42 Technology) 43a22e6e42 Add Feather RP2040 README 2021-09-21 16:17:51 +01:00
Jonathan Pallant (42 Technology) 34687a2ebe Add Adafruit Macropad README 2021-09-21 16:17:35 +01:00