1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-27 23:41:18 +01:00

drivers/xbee: use GPIO_UNDEF instead of GPIO_NUMOF

This commit is contained in:
Hauke Petersen 2015-06-14 16:12:47 +02:00
parent 4a4ee44abc
commit 55e0362814
2 changed files with 7 additions and 7 deletions

View File

@ -154,9 +154,9 @@ extern const ng_netdev_driver_t xbee_driver;
* @param[in] uart UART interfaced the device is connected to
* @param[in] baudrate baudrate to use
* @param[in] sleep_pin GPIO pin that is connected to the SLEEP pin, set to
* GPIO_NUMOF if not used
* GPIO_UNDEF if not used
* @param[in] status_pin GPIO pin that is connected to the STATUS pin, set to
* GPIO_NUMOF if not used
* GPIO_UNDEF if not used
*
* @return 0 on success
* @return -ENODEV on invalid device descriptor
@ -172,9 +172,9 @@ typedef struct xbee_params {
uart_t uart; /**< UART interfaced the device is connected to */
uint32_t baudrate; /**< baudrate to use */
gpio_t sleep_pin; /**< GPIO pin that is connected to the SLEEP pin
set to GPIO_NUMOF if not used */
set to GPIO_UNDEF if not used */
gpio_t status_pin; /**< GPIO pin that is connected to the STATUS pin
set to GPIO_NUMOF if not used */
set to GPIO_UNDEF if not used */
} xbee_params_t;
#ifdef __cplusplus

View File

@ -436,14 +436,14 @@ int xbee_init(xbee_t *dev, uart_t uart, uint32_t baudrate,
DEBUG("xbee: Error initializing UART\n");
return -ENXIO;
}
if (reset_pin < GPIO_NUMOF) {
if (reset_pin != GPIO_UNDEF) {
if (gpio_init(reset_pin, GPIO_DIR_OUT, GPIO_NOPULL) < 0) {
DEBUG("xbee: Error initializing RESET pin\n");
return -ENXIO;
}
gpio_set(reset_pin);
}
if (sleep_pin < GPIO_NUMOF) {
if (sleep_pin != GPIO_UNDEF) {
if (gpio_init(sleep_pin, GPIO_DIR_OUT, GPIO_NOPULL) < 0) {
DEBUG("xbee: Error initializing SLEEP pin\n");
return -ENXIO;
@ -451,7 +451,7 @@ int xbee_init(xbee_t *dev, uart_t uart, uint32_t baudrate,
gpio_clear(sleep_pin);
}
/* if reset pin is connected, do a hardware reset */
if (reset_pin < GPIO_NUMOF) {
if (reset_pin != GPIO_UNDEF) {
gpio_clear(reset_pin);
hwtimer_wait(HWTIMER_TICKS(RESET_DELAY));
gpio_set(reset_pin);