Commit graph

384 commits

Author SHA1 Message Date
9names 44a9b0f541 Add GPIO interrupt example 2022-02-14 22:47:46 +11:00
9names fff980611a
Merge pull request #289 from astraw/fix-typo
fix typo
2022-02-13 13:37:12 +11:00
Derek Hageman 80c84b13ba Add ROM floating point math library
Hook up the ROM functions to floating point intrinsics.
2022-02-12 11:56:24 -07:00
Derek Hageman ce681b4f10 Move divider intrinsics to the new intrinsics macro 2022-02-12 11:56:24 -07:00
Derek Hageman a70eb89799 Add basic ROM intrinsics
Add a standardized macro for intrinsics export and connect the simple
ROM functions to intrinsics.
2022-02-12 11:56:24 -07:00
Derek Hageman 81ab38fd71 Add ROM version check
Add a check for a V2 bootrom when using floating point functions that
require it.  Panic when it's not present.
2022-02-06 17:14:27 -07:00
Andrew Straw 799449dd1a fix typo 2022-02-06 09:03:30 +01:00
Derek Hageman a6f2453440 Fix ROM function signatures
Fix a few function signatures that don't match the ROM according to the
datasheet.
_memset4 also has a wrong code in the datasheet, so match it to the
actual ROM.
2022-02-04 07:18:11 -07:00
Jonathan 'theJPster' Pallant 8bdecd2058
Merge pull request #283 from Sizurka/rom-functions
Improve ROM function access
2022-02-04 09:53:59 +00:00
Derek Hageman 98fd6c1724 Add ROM function caching
Add a feature to enable automatic caching of the result of ROM table
function lookups.
2022-02-03 13:45:18 -07:00
Derek Hageman a6daaf9fa3 Standardize ROM function access
Make all ROM functions (normal and floating point) provide both a direct
call that does the operation and a module with a ptr() function to get
the function pointer.
2022-02-03 13:32:18 -07:00
Jonathan 'theJPster' Pallant 16c9064c52
Merge pull request #280 from 9names/alarm-ergonomics
Use atomic operations for altering Timer alarm interrupts
2022-02-03 19:47:40 +00:00
Jonathan 'theJPster' Pallant 385c92392b
Merge pull request #278 from Sizurka/divider-intrinsics
Implement intrinsics for the hardware divider
2022-02-03 19:46:00 +00:00
Andrew Straw cd15d268f6 run 'cargo fmt' 2022-02-02 22:10:39 +01:00
Andrew Straw a1ed9ef93c example of side setting using PIO 2022-02-01 11:09:09 +01:00
Jonathan 'theJPster' Pallant 354a2a5e5e
Merge pull request #281 from rp-rs/update_pac
Use new spinlock API provide by PAC 0.3.0
2022-01-31 10:40:02 +00:00
Jonathan 'theJPster' Pallant 4a540d041a Hide spinlock 31. 2022-01-30 16:43:59 +00:00
Jonathan 'theJPster' Pallant efda22c9ea Update spinlock docs. 2022-01-30 16:43:53 +00:00
Jonathan 'theJPster' Pallant f44f5f0e09 Make clippy happy. 2022-01-30 16:12:43 +00:00
Jonathan 'theJPster' Pallant 35a10f2bc6 Clean up critical-section impl.
Adds new `Sio::core()` function.
2022-01-30 16:07:40 +00:00
Jonathan 'theJPster' Pallant 7e2f8d274c Use const generics for spinlocks.
The fewer code-generating macros we have, the better!
2022-01-30 15:56:23 +00:00
Jonathan 'theJPster' Pallant c8c366c23d Use new spinlock API provide by PAC 0.3.0 2022-01-30 12:56:51 +00:00
9names b19f2cc8e5 Use atomic operations for altering Timer interrupts 2022-01-30 22:54:27 +11:00
Jan Niehusmann a9763837a9 Add comment regarding release mode 2022-01-28 22:18:32 +00:00
Jan Niehusmann f6b2e3365e use dht-sensor crate and fix comments 2022-01-28 21:36:30 +00:00
Jan Niehusmann bb6b7706f9 Add dht11 example 2022-01-28 19:44:26 +00:00
Jonathan Pallant 5771f872f2
Merge pull request #269 from 9names/fix_uart_example_clock
Use .freq() to avoid moving clock
2022-01-28 15:03:23 +00:00
Wilfried Chauveau d08bfac989 Fix i2c peripheral mode state machine
The start_det flag is set as soon as a start condition occurs
whereas rd_req flag is only set once the address byte is received.
2022-01-29 00:01:32 +11:00
Derek Hageman f279945315 Add intrinsics for the hardware divider
Implement intrinsic functions so basic operators use the hardware divider.
2022-01-26 19:37:06 -07:00
Derek Hageman 35704d9799 Change divider delay to explicit NOPs
Use explicit NOPs since cortex_m::asm::delay actually delays for
longer than we need to.
2022-01-26 19:37:06 -07:00
Derek Hageman c2d3b21d91 Make hardware divisor interrupt safe
Copy the pico-sdk logic for save and restore of the hardware divider
for making it interrupt safe.
2022-01-26 19:37:06 -07:00
9names 57e9943836 Set hw reset bits for watchdog 2022-01-20 21:55:16 +11:00
9names c8b75204ee Use .freq() to avoid moving clock 2022-01-20 18:28:51 +11:00
Victor Koenders d6e3c7b615
Set the uart config default baud rate to 115200 2022-01-18 17:28:13 +01:00
Victor Koenders b3b4d9ff6f
Fixed doc test 2022-01-18 11:32:48 +01:00
Victor Koenders 9e75cec551
Added impl Default for UartConfig 2022-01-18 11:17:01 +01:00
Wilfried Chauveau 7840d0f833 embassy-traits: Fix unexpected restart on repeated read. 2022-01-13 19:28:23 +11:00
Jonathan 'theJPster' Pallant d3c9c3b4e2
Merge pull request #263 from WeirdConstructor/fix_alarm_schedule_race_cond
Fix alarm schedule race condition
2022-01-12 20:07:59 +00:00
Weird Constructor 7a23247ca1 Fix alarm schedule() race condition. 2022-01-12 06:41:03 +01:00
Weird Constructor a7b71bd5aa Fix compilation bug in the documentation 2022-01-09 15:16:01 +01:00
Weird Constructor 9e84c961a8 (Hopefully) Improved documentation of bsp_pins!() 2022-01-09 13:50:57 +01:00
Jonathan 'theJPster' Pallant f23ababb1a
Merge pull request #197 from chinoto/pio_sound_send
pio: Fix unsound Send clippy warning
2022-01-06 12:57:26 +00:00
Jonathan 'theJPster' Pallant 43650b3248
Merge pull request #248 from jannic/bump-versions
Bump versions of HAL and BSPs
2021-12-27 11:00:31 +00:00
Jonathan Pallant 67d9da85e6 Fix docs for SerialInfallible. 2021-12-26 20:57:04 +00:00
Jonathan Pallant 55acbdb1b0 Fix build errors in eh_1.0 mode. 2021-12-26 20:56:48 +00:00
Jan Niehusmann 2f9a950cbe Bump versions of HAL and BSPs
The change to UartPeripheral in #210 was a breaking change:
Bump the version of the HAL and all dependent BSP crates.
2021-12-26 19:52:04 +00:00
Jonathan Pallant 7da16a726f Fixing typos spotted in the review. 2021-12-26 19:39:16 +00:00
Jonathan Pallant (Ferrous Systems) d3bd232885 Added two UART IRQ examples.
They are in the pico BSP as they need the 'rt' feature. Also includes
changes to the UART driver for enabling/disabling interrupts.
2021-12-26 19:33:23 +00:00
Victor Koenders 8f63be0f22
Fixed failing doctest 2021-12-25 09:49:32 +01:00
Victor Koenders 86444448a4
Migrated examples to the new uart system 2021-12-25 09:46:40 +01:00
Victor Koenders c41c273131
Added reader/writer split to UartPeripheral 2021-12-25 09:46:38 +01:00
Victor Koenders 84b8fb05b0
Fixed compile errors on eh1_0_alpha feature 2021-12-25 09:46:34 +01:00
Victor Koenders a8a27672b8
Constraint the uart::pin:: traits to UartDevice 2021-12-25 09:45:57 +01:00
Victor Koenders a4a0bcf987
Added pins to the uart constructor functions 2021-12-25 09:45:54 +01:00
Victor Koenders bdfb4d82c9
Split uart in separate files, introduced a typesystem constraint for valid UART pin configurations 2021-12-25 09:45:45 +01:00
Jonathan Pallant 4959afe151 Include manufacturer in BSP crate name.
Avoids ambiguity.
2021-12-20 21:28:00 +00:00
Jonathan Pallant 7278c36e93 Add MSRV 2021-12-20 20:05:40 +00:00
Jonathan Pallant 96c2273dce Noted 0.3.0 includes many bug fixes. 2021-12-20 19:53:15 +00:00
Jonathan Pallant 5701ab431f Revised CHANGELOG.
Added extra items to 0.3.0.
Reformatted 0.2.0 entry.
2021-12-20 19:52:31 +00:00
Jonathan Pallant bebf85d4d9 Set up for 0.3.0 release.
Somehow we already had a bunch of commits talking about 0.3.0, but it
was never released. Hence why this maybe doesn't change as many version
numbers as you might expect.
2021-12-19 19:22:15 +00:00
Jonathan Pallant a9f6ab8de4 Comment out embassy traits.
The git dep prevents us from publishing, rp2040-hal, and embassy
aren't doing a release any time soon.
2021-12-18 19:09:37 +00:00
Jonathan 'theJPster' Pallant 53d9dbdf52
Update to pio-rs v0.1.0 (#239)
* Update to PIO 0.1.0

* Update to latest ws2812-pio and i2c-pio.

These depend on pio 0.1.0, avoiding a conflict

* Rename CI tests.

Also check we can cargo build. And remove 'on host tests' that didn't
do anything.

Co-authored-by: Jonathan Pallant <jonathan.pallant@42technology.com>
2021-12-14 10:52:32 +11:00
Pedro Ferreira 24a417f01a
Make fields in UartConfig public (#233)
Otherwise it's impossible to have a configuration which differs from the provided default options.
2021-12-14 10:47:35 +11:00
9names 427344667e
Add basic multicore FIFO example (#226)
* Add basic multicore fifo example

* Add documentation for multicore

* Send system_clock frequency to core1 over FIFO in example

* Add Stack::new() to HAL. Use Stack::new() in example
2021-12-08 19:34:39 +11:00
Jonathan 'theJPster' Pallant 539f6db0f7
Merge pull request #231 from ithinuel/bump-embassy
Bump embassy's dependencies
2021-12-05 18:03:03 +00:00
Jonathan 'theJPster' Pallant b94a5ab885
Merge pull request #232 from jannic/refactor-uart-init
Refactor uart init
2021-12-05 18:02:44 +00:00
Wilfried Chauveau fee8881801
bump embassy's dependencies 2021-12-05 12:39:25 +00:00
Jan Niehusmann b380b3ddf6 Reset UART in new() 2021-12-05 07:05:12 +00:00
9names 422da14e19
Merge branch 'main' into reexport_mod_structs 2021-12-05 01:04:08 +11:00
9names 0e7abdc705
Make BSPs provide boot2 as a default feature (#153)
* Add boot2 feature. Add boot2 linkage into each BSP optional on feature

* Enable boot2 feature in BSPs by default. Remove boot2 decl from all BSP examples

* Add EXTERN in memory.x for BOOT2_FIRMWARE, rename bootloader static slice to BOOT2_FIRMWARE

* Update new examples and itsy_bitsy BSP to use boot2 feature

* Remove boot2 as a dev-dependency for the BSPs, no longer needed

* Add no_mangle BOOT2_FIRMWARE to adafruit_macropad

* Fix itsy-bitsy blinky - it wasn't using the BSP, so it didn't get BOOT2_FIRMWARE linked in
2021-12-05 01:00:09 +11:00
9names dc8ceffd09 Move uses of sio::Sio to Sio 2021-12-04 16:20:27 +11:00
9names 11aa0b87af Cargo fmt 2021-12-04 15:38:25 +11:00
Jan Niehusmann 26fa532fa3 Refactor Uart initialization 2021-12-03 21:24:50 +00:00
9names 33ff337631
Merge branch 'rp-rs:main' into reexport_mod_structs 2021-12-04 00:43:14 +11:00
9names 6ab9cd7ed3 Generate sev in sio.fifo.write() 2021-12-04 00:42:46 +11:00
9names 55a8b4acf9 Re-export mod structs 2021-12-04 00:04:45 +11:00
9names a7d5dc2bee Add safety docs from atsamd-rs to GPIO traits 2021-12-03 23:42:45 +11:00
Gus Caplan 5dafe3985f use user-provided stack for core 1
Fixes: https://github.com/rp-rs/rp-hal/issues/218
2021-12-03 20:24:53 +11:00
9names d84e641390
Add simple interrupt_disable+spinlock critical-section impl (#151)
* Add basic interrupt_disable+spinlock critical-section

* Update impl based on feedback from jannic

* Get rid of count variable, switch to AtomicU8 for lock state

* Remove interrupt::disable that isn't necessary for safety

* Rename variables, re-write most of the comments

* Add fences to ensure ordering
2021-12-02 00:03:41 +11:00
devsnek e1f99443d9
multicore (#89)
mvp multicore implementation

Co-authored-by: Jan Niehusmann <jan@gondor.com>
2021-12-01 23:52:53 +11:00
Trangar f68f148d12
Added RtcClock DateTime and alarms (#213)
* Added RealTimeClock, DateTime and RTC alarms

* Improved documentation on weird behaviors in the RealTimeClock

* Fixed incorrect leap_year_check in RealTimeClock

* Fixed rtc-datetime PR feedback
2021-11-29 21:15:20 +11:00
Jonathan 'theJPster' Pallant fad1dfa259
Merge pull request #191 from jannic/rename-set_instruction
Rename set_instruction to exec_instruction
2021-11-25 19:08:13 +00:00
Jonathan 'theJPster' Pallant 3a3280575f
Merge pull request #204 from rp-rs/add_sio_fifo
Add SIO FIFO
2021-11-25 19:05:40 +00:00
Jan Niehusmann bb8531445e Fix fmt
Thats what happens when editing files directly on github...
2021-11-25 16:44:57 +00:00
Jan Niehusmann 15c162757f
Update docs in rp2040-hal/src/pio.rs
Co-authored-by: Wilfried Chauveau <wilfried.chauveau@ithinuel.me>
2021-11-25 17:38:18 +01:00
Jonathan Pallant (Ferrous Systems) 69255f7b8c Fix wfe/sev semantics.
We must sev on write, so the other core can wfe on read.
2021-11-25 15:14:03 +00:00
Jonathan Pallant (Ferrous Systems) e9694bbb91 Use released 0.2.0 PAC. 2021-11-25 14:45:28 +00:00
Jonathan Pallant ed860ed106
Merge pull request #208 from VictorKoenders/spinlock
Added spinlocks
2021-11-25 14:44:46 +00:00
Jonathan Pallant 968e49aa03
Merge pull request #198 from VictorKoenders/alarm
Added timer alarms
2021-11-25 14:33:06 +00:00
Jonathan Pallant 292a6f13c8
Merge pull request #205 from jannic/eh-1_alpha6
Update eh1_0_alpha feature for embedded-hal 1.0.0-alpha.6
2021-11-25 14:30:02 +00:00
Victor Koenders 111b355da2
Fixed error in spinlock's documentation 2021-11-24 11:59:43 +01:00
Victor Koenders 88fbc38f8b
Added spinlocks 2021-11-24 08:19:42 +01:00
Victor Koenders a9d96f352e
Removed incorret unsafe impl Sync, added interrupt_free around obtaining an alarm 2021-11-24 07:41:04 +01:00
Victor Koenders 1fd04d3384
Made the alarmX take exclusive ownership of Timer on functions that could cause UB when run in parallel 2021-11-24 07:41:03 +01:00
Victor Koenders 97a5bd355c
Added AlarmX::disable_interrupt, made AlarmX::schedule able to return an error if the time is too short 2021-11-24 07:41:00 +01:00
Victor Koenders 119c5a94e8
Added timer alarms 2021-11-24 07:40:56 +01:00
Damian J Pound c7c5fb00d8 pio: Fix unsound Send clippy warning 2021-11-21 22:32:22 -06:00
Jan Niehusmann 3ab84702b7 Update comments 2021-11-21 13:16:03 +00:00
Jan Niehusmann 9a018ac359 Update uart implementation of embedded-hal 1.x to 1.0.0-alpha.6 2021-11-19 22:46:55 +00:00
Jan Niehusmann 1294f556e9 Update SPI implementation of embedded-hal 1.x to 1.0.0-alpha.6 2021-11-19 22:46:55 +00:00