[riot-notifications] [RIOT-OS/RIOT] drivers/nrf24l01p: Netdev driver for nrf24l01p (#13743)

fabian18 notifications at github.com
Mon May 4 11:52:30 CEST 2020

@fabian18 commented on this pull request.

> +    if (nrf24l01p_ng_acquire(dev) < 0) {
+        DEBUG("[nrf24l01p_ng] _init(): nrf24l01p_ng_acquire() failed\n");
+        return -EIO;
+    }
+    if (dev->state != NRF24L01P_NG_STATE_POWER_DOWN) {
+        nrf24l01p_ng_transition_to_power_down(dev);
+    }
+    nrf24l01p_ng_flush_tx(dev);
+    nrf24l01p_ng_flush_rx(dev);
+    uint8_t addr_size = NRF24L01P_NG_ADDR_WIDTH;
+    uint8_t pipes = 0;
+    uint8_t cnt = 1; /* counter assures that the LSB is different
+                        for all pipe addresses*/
+    uint8_t addr_p0[] = NRF24L01P_NG_L2ADDR_AUTO;
+    if (!memcmp(dev->params.urxaddr.rxaddrpx.rx_p0, addr_p0, addr_size)) {
+        luid_base(dev->params.urxaddr.rxaddrpx.rx_p0, addr_size);

The datasheet reads: "The LSByte must be unique for all six pipes" [p. 38].
If addresses have not been defined explicitly in the `params`, then I wanted to force
the uniqueness of the LSByte via a counter. I did not use `luid_get()` because it XORs the MSByte `(((uint8_t *)buf)[0] ^= lastused++;)`.
If someone adds the addresses by hand, I assume he knows what he is doing.

But I´d better set `NRF24L01P_NG_PARAM_RX_P0` and `NRF24L01P_NG_PARAM_RX_P1` to `NRF24L01P_NG_L2ADDR_AUTO`

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200504/3cef646e/attachment.htm>

More information about the notifications mailing list