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

Marian Buschsieweke notifications at github.com
Mon May 4 13:56:01 CEST 2020


@maribu 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);

This could be simplified quite a bit by not exposing all features of the hardware. E.g. just use two addresses and only allow the first to be set. If I recall correctly, the first two addresses could indeed differ in all bytes (while all other pipes differed only in the LSB). 

So I would just forbid the first address to be `0xff, 0xff, 0xff, 0xff, 0xff` and set the second to `0xff, 0xff, 0xff, 0xff, 0xff`. (Just call `luid_get()` in a loop until the address differs.) The first address than is used as unicast RX address and for TX. The second address is used as multicast RX address and never used for TX.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/13743#discussion_r419382164
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200504/262b2ddb/attachment.htm>


More information about the notifications mailing list