Commit Graph

4815 Commits

Author SHA1 Message Date
Timo Kröger
308ca4b8e3 Use pub(crate) visibility for internal SPI
SubGhz provides a public interface for the radio connected to internal SPI
`#[allow(dead_code)]` is required for CI to succeed
2022-08-26 15:44:58 +02:00
Timo Kröger
60ca5e8479 lora: Improve TX/RX parameters
Match the settings used in the C driver
2022-08-26 15:44:58 +02:00
Timo Kröger
84240d49ea stm32wl: Fix RCC
* `MSIRGSEL = 1` was required for MSI accept the updated MSI range
* Reorder enable and clock switching to properly handle the jump from
the default 4MHz MSI to a higher MSI freuquency
2022-08-26 15:44:58 +02:00
Timo Kröger
f31116cafa lora: Make some options configurable
Call `config()` only once at construction not with every RX and TX operation.
The Lora-E5 only supports HP mode, use that instead.
The nucleo board supports both HP and LP and should continue to work.
2022-08-26 15:44:58 +02:00
Timo Kröger
69d80c086d lora: Use a trait for RF frontend switching
The Seeed Studio Lora-E5 module only has two control pins.
With the `RadioSwitch` trait the user can implement any method required
by the module/board to control the TX/RX direction of the radio frontend.
2022-08-26 15:44:58 +02:00
Timo Kröger
6ee29ff0bd lora: Propagate "defmt" feature to lora crates 2022-08-26 15:44:58 +02:00
Timo Kröger
8e8106ef55 lora: Improve IRQ handling
* Interrupt handler only triggers a waker:
Do the actual interrupt processing which involves SUBGHZ SPI coms in the task.
* Do not require a static state for the constructor.
* Remove unsafe from construcor.
2022-08-26 15:44:57 +02:00
Timo Kröger
61c666212f stm32wl: Do not require external SPI pins for SUBGHZ
For the Seeed Studio Lora-E5 those pins conflict with the radio frontend control GPIOS (PA4 and PA5).
2022-08-26 15:42:25 +02:00
bors[bot]
24ab21a7dd
Merge #913
913: (embassy-rp): Add DMA implementation r=Dirbaio a=MathiasKoch

This PR adds everything necessary to do peripheral to memory DMA & memory to memory DMA operations.

It also adds async UART read & write, powered by DMA

Co-authored-by: Mathias <mk@blackbird.online>
2022-08-26 10:57:10 +00:00
Mathias
bd27b9080f Add HIL tests of DMA & UART, and correctly set DREQ for uart DMA 2022-08-26 12:55:15 +02:00
huntc
9a873d1dbf Ensure that the sampling is stopped
Ensures that nRF saadc sampling is stopped and is awaited prior to exiting the two sampling methods. Not doing so causes a potential power drain and the potential for dropped buffer writes when having finished continuous sampling.
2022-08-26 14:40:20 +10:00
Dario Nieuwenhuis
69e92e5639
Merge pull request #6 from danbev/add-word-length-constants
Add WORD_LENGTH_32 constant
2022-08-25 15:52:10 +02:00
Daniel Bevenius
f2ac14b86f Add WORD_LENGTH_32/HIGH_SPEED constants
This commit adds two constants which are intended to be used for setting
the `Word Length` and `High Speed` fields in the gSPR register
(address: 0x0000, bit: 0 and bit 4).

Currently, this field is being set by the following line:
```rust
        // 32bit, little endian.
        self.write32_swapped(REG_BUS_CTRL, 0x00010031).await;
```

Assuming that we are sending these bits using the gSPI write protocol
and using 16-bit word operation in little endian (which I think might
be the default) then the data bytes should be packed like this:
```
  +--+--+--+--+
  |D1|D0|D3|D2|
  +--+--+--+--+

val (hex):   0x00010031
val (bin):   00000000000000010000000000110001
rotated(16): 00000000001100010000000000000001
```

If we split val into bytes and rotated the bits we get:
```
Split into bytes:
   D3      D2        D1       D0
00000000 00000001 00000000 00110001

Rotate 16 and split into bytes:
   D1      D0        D3       D2
00000000 00110001 00000000 00000001
```
Looking at the write procotol it seems to me that the above will
indeed set the `Word Length` to 1 but will also set other values.
```
                                  Status enable (1=default)
   D1      D0        D3       D2  ↓
00000000 00110001 00000000 00000001
           ↑↑  ↑↑                 ↑
           ||  |Word Length (1=32-bit)
           ||  |
           ||  Endianess (0=Little)
           ||
           |High-speed mode (1=High speed (default))
           |
           Interrupt polarity (1=high (default))
```

This commit suggests adding the above mentioned constants for setting
the only the word length field and the high speed field.
2022-08-25 15:40:14 +02:00
Dario Nieuwenhuis
193124bed1
Merge pull request #8 from danbev/test-ro-rw-constants
Rename REG_BUS_FEEDBEAD to REG_BUS_TEST_RO
2022-08-25 14:16:16 +02:00
Dario Nieuwenhuis
63806022f3
Merge pull request #7 from danbev/ai_comment
Add comment for AI constants
2022-08-25 14:14:48 +02:00
bors[bot]
1125d57842
Merge #924
924: Ensure interrupt::take works without embassy-executor r=lulf a=lulf

Add "rtos-trace-interrupt" feature flag on embassy-macros and enable it
for embassy-executor, to ensure that the interrupt::take! macro can be
used without depending on embassy-executor.

Co-authored-by: Ulf Lilleengen <lulf@redhat.com>
2022-08-25 10:46:56 +00:00
Ulf Lilleengen
045ae2c29f Ensure interrupt::take works without embassy-executor
Add "rtos-trace-interrupt" feature flag on embassy-macros and enable it
for embassy-executor, to ensure that the interrupt::take! macro can be
used without depending on embassy-executor.
2022-08-25 12:46:24 +02:00
Daniel Bevenius
3826b4f713 Rename REG_BUS_FEEDBEAD to REG_BUS_TEST_RO
This commit renames the REG_BUS_FEEDBEAD to REG_BUS_TEST_RO
(Read-Only) which is the name used in the specification, section 4.2.3
Table 6.

It also adds a constant named REG_BUS_TEST_RW (Read-Write) to represent
the dummy register which the host can use to write data and read back
to check that the gSPI interface is working properly.
2022-08-25 09:13:26 +02:00
Dario Nieuwenhuis
a730e2cd0f rp: add usb device support. 2022-08-25 00:03:55 +02:00
Dario Nieuwenhuis
f11aa9720b rp: update PAC 2022-08-24 23:43:28 +02:00
Daniel Bevenius
bb76a29ff1 Add comment for AI constants
This commit adds a comment about the AI_* constants.

The motivation for using this definition is from looking in the
following file:
https://github.com/seemoo-lab/bcm-public/blob/master/firmware_patching/examples/ioctl/bcmdhd/include/aidmp.h#L2
https://github.com/seemoo-lab/bcm-public/blob/master/firmware_patching/examples/ioctl/bcmdhd/include/aidmp.h#L307-L361
2022-08-24 15:58:44 +02:00
bors[bot]
529535194d
Merge #926
926: nrf: PPI fixes r=Dirbaio a=Dirbaio

- Feature-gate DPPI-only stuff that should be feature-gated
- Fix unsoundness due to Task/Event ptr being public: this meant you could construct a Task/Event with an arbitrary pointer and then safely call `Ppi::new_*` which would blindly write to it. Now you have to go through `Task/Event::new_unchecked` which is unsafe, with the right safety contract.

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-08-24 00:05:38 +00:00
Dario Nieuwenhuis
91a9168a32 nrf/ppi: fix unsoundness due to task/event ptrs being public. 2022-08-24 01:54:27 +02:00
Dario Nieuwenhuis
02562ed87d nrf/ppi: feature-gate dppi stuff. 2022-08-24 01:52:15 +02:00
bors[bot]
9947e27ee1
Merge #925
925: Enable 'std' feature on critical-section for WASM r=Dirbaio a=lulf

This fixes the WASM support which was failing due to missing
critical-section implementation. This also upgrades the bindgen
dependency and ensures that tooling works.

Co-authored-by: Ulf Lilleengen <lulf@redhat.com>
2022-08-23 18:41:34 +00:00
Ulf Lilleengen
bd4ae2e952 Enable 'std' feature on critical-section for WASM
This fixes the WASM support which was failing due to missing
critical-section implementation. This also upgrades the bindgen
dependency and ensures that tooling works.
2022-08-23 20:00:34 +02:00
Dario Nieuwenhuis
6530c179b2
Merge pull request #923 from lulf/doc-warnings2
Fix warnings after crate split
2022-08-23 14:30:10 +02:00
Ulf Lilleengen
b6bc627b24 Add README for embassy-futures 2022-08-23 14:05:17 +02:00
Ulf Lilleengen
189d4137cc Add readme for embassy-time 2022-08-23 13:58:57 +02:00
Ulf Lilleengen
7b3ae0446c Remove cargo doc from CI 2022-08-23 13:55:21 +02:00
Ulf Lilleengen
06011f67b2 Add README for embassy-sync 2022-08-23 13:54:40 +02:00
Mathias
b88ef03214 Only check for ahb error in DMA 2022-08-23 13:46:48 +02:00
Mathias
594a64b3bf Change to using embassy-sync 2022-08-23 13:28:14 +02:00
Mathias
36cf719a18 Merge branch 'master' of https://github.com/embassy-rs/embassy into embassy-rp/dma 2022-08-23 13:24:52 +02:00
Mathias
7e3ce2c90b Abort DMA operation when dropping a Transfer, and panic on DMA errors 2022-08-23 13:20:36 +02:00
Mathias
f6c2e26372 Address code review comments 2022-08-23 12:28:17 +02:00
Ulf Lilleengen
7b97e52886 Add doc build to CI for warning-free modules 2022-08-23 08:37:52 +02:00
Ulf Lilleengen
0bb64c2f53 Fix warnings after crate split 2022-08-23 08:37:38 +02:00
Dario Nieuwenhuis
9218aff498 Update Embassy. 2022-08-23 01:06:14 +02:00
bors[bot]
cb9f0ef5b8
Merge #922
922: split `embassy-util` into `embassy-futures`, `embassy-sync`. r=Dirbaio a=Dirbaio



Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-08-22 20:18:40 +00:00
Dario Nieuwenhuis
5677b13a86 sync: flatten module structure. 2022-08-22 22:18:13 +02:00
Dario Nieuwenhuis
21072bee48 split embassy-util into embassy-futures, embassy-sync. 2022-08-22 22:18:13 +02:00
Dario Nieuwenhuis
945449b10f Update Embassy. 2022-08-22 17:26:05 +02:00
bors[bot]
61356181b2
Merge #918
918: Doc warnings r=Dirbaio a=lulf

Fixing a few doc warnings in embassy-executor, embassy-time, embassy-usb and embassy-nrf. There are more left, but I need a break :D 



Co-authored-by: Ulf Lilleengen <lulf@redhat.com>
2022-08-22 14:43:56 +00:00
Ulf Lilleengen
3e155d2ec3 nRF documentation warning fixes 2022-08-22 16:37:35 +02:00
Ulf Lilleengen
5fddff849e Remove warnings for embassy-time 2022-08-22 16:33:39 +02:00
Ulf Lilleengen
f2daad20ab Remove warnings 2022-08-22 16:33:39 +02:00
bors[bot]
53fbd0efb3
Merge #921
921: rp: fix nvic prio bits (it's 2, not 3) r=Dirbaio a=Dirbaio

bors r+

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-08-22 14:30:06 +00:00
Dario Nieuwenhuis
f48391a685 rp: fix nvic prio bits (it's 2, not 3) 2022-08-22 16:29:34 +02:00
bors[bot]
381ac97746
Merge #920
920: Remove Forever, switch to static_cell. r=Dirbaio a=Dirbaio



Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-08-22 14:12:13 +00:00