-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers/nrf24l01+ : added netdev implementation for nrf24l01+ transceiver #1808
drivers/nrf24l01+ : added netdev implementation for nrf24l01+ transceiver #1808
Conversation
void print_register(char reg, int num_bytes); | ||
|
||
#define STATIC_RX_BUF_SIZE 128 | ||
static char static_rx_buf[STATIC_RX_BUF_SIZE]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this static receive-buffer can be replaced by the "global packet buffer" in future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should. Otherwise it's no use ;-)
I don't have time for a in-depth review right now, but things I've spotted so far:
|
* | ||
* @detail Sends any frames, handled internal. | ||
*/ | ||
NETDEV_PROTO_PROPRIETARY = 0x0008, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it up here? Setting this value to 8 but leaving the lower values below makes the code harder to read, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also: this name is pretty arbitrary. Should other proprietary protocols also use this protocol type? If yes, what good does this information make? The idea of this type definition was to give a higher layer an idea of what to expect from the device or protocol layer (sorry if this was not clear from the documentation) and just saying "this is basically a black box, deal with it" is not very helpful and opens the door to future device driver development just using this flag.
A better name would be NETDEV_PROTO_NRV24L01X
(X for +), I guess. We have room for at least 65536 different protocols here, so don't be shy to be specific. ;-)
779da69
to
754756a
Compare
#ifndef __REGS_H | ||
#define __REGS_H | ||
|
||
#define INITIAL_ADDRESS_WIDTH 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tabs in the middle of the line
@authmillenon, I started using my implementation with the |
#endif /* NETDEV_DEFAULT */ | ||
#endif /* MODULE_NATIVENET */ | ||
#endif /* MODULE_NRF24L01P */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey!! :(
diff --git a/drivers/include/netdev/default.h b/drivers/include/netdev/default.h
index 50d4983..d044a93 100644
--- a/drivers/include/netdev/default.h
+++ b/drivers/include/netdev/default.h
@@ -36,4 +36,12 @@
#endif /* NETDEV_DEFAULT */
#endif /* MODULE_NATIVENET */
+#ifdef MODULE_NRF24L01P
+#include "nrf24l01p.h"
+
+#ifndef NETDEV_DEFAULT
+#define NETDEV_DEFAULT ((netdev_t *)(&nrf24l01p_netdev))
+#endif /* NETDEV_DEFAULT */
+#endif /* MODULE_NRF24L01P */
+
#endif /* __NETDEV_DEFAULT_H_ */
8dd9e0a
to
235e09d
Compare
I adapted the driver and the netdev-test so one can use them together |
235e09d
to
e80efd2
Compare
Some tests failed for stm32f4discovery board. Any ideas why? Is this maybe because I introduced the feature |
It does not make sense add the transceiver feature to the board if the transceiver is not part of the board itself. |
Where else can I put it instead? Because |
That is a conceptional problem. I'll think about it. Maybe @Kijewski wants to do the same. |
@@ -849,7 +860,7 @@ static int send_packet(void) | |||
} | |||
|
|||
puts(""); | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trailing whitespace
uint32_t address = NETDEV_TEST_ADDRESS; | ||
int res = dev->driver->set_option(dev, NETDEV_OPT_ADDRESS, | ||
&address, sizeof(uint32_t)); | ||
#else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your driver should handle the case of smaller values, not the application.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we agreed having 4 bytes is fine? What didn't I understand?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a user sets the option with a 1 byte (or 2 byte, 3 byte maybe but this is ridiculous :-D) number this should be excepted. If the address is 4 byte long in fact only the lowest byte is set [edit] from the 1 byte number and the rest is 0.
@PeterKietzmann #1879 got merged, rebase and refer to it for usage. |
e76fd90
to
8430555
Compare
This reverts commit cfea86a.
8430555
to
39efa40
Compare
62c435d
to
fd3913a
Compare
Hi. Just for clarification: I will follow up with this PR when the network stack is "stable". Maybe the NetworkStackTaskForce will do this :-) |
Sounds like the only valid plan to me! |
I will close this PR and open a new one when I adapted the device to the new |
This PR is based on #1704. It contains a connection between the lowlevel part for the nrf24l01+ transceiver-driver and the netdev interface. I assume there will be several deficits, especially because this device fulfills no standard. So let's discuss this!