-
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
Xbee 802.15.4 modem driver for Arduino #1463
Conversation
nice! I am just wondering: why are you not using the low-level uart driver for this? That would make the board specific part completely obsolete... |
By "low-level UART driver", do you mean the 'sys/uart0' module? |
@rousselk I think @haukepetersen was thinking about using the |
@thomaseichinger I didn't knew about this file... |
@rousselk What you describe is exactly the use-case for the low-level drivers - they were created so that you do not need to have any board specific parts in any high-level driver. Say your boards needs an UART and one additional GPIO pin for the sleep line. The driver should then be based on the UART driver as in int xbee_init(xbee_t *xbee_dev_descr, uart_t uart, gpio_t sleep_pin); The init function can then initialize the peripherals as it needs them - and most importantly: the driver is usable for all boards implementing the low-level drivers. |
we need the abstraction here, without the abstraction this driver is not a RIOT driver....its more a Ardunio driver. |
@mehlis What do you mean with abstraction? I would say using the RIOT low-level driver is all the abstraction we need?! |
Well, then: here's a version using UART and GPIO drivers. |
/*****************************************************************************/ | ||
|
||
/* UART used to communicate with XBee */ | ||
static uart_t xbee_uart_link; |
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 think you can throw out this variable and use XBEE_UART_LINK
instead throughout the driver.
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.
Yes, it's a leftover of a previous version that I forgot to delete.
looks good. Should you maybe export the drivers public functions in the |
Wouldn't it be redundant with the |
Sorry, you're completely right, I overlooked that one. |
Rebased on master, and squashed into an unique commit. |
.channel_is_clear = xbee_channel_clear, | ||
.set_promiscuous_mode = xbee_set_monitor, | ||
.in_promiscuous_mode = xbee_get_monitor | ||
}; |
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.
This is illegal in C++, as far as I know. Use parameter-less initialisation instead.
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.
No need to enforce C++ rules in .c files.
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.
Even if this gets compiled with a C++ compiler?
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.
We don't use a C++ compiler to compile .c files. Probably most of RIOT would be broken if you compile it with g++, because of some subtle differences between C and C++.
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.
kk
|
||
/* identifier of the GPIO pin linked to the ON/SLEEP pin (pin 13) of the XBee | ||
module (input that gives the online or sleeping status of the module) */ | ||
#define XBEE_ON_STATUS_GPIO GPIO_UNDEFINED |
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.
With regards to #1492 this would be a struct in drivers/include/xbee.h
extending net_dev_t
typedef struct {
net_dev_type_t type; /* set to NET_DEV_TYPE_802154 */
net_dev_802154_driver_t *driver; /* net_dev_802154_driver_t is a net_dev
compatible rewrite of your
ieee802154_driver_t; set to fitted
xbee_radio_driver_t */
uart_t uart_link;
gpio_t sleep_rq_gpio;
gpio_t on_status_gpio;
} xbee_net_dev_t
and this way be configured by the user at runtime.
@authmillenon (Sorry for my late reply, I was absent till yesterday.) |
Closing this PR, beceause I need to rebuild my own RIOT repository... |
This radio driver allows to use an XBee 802.15.4 modem with an Arduino board, using the official Arduino Wireless/SD shield (see http://arduino.cc/en/Main/ArduinoWirelessShield) for connection.