Commit graph

474 commits

Author SHA1 Message Date
Matous Hybl
118532278c Add H7 flash and bootloader support 2022-05-06 21:57:15 +02:00
Matous Hybl
6d56f772e1 Add F7 flash and bootloader support 2022-05-06 21:57:15 +02:00
Matous Hybl
4f5088d79d Add support for F3 flash 2022-05-06 21:57:15 +02:00
Dario Nieuwenhuis
a5f5c3a844 net: add functions to get current Eth and IP config 2022-05-02 16:19:34 +02:00
bors[bot]
d600f39260
Merge #743
743: Add PLL config support for F2 r=Dirbaio a=Gekkio

- minor changes to make the F2 RCC API a bit more flexible
- low-level PLL config with assertions based on datasheet specs. It shouldn't be very difficult to later add a "reverse API" where you pass the clocks you want to a function and it generates a `PLLConfig` struct for you
- PLL API tested on my custom board with 12 MHz HSE as source for PLL to generate max clocks for SYSCLK/AHB/APB/APB1/PLL48
- the example *should* work but is untested since I don't have the Nucleo board 😞 

Co-authored-by: Joonas Javanainen <joonas.javanainen@gmail.com>
2022-04-30 21:08:43 +00:00
Joonas Javanainen
e88559c5ca
Use defmt-friendly error handling 2022-04-30 11:41:17 +03:00
David Lenfesty
2e7b42fc5b embassy-stm32/eth: convert LAN8742 driver to generic SMI driver
SMI Ethernet PHYs all share a common base set of registers that can do
90% of all tasks. The LAN8742 driver used some vendor-specific
registers to check link negotiation status, but the need for that was
debatable, so I migrated it to a generic driver instead, anybody who
wants extra functionality can copy it and impl their own on top of it.
2022-04-30 04:49:24 +02:00
Joonas Javanainen
1d5f9b86fb
Add PLL example for F2 2022-04-29 18:21:41 +03:00
Ulf Lilleengen
b7e7211a20 Fix linker script for nrf bootloader example 2022-04-28 14:11:01 +02:00
Ulf Lilleengen
bd237a1f96 Allow using separate page sizes for state and dfu
* Less generics on bootloader. Keep PAGE_SIZE as a common multiple of
DFU and ACTIVE page sizes.
* Document restriction
* Add unit tests for different page sizes
2022-04-28 10:38:25 +02:00
Ulf Lilleengen
da61611f8f Add bootloader to CI 2022-04-27 15:17:18 +02:00
Ulf Lilleengen
484e0acc63 Add stm32 flash + bootloader support
* Add flash drivers for L0, L1, L4, WB and WL. Not tested for WB, but
should be similar to WL.
* Add embassy-boot-stm32 for bootloading on STM32.
* Add flash examples and bootloader examples
* Update stm32-data
2022-04-27 15:17:18 +02:00
bors[bot]
df814f9bbd
Merge #734 #735
734: executor: Add `Spawner::for_current_executor`. r=Dirbaio a=Dirbaio

This is needed to spawn non-Send tasks in an InterruptExecutor, after the fixes in #730 .

`@matoushybl` could you check if this works for your use case?

735: stm32: add stm32u5 GPDMA, SPIv4 support, add HIL tests. r=Dirbaio a=Dirbaio



Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-04-26 23:32:30 +00:00
Dario Nieuwenhuis
009bb8e4e1 stm32: add stm32u5 GPDMA, SPIv4 support, add HIL tests. 2022-04-27 01:16:14 +02:00
Dario Nieuwenhuis
9e897cbea9 executor: Add Spawner::for_current_executor. 2022-04-26 19:08:18 +02:00
Ulf Lilleengen
2c0e28aa0c Update to released lorawan crates 2022-04-26 19:06:15 +02:00
Dario Nieuwenhuis
2b0e8a330b examples/nrf: add self_spawn example.
This serves as a compile-test of possible typecheck loops due to
TAIT shenanigans.
2022-04-25 22:19:40 +02:00
Dario Nieuwenhuis
b27feb0619 executor: fix unsoundness in InterruptExecutor::start.
The initial closure is not actually called in the interrupt, so this is
illegally sending non-Send futures to the interrupt.

Remove the closure, and return a SendSpawner instead.
2022-04-25 22:09:04 +02:00
Matous Hybl
945fa0871f Implement giant (chunked) DMA transfers for DCMI. 2022-04-25 14:30:43 +02:00
Dario Nieuwenhuis
d409026b95 examples/nrf: add product strings to all usb examples. 2022-04-24 22:46:45 +02:00
Dario Nieuwenhuis
d57fd87ba7 Add embassy-usb-ncm. Implements USBB CDC NCM (Ethernet over USB) 2022-04-24 22:44:52 +02:00
Dario Nieuwenhuis
3251a21fb7 Switch to crates.io embedded-hal, embedded-hal-async.
This temporarily removes support for the async UART trait, since it's
not yet in embedded-hal-async.
2022-04-22 19:58:24 +02:00
Ulf Lilleengen
2afff617f6 Support multiple flash instances in embassy-boot
* Add FlashProvider and FlashConfig traits to define flash
characteristics
* Use traits in bootloader to retrieve flash handles and for
copying data between flash instances
* Add convenience implementations for using a single flash instance.
2022-04-19 20:07:06 +02:00
Ulf Lilleengen
e966125d62 Add embedded-storage trait impls for QSPI
* Adds implementations of embedded-storage and embedded-storage-async
for QSPI
* Add blocking implementations of QSPI
* Use blocking implementation in new() and embedded-storage impls
* Use async implementation in embedded-storage-async impls
* Add FLASH_SIZE const generic parameter
* Own IRQ in Qspi to disable it on drop
2022-04-19 19:06:36 +02:00
Dario Nieuwenhuis
1bf7b4d6c3 usb: rename UsbDeviceBuilder -> Builder. 2022-04-16 04:14:20 +02:00
Dario Nieuwenhuis
f35bde684a usb-hid: add Config struct, to avoid too many params. 2022-04-16 02:07:03 +02:00
Dario Nieuwenhuis
c0de54a341 usb-hid: Simplify API.
- Renamed structs to HidReaderWriter, HidReader, HidWriter.
- Removed unused const generics on `State`.
- Simplified generics on `HidReaderWriter`.
  The class type previously was `HidClass<D, Driver<'d, USBD>, ReportReader<'d, Driver<'d, USBD>, OUT_N>, IN_N>`
  It's now `HidClass<D, Driver<'d, USBD>, IN_N, OUT_N>`. Note that the driver type `Driver<'d, USBD>` is no longer repeated.
- Constructors are now: `HidWriter::new()` for IN-only, `HidReaderWriter::new()` for IN+OUT. No complicated bounds.
- HidReaderWriter has all the methods from HidReader, HidWriter.
2022-04-16 01:59:40 +02:00
bors[bot]
3a90a8eb4a
Merge #711
711: Add DeviceStateHandler, DeviceCommand channel, and remote wakeup support r=Dirbaio a=alexmoon

Apologies for the size of this PR. Once I started getting into the Vbus power management side of my device I found a couple of areas of functionality missing from embassy-usb. Specifically, I need the application to be able to respond to changes in the USB device state in order to properly control the amount of power I'm drawing from Vbus. I also wanted to enable remote wakeup support for my device.

In order to enable device state monitoring, I've created a `DeviceStateHandler` trait and made it possible to pass in an optional reference a handler implementing that trait when creating the `UsbDeviceBuilder`.

Remote wakeup required a way to send commands to the bus which is exclusively owned by the `UsbDevice::run` method. This is the same problem we were discussing for enabling/disabling the device on Vbus power events. My solution is to allow an optional `Channel` to be provided to the `UsbDeviceBuilder` (via `UsbDeviceBuilder::new_with_channel`), allowing the application to send commands into the `run` method. Right now it supports enable, disable and remote wakeup commands.

Since there's now a way to dynamically enable and disable the device, I also added `Config::start_enabled` to control whether or not the `UsbDevice` should start in the enabled state. That also allowed me to make `UsbDeviceBuilder::build` sync again and move enabling the bus into `UsbDevice::run`.

This led to a few driver changes:
1. `Driver::enable` became `Driver::into_bus`
2. `Bus::enable`, `Bus::disable`, and `Bus::remote_wakeup` were added
3. I removed `Bus::reset`, `Bus::suspend`, and `Bus::resume` because they were only ever called based on the result of `Bus::poll`. It made more sense to me to have `Bus::poll` handle the driver-specific state management itself.

I've updated the `usb_hid_keyboard` example to take advantage of all these additional features.

Let me know what you think.

Thanks!


Co-authored-by: alexmoon <alex.r.moon@gmail.com>
2022-04-14 15:16:55 +00:00
alexmoon
b0725c14d3 Split UsbDevice::run into run and run_until_suspend 2022-04-13 16:04:31 -04:00
alexmoon
ff7c6b350e Remove channel and make run future cancelable 2022-04-13 14:55:02 -04:00
alexmoon
7fde3abd5d Remote wakeup bug fixes 2022-04-13 14:55:02 -04:00
alexmoon
f5656e3544 Add DeviceStateHandler, DeviceCommand channel, and remote wakeup support 2022-04-13 14:55:02 -04:00
Dario Nieuwenhuis
e5a843dc06 net: auto-enable defmt in smoltcp using namespaced features. 2022-04-13 17:46:27 +02:00
bors[bot]
6d0e6d563d
Merge #714
714: add more clock options for l4 and l5 r=Dirbaio a=ant32

- added an assert so it panics if pll48div is not 48Mhz
- added MSI as a clock source for PLL
- removed hsi48 option for MCUs mentioned in l4 rcc presentation
- copied some code from l4 to l5, but don't have a way of testing it.

Co-authored-by: Philip A Reimer <antreimer@gmail.com>
2022-04-12 21:42:36 +00:00
Matous Hybl
371f3ef419 Add ADC support for H7 2022-04-12 22:25:00 +02:00
Philip A Reimer
8f6fccf012 fix clock in l4 rng example 2022-04-11 21:06:22 -06:00
Philip A Reimer
d8860c0b80 add stm32l4 hsi48 and usb example 2022-04-09 14:55:03 -06:00
alexmoon
e867364d42 Unify ReadError and WriteError into EndpointError 2022-04-09 01:48:17 +02:00
Ulf Lilleengen
86e52e67d0 Update to latest rust-lorawan version 2022-04-08 12:58:57 +02:00
Dario Nieuwenhuis
0c07d03754 Add missing stm32wl/stm32wb chips except stm32wle 2022-04-08 03:15:27 +02:00
bors[bot]
37da84129d
Merge #657
657: Async usb stack r=Dirbaio a=Dirbaio

TODO

- [x] Make it work on nRF
- [x] Add a way for classes to handle their own EP0 control requests - thanks `@alexmoon!`
- [x] Handle CONTROL OUT requests with data.
- [ ] Impl AsyncRead/AsyncWrite for CDC ACM -- will do later, it's not trivial
- [x] Cleanup unwraps/asserts/panics
- [x] Cleanup logs (make everything trace/debug, not info)
- [ ] Port synopsys-usb-otg
- [ ] Port stm32-usbd
- [ ] Add more classes? HID, MSD?


Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
Co-authored-by: alexmoon <alex.r.moon@gmail.com>
2022-04-07 23:03:39 +00:00
alexmoon
6abbfa9a92 Async-ify Driver::enable and UsbDeviceBuilder::build 2022-04-07 10:51:26 -04:00
Matous Hybl
eb6910fa86 Reexport unborrow macro in HALs 2022-04-07 12:57:02 +02:00
bors[bot]
fee0aef076
Merge #696
696: Add async Mutex. r=Dirbaio a=Dirbaio

What it says on the tin :) 

It allows sharing data between tasks when you want to `.await` stuff while holding it locked.

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-04-06 10:20:43 +00:00
alexmoon
a1754ac8a8 embassy-usb-hid bug fixes 2022-04-06 05:38:11 +02:00
Dario Nieuwenhuis
b2e517bb28 usb/serial: add multitask example. 2022-04-06 05:38:11 +02:00
Dario Nieuwenhuis
3dbb7c9e15 usb/hid: add keyboard example. 2022-04-06 05:38:11 +02:00
Dario Nieuwenhuis
6d514a0b31 usb/hid: update for endpoint state changes. 2022-04-06 05:38:11 +02:00
alexmoon
2ce435dc34 Add basic device state handling for endpoints. 2022-04-06 05:38:11 +02:00
alexmoon
99f95a33c3 Simplify hid output report handling 2022-04-06 05:38:11 +02:00