You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by mi...@apache.org on 2026/10/19 08:22:49 UTC
(nuttx) 04/06: drivers/lcd, modem, wireless: Fix the nxstyle errors in 7 files.
This is an automated email from the ASF dual-hosted git repository.
michallenc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit e8a525ef664146c995762a6e01cce616fc5c66ea
Author: Marco Casaroli <ma...@gmail.com>
AuthorDate: Mon Oct 19 00:19:20 2026 +0200
drivers/lcd, modem, wireless: Fix the nxstyle errors in 7 files.
Fix the older nxstyle errors in these files: indentation, alignment of
braces and comments, and the blank line after declarations. This is a
layout change only. The C tokens do not change, except ten pairs of
braces around single statements in cc1101.c. tools/nxstyle.c reports no
error for them now.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <ma...@gmail.com>
---
drivers/lcd/pcf8574_lcd_backpack.c | 605 +++++++++++++++++----------------
drivers/lcd/tda19988.c | 14 +-
drivers/modem/alt1250/alt1250.c | 1 +
drivers/modem/u-blox.c | 122 +++----
drivers/wireless/cc1101.c | 51 ++-
drivers/wireless/lpwan/sx127x/sx127x.c | 12 +
drivers/wireless/nrf24l01.c | 200 ++++++-----
7 files changed, 540 insertions(+), 465 deletions(-)
diff --git a/drivers/lcd/pcf8574_lcd_backpack.c b/drivers/lcd/pcf8574_lcd_backpack.c
index 37145e6c8f2..7d691820b32 100644
--- a/drivers/lcd/pcf8574_lcd_backpack.c
+++ b/drivers/lcd/pcf8574_lcd_backpack.c
@@ -497,6 +497,7 @@ static inline uint8_t lcd_getdata(FAR struct pcf8574_lcd_dev_s *priv)
static inline uint8_t lcd_getcmd(FAR struct pcf8574_lcd_dev_s *priv)
{
uint8_t data;
+
data = (load_nybble(priv, false) << 4) | load_nybble(priv, false);
return data;
}
@@ -736,238 +737,241 @@ static void lcd_codec_action(FAR struct pcf8574_lcd_dev_s *priv,
{
/* Erasure */
- case SLCDCODE_BACKDEL: /* Backspace (backward delete) N characters */
- {
- if (count <= 0) /* silly case */
- {
- break;
- }
- else
- {
- uint8_t row;
- uint8_t col;
+ case SLCDCODE_BACKDEL: /* Backspace (backward delete) N characters */
+ {
+ if (count <= 0) /* silly case */
+ {
+ break;
+ }
+ else
+ {
+ uint8_t row;
+ uint8_t col;
- lcd_get_curpos(priv, &row, &col);
- if (count > col) /* saturate to preceding columns available */
- {
- count = col;
- }
+ lcd_get_curpos(priv, &row, &col);
+ if (count > col) /* saturate to preceding columns available */
+ {
+ count = col;
+ }
- lcd_set_curpos(priv, row, col - count);
- }
+ lcd_set_curpos(priv, row, col - count);
+ }
- /* ... and conscientiously fall through to next case ... */
- }
+ /* ... and conscientiously fall through to next case ... */
+ }
- case SLCDCODE_FWDDEL: /* Delete (forward delete) N characters, moving text */
- {
- if (count <= 0) /* silly case */
- {
- break;
- }
- else
+ case SLCDCODE_FWDDEL: /* Delete (forward delete) N characters, moving
+ * text */
+ {
+ if (count <= 0) /* silly case */
+ {
+ break;
+ }
+ else
+ {
+ uint8_t row;
+ uint8_t col;
+ uint8_t start;
+ uint8_t end;
+ uint8_t nidx;
+ uint8_t data;
+
+ lcd_get_curpos(priv, &row, &col);
+ start = col + count;
+
+ if (start >= priv->cfg.cols) /* silly case of nothing left */
+ {
+ break;
+ }
+
+ end = start + count;
+ if (end > priv->cfg.cols) /* saturate */
+ {
+ end = priv->cfg.cols;
+ }
+
+ for (nidx = col; nidx < end; ++start, ++nidx) /* much like
+ * memmove */
+ {
+ lcd_set_curpos(priv, row, start);
+ data = lcd_getdata(priv);
+ lcd_set_curpos(priv, row, nidx);
+ lcd_putdata(priv, data);
+ }
+
+ for (; nidx < priv->cfg.cols; ++nidx) /* much like memset */
+ {
+ lcd_putdata(priv, ' ');
+ }
+
+ lcd_set_curpos(priv, row, col);
+ }
+ }
+ break;
+
+ case SLCDCODE_ERASE: /* Erase N characters from the cursor position */
+ if (count > 0)
{
uint8_t row;
uint8_t col;
- uint8_t start;
uint8_t end;
uint8_t nidx;
- uint8_t data;
lcd_get_curpos(priv, &row, &col);
- start = col + count;
-
- if (start >= priv->cfg.cols) /* silly case of nothing left */
- {
- break;
- }
-
- end = start + count;
- if (end > priv->cfg.cols) /* saturate */
+ end = col + count;
+ if (end > priv->cfg.cols)
{
end = priv->cfg.cols;
}
- for (nidx = col; nidx < end; ++start, ++nidx) /* much like memmove */
- {
- lcd_set_curpos(priv, row, start);
- data = lcd_getdata(priv);
- lcd_set_curpos(priv, row, nidx);
- lcd_putdata(priv, data);
- }
-
- for (; nidx < priv->cfg.cols; ++nidx) /* much like memset */
+ for (nidx = col; nidx < end; ++nidx)
{
lcd_putdata(priv, ' ');
}
lcd_set_curpos(priv, row, col);
}
- }
- break;
+ break;
+
+ case SLCDCODE_CLEAR: /* Home the cursor and erase the entire display */
+ {
+ lcd_putcmd(priv, CMD_CLEAR);
+ up_udelay(DELAY_US_HOMECLEAR); /* clear needs extra time */
+ }
+ break;
- case SLCDCODE_ERASE: /* Erase N characters from the cursor position */
- if (count > 0)
+ case SLCDCODE_ERASEEOL: /* Erase from the cursor position to the end
+ * of line */
{
uint8_t row;
uint8_t col;
- uint8_t end;
uint8_t nidx;
lcd_get_curpos(priv, &row, &col);
- end = col + count;
- if (end > priv->cfg.cols)
- {
- end = priv->cfg.cols;
- }
- for (nidx = col; nidx < end; ++nidx)
+ for (nidx = col; nidx < priv->cfg.cols; ++nidx)
{
lcd_putdata(priv, ' ');
}
lcd_set_curpos(priv, row, col);
}
- break;
-
- case SLCDCODE_CLEAR: /* Home the cursor and erase the entire display */
- {
- lcd_putcmd(priv, CMD_CLEAR);
- up_udelay(DELAY_US_HOMECLEAR); /* clear needs extra time */
- }
- break;
-
- case SLCDCODE_ERASEEOL: /* Erase from the cursor position to the end of
- * line */
- {
- uint8_t row;
- uint8_t col;
- uint8_t nidx;
-
- lcd_get_curpos(priv, &row, &col);
-
- for (nidx = col; nidx < priv->cfg.cols; ++nidx)
- {
- lcd_putdata(priv, ' ');
- }
-
- lcd_set_curpos(priv, row, col);
- }
- break;
+ break;
/* Cursor movement */
- case SLCDCODE_LEFT: /* Cursor left by N characters */
- {
- uint8_t row;
- uint8_t col;
+ case SLCDCODE_LEFT: /* Cursor left by N characters */
+ {
+ uint8_t row;
+ uint8_t col;
- lcd_get_curpos(priv, &row, &col);
- if (count > col)
- {
- col = 0;
- }
- else
- {
- col -= count;
- }
+ lcd_get_curpos(priv, &row, &col);
+ if (count > col)
+ {
+ col = 0;
+ }
+ else
+ {
+ col -= count;
+ }
- lcd_set_curpos(priv, row, col);
- }
- break;
+ lcd_set_curpos(priv, row, col);
+ }
+ break;
- case SLCDCODE_RIGHT: /* Cursor right by N characters */
- {
- uint8_t row;
- uint8_t col;
+ case SLCDCODE_RIGHT: /* Cursor right by N characters */
+ {
+ uint8_t row;
+ uint8_t col;
- lcd_get_curpos(priv, &row, &col);
- col += count;
- if (col >= priv->cfg.cols)
- {
- col = priv->cfg.cols - 1;
- }
+ lcd_get_curpos(priv, &row, &col);
+ col += count;
+ if (col >= priv->cfg.cols)
+ {
+ col = priv->cfg.cols - 1;
+ }
- lcd_set_curpos(priv, row, col);
- }
- break;
+ lcd_set_curpos(priv, row, col);
+ }
+ break;
- case SLCDCODE_UP: /* Cursor up by N lines */
- {
- uint8_t row;
- uint8_t col;
+ case SLCDCODE_UP: /* Cursor up by N lines */
+ {
+ uint8_t row;
+ uint8_t col;
- lcd_get_curpos(priv, &row, &col);
- if (count > row)
- {
- row = 0;
- }
- else
- {
- row -= count;
- }
+ lcd_get_curpos(priv, &row, &col);
+ if (count > row)
+ {
+ row = 0;
+ }
+ else
+ {
+ row -= count;
+ }
- lcd_set_curpos(priv, row, col);
- }
- break;
+ lcd_set_curpos(priv, row, col);
+ }
+ break;
- case SLCDCODE_DOWN: /* Cursor down by N lines */
- {
- uint8_t row;
- uint8_t col;
+ case SLCDCODE_DOWN: /* Cursor down by N lines */
+ {
+ uint8_t row;
+ uint8_t col;
- lcd_get_curpos(priv, &row, &col);
- row += count;
- if (row >= priv->cfg.rows)
- {
- row = priv->cfg.rows - 1;
- }
+ lcd_get_curpos(priv, &row, &col);
+ row += count;
+ if (row >= priv->cfg.rows)
+ {
+ row = priv->cfg.rows - 1;
+ }
- lcd_set_curpos(priv, row, col);
- }
- break;
+ lcd_set_curpos(priv, row, col);
+ }
+ break;
- case SLCDCODE_HOME: /* Cursor home */
- {
- uint8_t row;
- uint8_t col;
+ case SLCDCODE_HOME: /* Cursor home */
+ {
+ uint8_t row;
+ uint8_t col;
- lcd_get_curpos(priv, &row, &col);
- lcd_set_curpos(priv, row, 0);
- }
- break;
+ lcd_get_curpos(priv, &row, &col);
+ lcd_set_curpos(priv, row, 0);
+ }
+ break;
- case SLCDCODE_END: /* Cursor end */
- {
- uint8_t row;
- uint8_t col;
+ case SLCDCODE_END: /* Cursor end */
+ {
+ uint8_t row;
+ uint8_t col;
- lcd_get_curpos(priv, &row, &col);
- lcd_set_curpos(priv, row, priv->cfg.cols - 1);
- }
- break;
+ lcd_get_curpos(priv, &row, &col);
+ lcd_set_curpos(priv, row, priv->cfg.cols - 1);
+ }
+ break;
- case SLCDCODE_PAGEUP: /* Cursor up by N pages */
- case SLCDCODE_PAGEDOWN: /* Cursor down by N pages */
- break; /* Not supportable on this SLCD */
+ case SLCDCODE_PAGEUP: /* Cursor up by N pages */
+ case SLCDCODE_PAGEDOWN: /* Cursor down by N pages */
+ break; /* Not supportable on this SLCD */
/* Blinking */
- case SLCDCODE_BLINKSTART: /* Start blinking with current cursor position */
- lcd_putcmd(priv, CMD_CURSOR_ON_BLINK);
- break;
+ case SLCDCODE_BLINKSTART: /* Start blinking with current cursor
+ * position */
+ lcd_putcmd(priv, CMD_CURSOR_ON_BLINK);
+ break;
- case SLCDCODE_BLINKEND: /* End blinking after the current cursor
- * position */
- case SLCDCODE_BLINKOFF: /* Turn blinking off */
- lcd_putcmd(priv, CMD_CURSOR_OFF);
- break; /* Not implemented */
+ case SLCDCODE_BLINKEND: /* End blinking after the current cursor
+ * position */
+ case SLCDCODE_BLINKOFF: /* Turn blinking off */
+ lcd_putcmd(priv, CMD_CURSOR_OFF);
+ break; /* Not implemented */
/* These are actually unreportable errors */
- default:
- case SLCDCODE_NORMAL: /* Not a special keycode */
- break;
+ default:
+ case SLCDCODE_NORMAL: /* Not a special keycode */
+ break;
}
}
@@ -1358,54 +1362,54 @@ static off_t pcf8574_lcd_seek(FAR struct file *filep, off_t offset,
switch (whence)
{
- case SEEK_CUR:
- pos += offset;
- if (pos > maxpos)
- {
- pos = maxpos;
- }
- else if (pos < 0)
- {
- pos = 0;
- }
+ case SEEK_CUR:
+ pos += offset;
+ if (pos > maxpos)
+ {
+ pos = maxpos;
+ }
+ else if (pos < 0)
+ {
+ pos = 0;
+ }
- filep->f_pos = pos;
- break;
+ filep->f_pos = pos;
+ break;
- case SEEK_SET:
- pos = offset;
- if (pos > maxpos)
- {
- pos = maxpos;
- }
- else if (pos < 0)
- {
- pos = 0;
- }
+ case SEEK_SET:
+ pos = offset;
+ if (pos > maxpos)
+ {
+ pos = maxpos;
+ }
+ else if (pos < 0)
+ {
+ pos = 0;
+ }
- filep->f_pos = pos;
- break;
+ filep->f_pos = pos;
+ break;
- case SEEK_END:
- pos = maxpos + offset;
- if (pos > maxpos)
- {
- pos = maxpos;
- }
- else if (pos < 0)
- {
- pos = 0;
- }
+ case SEEK_END:
+ pos = maxpos + offset;
+ if (pos > maxpos)
+ {
+ pos = maxpos;
+ }
+ else if (pos < 0)
+ {
+ pos = 0;
+ }
- filep->f_pos = pos;
- break;
+ filep->f_pos = pos;
+ break;
- default:
+ default:
- /* Return EINVAL if the whence argument is invalid */
+ /* Return EINVAL if the whence argument is invalid */
- pos = (off_t) - EINVAL;
- break;
+ pos = (off_t) - EINVAL;
+ break;
}
nxmutex_unlock(&priv->lock);
@@ -1425,96 +1429,97 @@ static int pcf8574_lcd_ioctl(FAR struct file *filep, int cmd,
{
switch (cmd)
{
- case SLCDIOC_GETATTRIBUTES: /* SLCDIOC_GETATTRIBUTES: Get the
- * attributes of the SLCD */
- {
- FAR struct inode *inode = filep->f_inode;
- FAR struct pcf8574_lcd_dev_s *priv =
- inode->i_private;
- FAR struct slcd_attributes_s *attr =
- (FAR struct slcd_attributes_s *)((uintptr_t) arg);
-
- lcdinfo("SLCDIOC_GETATTRIBUTES:\n");
-
- if (!attr)
- {
- return -EINVAL;
- }
+ case SLCDIOC_GETATTRIBUTES: /* SLCDIOC_GETATTRIBUTES: Get the
+ * attributes of the SLCD */
+ {
+ FAR struct inode *inode = filep->f_inode;
+ FAR struct pcf8574_lcd_dev_s *priv =
+ inode->i_private;
+ FAR struct slcd_attributes_s *attr =
+ (FAR struct slcd_attributes_s *)((uintptr_t) arg);
+
+ lcdinfo("SLCDIOC_GETATTRIBUTES:\n");
+
+ if (!attr)
+ {
+ return -EINVAL;
+ }
+
+ attr->nrows = priv->cfg.rows;
+ attr->ncolumns = priv->cfg.cols;
+ attr->nbars = 0;
+ attr->maxcontrast = 0;
+ attr->maxbrightness = 1; /* 'brightness' for us is the backlight */
+ }
+ break;
+
+ case SLCDIOC_CURPOS: /* SLCDIOC_CURPOS: Get the SLCD cursor position */
+ {
+ FAR struct inode *inode = filep->f_inode;
+ FAR struct pcf8574_lcd_dev_s *priv =
+ inode->i_private;
+ FAR struct slcd_curpos_s *attr =
+ (FAR struct slcd_curpos_s *)((uintptr_t) arg);
+ uint8_t row;
+ uint8_t col;
+
+ nxmutex_lock(&priv->lock);
+
+ lcd_get_curpos(priv, &row, &col);
+ attr->row = row;
+ attr->column = col;
- attr->nrows = priv->cfg.rows;
- attr->ncolumns = priv->cfg.cols;
- attr->nbars = 0;
- attr->maxcontrast = 0;
- attr->maxbrightness = 1; /* 'brightness' for us is the backlight */
- }
- break;
-
- case SLCDIOC_CURPOS: /* SLCDIOC_CURPOS: Get the SLCD cursor position */
- {
- FAR struct inode *inode = filep->f_inode;
- FAR struct pcf8574_lcd_dev_s *priv =
- inode->i_private;
- FAR struct slcd_curpos_s *attr =
- (FAR struct slcd_curpos_s *)((uintptr_t) arg);
- uint8_t row;
- uint8_t col;
-
- nxmutex_lock(&priv->lock);
-
- lcd_get_curpos(priv, &row, &col);
- attr->row = row;
- attr->column = col;
-
- nxmutex_unlock(&priv->lock);
- }
- break;
-
- case SLCDIOC_GETBRIGHTNESS: /* Get the current brightness setting */
- {
- FAR struct inode *inode = filep->f_inode;
- FAR struct pcf8574_lcd_dev_s *priv =
- inode->i_private;
- bool bon;
-
- bon = (priv->bl_bit && priv->cfg.bl_active_high) ||
- (!priv->bl_bit && !priv->cfg.bl_active_high);
- *(FAR int *)((uintptr_t) arg) = bon ? 1 : 0;
- }
- break;
-
- case SLCDIOC_SETBRIGHTNESS: /* Set the brightness to a new value */
- {
- FAR struct inode *inode = filep->f_inode;
- FAR struct pcf8574_lcd_dev_s *priv =
- inode->i_private;
-
- nxmutex_lock(&priv->lock);
- lcd_backlight(priv, arg ? true : false);
- nxmutex_unlock(&priv->lock);
- }
- break;
-
- case SLCDIOC_CREATECHAR: /* Create a custom character pattern */
- {
- FAR struct inode *inode = filep->f_inode;
- FAR struct pcf8574_lcd_dev_s *priv =
- inode->i_private;
- FAR struct slcd_createchar_s *attr =
- (FAR struct slcd_createchar_s *)((uintptr_t) arg);
-
- nxmutex_lock(&priv->lock);
- lcd_create_char(priv, attr->idx, attr->bmp);
- nxmutex_unlock(&priv->lock);
- }
- break;
-
- case SLCDIOC_SETBAR: /* SLCDIOC_SETBAR: Set bars on a bar display */
- case SLCDIOC_GETCONTRAST: /* SLCDIOC_GETCONTRAST: Get the current
- * contrast setting */
- case SLCDIOC_SETCONTRAST: /* SLCDIOC_SETCONTRAST: Set the contrast to a
- * new value */
- default:
- return -ENOTTY;
+ nxmutex_unlock(&priv->lock);
+ }
+ break;
+
+ case SLCDIOC_GETBRIGHTNESS: /* Get the current brightness setting */
+ {
+ FAR struct inode *inode = filep->f_inode;
+ FAR struct pcf8574_lcd_dev_s *priv =
+ inode->i_private;
+ bool bon;
+
+ bon = (priv->bl_bit && priv->cfg.bl_active_high) ||
+ (!priv->bl_bit && !priv->cfg.bl_active_high);
+ *(FAR int *)((uintptr_t) arg) = bon ? 1 : 0;
+ }
+ break;
+
+ case SLCDIOC_SETBRIGHTNESS: /* Set the brightness to a new value */
+ {
+ FAR struct inode *inode = filep->f_inode;
+ FAR struct pcf8574_lcd_dev_s *priv =
+ inode->i_private;
+
+ nxmutex_lock(&priv->lock);
+ lcd_backlight(priv, arg ? true : false);
+ nxmutex_unlock(&priv->lock);
+ }
+ break;
+
+ case SLCDIOC_CREATECHAR: /* Create a custom character pattern */
+ {
+ FAR struct inode *inode = filep->f_inode;
+ FAR struct pcf8574_lcd_dev_s *priv =
+ inode->i_private;
+ FAR struct slcd_createchar_s *attr =
+ (FAR struct slcd_createchar_s *)((uintptr_t) arg);
+
+ nxmutex_lock(&priv->lock);
+ lcd_create_char(priv, attr->idx, attr->bmp);
+ nxmutex_unlock(&priv->lock);
+ }
+ break;
+
+ case SLCDIOC_SETBAR: /* SLCDIOC_SETBAR: Set bars on a bar
+ * display */
+ case SLCDIOC_GETCONTRAST: /* SLCDIOC_GETCONTRAST: Get the current
+ * contrast setting */
+ case SLCDIOC_SETCONTRAST: /* SLCDIOC_SETCONTRAST: Set the contrast to
+ * a new value */
+ default:
+ return -ENOTTY;
}
return OK;
diff --git a/drivers/lcd/tda19988.c b/drivers/lcd/tda19988.c
index 520617cee8b..8ce694d5c78 100644
--- a/drivers/lcd/tda19988.c
+++ b/drivers/lcd/tda19988.c
@@ -1309,14 +1309,14 @@ static int tda19988_hwinitialize(FAR struct tda1988_dev_s *priv)
priv->version = version & ~0x30;
switch (priv->version)
{
- case HDMI_CTRL_REV_TDA19988:
- lcdinfo("TDA19988\n");
- break;
+ case HDMI_CTRL_REV_TDA19988:
+ lcdinfo("TDA19988\n");
+ break;
- default:
- lcderr("ERROR: Unknown device: %04x\n", priv->version);
- ret = -ENODEV;
- goto done;
+ default:
+ lcderr("ERROR: Unknown device: %04x\n", priv->version);
+ ret = -ENODEV;
+ goto done;
}
tda19988_hdmi_putreg(priv, HDMI_CTRL_DDC_CTRL_REG, HDMI_CTRL_DDC_EN);
diff --git a/drivers/modem/alt1250/alt1250.c b/drivers/modem/alt1250/alt1250.c
index 934ef6f417a..ebfcd2af0b8 100644
--- a/drivers/modem/alt1250/alt1250.c
+++ b/drivers/modem/alt1250/alt1250.c
@@ -1296,6 +1296,7 @@ static int alt1250_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
{
FAR struct alt_evtbuffer_s *buff =
(FAR struct alt_evtbuffer_s *)arg;
+
add_evtbuff(dev, buff);
}
break;
diff --git a/drivers/modem/u-blox.c b/drivers/modem/u-blox.c
index 3f414e477eb..f2a3f973c7e 100644
--- a/drivers/modem/u-blox.c
+++ b/drivers/modem/u-blox.c
@@ -161,94 +161,94 @@ static int ubxmdm_ioctl(FAR struct file *filep,
* arg: Ignored
*/
- case MODEM_IOC_POWERON:
- if (lower->ops->poweron)
- {
- ret = lower->ops->poweron(lower);
- }
- else
- {
- ret = -ENOSYS;
- }
-
- break;
+ case MODEM_IOC_POWERON:
+ if (lower->ops->poweron)
+ {
+ ret = lower->ops->poweron(lower);
+ }
+ else
+ {
+ ret = -ENOSYS;
+ }
+
+ break;
/* cmd: UBXMDM_IOC_STOP
* Description:
* arg: Ignored
*/
- case MODEM_IOC_POWEROFF:
- if (lower->ops->poweroff)
- {
- ret = lower->ops->poweroff(lower);
- }
- else
- {
- ret = -ENOSYS;
- }
+ case MODEM_IOC_POWEROFF:
+ if (lower->ops->poweroff)
+ {
+ ret = lower->ops->poweroff(lower);
+ }
+ else
+ {
+ ret = -ENOSYS;
+ }
- break;
+ break;
/* cmd: UBXMDM_IOC_RESET
* Description:
* arg: Ignored
*/
- case MODEM_IOC_RESET:
- if (lower->ops->reset)
- {
- ret = lower->ops->reset(lower);
- }
- else
- {
- ret = -ENOSYS;
- }
+ case MODEM_IOC_RESET:
+ if (lower->ops->reset)
+ {
+ ret = lower->ops->reset(lower);
+ }
+ else
+ {
+ ret = -ENOSYS;
+ }
- break;
+ break;
/* cmd: UBXMDM_IOC_GETSTATUS
* Description:
* arg: Writeable pointer to struct ubxmdm_status.
*/
- case MODEM_IOC_GETSTATUS:
- if (lower->ops->getstatus)
- {
- status = (FAR struct ubxmdm_status *)((uintptr_t)arg);
- if (status)
- {
- ret = lower->ops->getstatus(lower, status);
- }
- else
- {
- ret = -EINVAL;
- }
- }
- else
- {
- ret = -ENOSYS;
- }
-
- break;
+ case MODEM_IOC_GETSTATUS:
+ if (lower->ops->getstatus)
+ {
+ status = (FAR struct ubxmdm_status *)((uintptr_t)arg);
+ if (status)
+ {
+ ret = lower->ops->getstatus(lower, status);
+ }
+ else
+ {
+ ret = -EINVAL;
+ }
+ }
+ else
+ {
+ ret = -ENOSYS;
+ }
+
+ break;
/* Unrecognized IOCTL commands are forwarded to the lower-half IOCTL
* handler, if defined.
*/
- default:
- m_info("Forwarding unrecognized cmd: %d arg: %ld\n", cmd, arg);
+ default:
+ m_info("Forwarding unrecognized cmd: %d arg: %ld\n", cmd, arg);
- if (lower->ops->ioctl)
- {
- ret = lower->ops->ioctl(lower, cmd, arg);
- }
- else
- {
- ret = -ENOTTY;
- }
+ if (lower->ops->ioctl)
+ {
+ ret = lower->ops->ioctl(lower, cmd, arg);
+ }
+ else
+ {
+ ret = -ENOTTY;
+ }
- break;
+ break;
}
return ret;
diff --git a/drivers/wireless/cc1101.c b/drivers/wireless/cc1101.c
index d8a69e077ee..b736f45e5d4 100644
--- a/drivers/wireless/cc1101.c
+++ b/drivers/wireless/cc1101.c
@@ -1256,6 +1256,7 @@ int cc1101_setgdo(FAR struct cc1101_dev_s *dev, uint8_t pin,
/* Force XOSC to stay active even in sleep mode */
int value = CC1101_MCSM0_VALUE | CC1101_MCSM0_XOSC_FORCE_ON;
+
cc1101_access(dev, CC1101_MCSM0, (FAR uint8_t *)&value, -1);
dev->flags |= FLAGS_XOSCENABLED;
@@ -1265,6 +1266,7 @@ int cc1101_setgdo(FAR struct cc1101_dev_s *dev, uint8_t pin,
/* Disable XOSC in sleep mode */
int value = CC1101_MCSM0_VALUE;
+
cc1101_access(dev, CC1101_MCSM0, (FAR uint8_t *)&value, -1);
dev->flags &= ~FLAGS_XOSCENABLED;
@@ -1430,10 +1432,22 @@ static int cc1101_ioctl_apply_power(FAR struct cc1101_dev_s *dev,
return -EIO;
}
- if (freq2 < 0x10) band_idx = 0; /* 315 MHz */
- else if (freq2 < 0x20) band_idx = 1; /* 433 MHz */
- else if (freq2 < 0x22) band_idx = 2; /* 868 MHz */
- else band_idx = 3; /* 915 MHz */
+ if (freq2 < 0x10)
+ {
+ band_idx = 0; /* 315 MHz */
+ }
+ else if (freq2 < 0x20)
+ {
+ band_idx = 1; /* 433 MHz */
+ }
+ else if (freq2 < 0x22)
+ {
+ band_idx = 2; /* 868 MHz */
+ }
+ else
+ {
+ band_idx = 3; /* 915 MHz */
+ }
/* Fact detection 2: Read modulation format to decide whether to
* keep ramp-up curve.
@@ -1455,7 +1469,10 @@ static int cc1101_ioctl_apply_power(FAR struct cc1101_dev_s *dev,
patable[0] = 0x00;
patable[1] = g_cc1101_pa_calibration[band_idx][pwr_idx];
- for (i = 2; i < 8; i++) patable[i] = 0x00; /* Eliminate memory residue */
+ for (i = 2; i < 8; i++)
+ {
+ patable[i] = 0x00; /* Eliminate memory residue */
+ }
/* Apply 8-byte burst write to cover the entire PATABLE space */
@@ -1470,19 +1487,29 @@ static int cc1101_ioctl_apply_power(FAR struct cc1101_dev_s *dev,
for (i = 0; i < 8; i++)
{
if (i <= pwr_idx)
- patable[i] = g_cc1101_pa_calibration[band_idx][i];
+ {
+ patable[i] = g_cc1101_pa_calibration[band_idx][i];
+ }
else
- patable[i] = g_cc1101_pa_calibration[band_idx][pwr_idx]; /* Stay flat (Plateau) after reaching target power */
+ {
+ patable[i] = g_cc1101_pa_calibration[band_idx][pwr_idx]; /* Stay flat (Plateau) after reaching target power */
+ }
}
ret = cc1101_access(dev, CC1101_PATABLE, patable, -8);
}
- if (ret < 0) return -EIO;
+ if (ret < 0)
+ {
+ return -EIO;
+ }
/* Update FREND0.PA_POWER index, but must keep TX filter high bits */
- if (cc1101_access(dev, CC1101_FREND0, &frend0, 1) < 0) return -EIO;
+ if (cc1101_access(dev, CC1101_FREND0, &frend0, 1) < 0)
+ {
+ return -EIO;
+ }
frend0 &= 0xf8; /* Clear bottom 3 control bits */
frend0 |= (mod_format == 0x03) ? 1 : 7;
@@ -1754,6 +1781,7 @@ void cc1101_isr_process(FAR void *arg)
{
DEBUGASSERT(arg);
FAR struct cc1101_dev_s *dev = (struct cc1101_dev_s *)arg;
+
switch (dev->status)
{
case CC1101_SEND:
@@ -1964,7 +1992,10 @@ static int cc1101_file_ioctl(FAR struct file *filep, int cmd,
for (i = 0; i < 8; i++)
{
diff = req_dbm - g_cc1101_dbm_table[i];
- if (diff < 0) diff = -diff;
+ if (diff < 0)
+ {
+ diff = -diff;
+ }
if (diff < min_diff)
{
diff --git a/drivers/wireless/lpwan/sx127x/sx127x.c b/drivers/wireless/lpwan/sx127x/sx127x.c
index 6aba75ddd81..8ecfb45cc3c 100644
--- a/drivers/wireless/lpwan/sx127x/sx127x.c
+++ b/drivers/wireless/lpwan/sx127x/sx127x.c
@@ -1024,6 +1024,7 @@ static int sx127x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case WLIOC_SETRADIOFREQ:
{
FAR uint32_t *ptr = (FAR uint32_t *)((uintptr_t)arg);
+
DEBUGASSERT(ptr != NULL);
sx127x_frequency_set(dev, *ptr);
@@ -1037,6 +1038,7 @@ static int sx127x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case WLIOC_GETRADIOFREQ:
{
FAR int8_t *ptr = (FAR int8_t *)((uintptr_t)arg);
+
DEBUGASSERT(ptr != NULL);
*ptr = sx127x_frequency_get(dev);
@@ -1048,6 +1050,7 @@ static int sx127x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case WLIOC_SETTXPOWER:
{
FAR int8_t *ptr = (FAR int8_t *)((uintptr_t)arg);
+
DEBUGASSERT(ptr != NULL);
sx127x_power_set(dev, *ptr);
@@ -1059,6 +1062,7 @@ static int sx127x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case WLIOC_GETTXPOWER:
{
FAR int8_t *ptr = (FAR int8_t *)((uintptr_t)arg);
+
DEBUGASSERT(ptr != NULL);
*ptr = sx127x_power_get(dev);
@@ -1070,6 +1074,7 @@ static int sx127x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case SX127XIOC_RSSIGET:
{
FAR int16_t *ptr = (FAR int16_t *)((uintptr_t)arg);
+
DEBUGASSERT(ptr != NULL);
*ptr = sx127x_rssi_get(dev);
@@ -1081,6 +1086,7 @@ static int sx127x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case SX127XIOC_MODULATIONSET:
{
FAR uint8_t *ptr = (FAR uint8_t *)((uintptr_t)arg);
+
DEBUGASSERT(ptr != NULL);
ret = sx127x_modulation_set(dev, *ptr);
@@ -1092,6 +1098,7 @@ static int sx127x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case SX127XIOC_MODULATIONGET:
{
FAR uint8_t *ptr = (FAR uint8_t *)((uintptr_t)arg);
+
DEBUGASSERT(ptr != NULL);
*ptr = sx127x_modulation_get(dev);
@@ -1103,6 +1110,7 @@ static int sx127x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case SX127XIOC_OPMODESET:
{
FAR uint8_t *ptr = (FAR uint8_t *)((uintptr_t)arg);
+
DEBUGASSERT(ptr != NULL);
ret = sx127x_opmode_set(dev, *ptr);
@@ -1114,6 +1122,7 @@ static int sx127x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case SX127XIOC_OPMODEGET:
{
FAR uint8_t *ptr = (FAR uint8_t *)((uintptr_t)arg);
+
DEBUGASSERT(ptr != NULL);
*ptr = sx127x_opmode_get(dev);
@@ -1137,6 +1146,7 @@ static int sx127x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case SX127XIOC_PREAMBLESET:
{
FAR int *ptr = (FAR int *)((uintptr_t)arg);
+
DEBUGASSERT(ptr != NULL);
sx127x_preamble_set(dev, *ptr);
@@ -1148,6 +1158,7 @@ static int sx127x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case SX127XIOC_PREAMBLEGET:
{
FAR int *ptr = (FAR int *)((uintptr_t)arg);
+
DEBUGASSERT(ptr != NULL);
*ptr = sx127x_preamble_get(dev);
@@ -1177,6 +1188,7 @@ static int sx127x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case SX127XIOC_RANDOMGET:
{
FAR uint32_t *ptr = (FAR uint32_t *)((uintptr_t)arg);
+
DEBUGASSERT(ptr != NULL);
*ptr = sx127x_random_get(dev);
diff --git a/drivers/wireless/nrf24l01.c b/drivers/wireless/nrf24l01.c
index d2ffd459920..d0f7e5f5a8a 100644
--- a/drivers/wireless/nrf24l01.c
+++ b/drivers/wireless/nrf24l01.c
@@ -365,16 +365,16 @@ static uint8_t nrf24l01_access(FAR struct nrf24l01_dev_s *dev,
switch (mode)
{
- case MODE_WRITE:
- if (length > 0)
- {
- SPI_SNDBLOCK(dev->spi, buf, length);
- }
- break;
+ case MODE_WRITE:
+ if (length > 0)
+ {
+ SPI_SNDBLOCK(dev->spi, buf, length);
+ }
+ break;
- case MODE_READ:
- SPI_RECVBLOCK(dev->spi, buf, length);
- break;
+ case MODE_READ:
+ SPI_RECVBLOCK(dev->spi, buf, length);
+ break;
}
nrf24l01_deselect(dev);
@@ -427,6 +427,7 @@ static inline uint8_t nrf24l01_readregbyte(FAR struct nrf24l01_dev_s *dev,
uint8_t reg)
{
uint8_t val;
+
nrf24l01_readreg(dev, reg, &val, 1);
return val;
}
@@ -779,25 +780,25 @@ static void nrf24l01_tostate(FAR struct nrf24l01_dev_s *dev,
switch (state)
{
- case ST_UNKNOWN:
+ case ST_UNKNOWN:
- /* Power down the module here... */
+ /* Power down the module here... */
- case ST_POWER_DOWN:
- nrf24l01_chipenable(dev, false);
- nrf24l01_setregbit(dev, NRF24L01_CONFIG, NRF24L01_PWR_UP, false);
- break;
+ case ST_POWER_DOWN:
+ nrf24l01_chipenable(dev, false);
+ nrf24l01_setregbit(dev, NRF24L01_CONFIG, NRF24L01_PWR_UP, false);
+ break;
- case ST_STANDBY:
- nrf24l01_chipenable(dev, false);
- nrf24l01_setregbit(dev, NRF24L01_CONFIG, NRF24L01_PRIM_RX, false);
- break;
+ case ST_STANDBY:
+ nrf24l01_chipenable(dev, false);
+ nrf24l01_setregbit(dev, NRF24L01_CONFIG, NRF24L01_PRIM_RX, false);
+ break;
#ifdef CONFIG_WL_NRF24L01_RXSUPPORT
- case ST_RX:
- nrf24l01_setregbit(dev, NRF24L01_CONFIG, NRF24L01_PRIM_RX, true);
- nrf24l01_chipenable(dev, true);
- break;
+ case ST_RX:
+ nrf24l01_setregbit(dev, NRF24L01_CONFIG, NRF24L01_PRIM_RX, true);
+ nrf24l01_chipenable(dev, true);
+ break;
#endif
}
@@ -918,6 +919,7 @@ static void binarycvt(FAR char *deststr, size_t destlen,
FAR const uint8_t *srcbin, size_t srclen)
{
int i = 0;
+
while (i < srclen && 2 * (i + 1) < destlen)
{
snprintf(deststr + i * 2, destlen - i * 2, "%02x", srcbin[i]);
@@ -1121,6 +1123,7 @@ static int nrf24l01_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case WLIOC_SETRADIOFREQ:
{
FAR uint32_t *ptr = (FAR uint32_t *)((uintptr_t)arg);
+
DEBUGASSERT(ptr != NULL);
/* Convert Hz from ioctl to MHz for the underlying function */
@@ -1132,6 +1135,7 @@ static int nrf24l01_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case WLIOC_GETRADIOFREQ:
{
FAR uint32_t *ptr = (FAR uint32_t *)((uintptr_t)arg);
+
DEBUGASSERT(ptr != NULL);
/* Convert MHz from the underlying function to Hz for ioctl */
@@ -1143,6 +1147,7 @@ static int nrf24l01_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case WLIOC_SETADDR:
{
FAR const uint8_t *addr = (FAR const uint8_t *)(arg);
+
DEBUGASSERT(addr != NULL);
nrf24l01_settxaddr(dev, addr);
}
@@ -1151,6 +1156,7 @@ static int nrf24l01_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case WLIOC_GETADDR:
{
FAR uint8_t *addr = (FAR uint8_t *)(arg);
+
DEBUGASSERT(addr != NULL);
nrf24l01_gettxaddr(dev, addr);
}
@@ -1159,6 +1165,7 @@ static int nrf24l01_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case WLIOC_SETTXPOWER:
{
FAR int32_t *ptr = (FAR int32_t *)(arg);
+
DEBUGASSERT(ptr != NULL);
nrf24l01_settxpower(dev, *ptr);
}
@@ -1167,6 +1174,7 @@ static int nrf24l01_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case WLIOC_GETTXPOWER:
{
FAR int32_t *ptr = (FAR int32_t *)(arg);
+
DEBUGASSERT(ptr != NULL);
*ptr = nrf24l01_gettxpower(dev);
}
@@ -1175,6 +1183,7 @@ static int nrf24l01_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case WLIOC_SETFINEPOWER:
{
FAR int32_t *ptr = (FAR int32_t *)(arg);
+
DEBUGASSERT(ptr != NULL);
/* Convert from 0.01 dBm to standard dBm */
@@ -1186,6 +1195,7 @@ static int nrf24l01_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case WLIOC_GETFINEPOWER:
{
FAR int32_t *ptr = (FAR int32_t *)(arg);
+
DEBUGASSERT(ptr != NULL);
/* Convert from standard dBm to 0.01 dBm */
@@ -1198,6 +1208,7 @@ static int nrf24l01_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
{
FAR enum wlioc_modulation_e *ptr =
(FAR enum wlioc_modulation_e *)(arg);
+
DEBUGASSERT(ptr != NULL);
/* nRF24L01 only supports GFSK modulation natively */
@@ -1213,6 +1224,7 @@ static int nrf24l01_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
{
FAR enum wlioc_modulation_e *ptr =
(FAR enum wlioc_modulation_e *)(arg);
+
DEBUGASSERT(ptr != NULL);
*ptr = WLIOC_GFSK;
}
@@ -1223,6 +1235,7 @@ static int nrf24l01_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case NRF24L01IOC_SETRETRCFG:
{
FAR nrf24l01_retrcfg_t *ptr = (FAR nrf24l01_retrcfg_t *)(arg);
+
DEBUGASSERT(ptr != NULL);
nrf24l01_setretransmit(dev, ptr->delay, ptr->count);
}
@@ -1232,6 +1245,7 @@ static int nrf24l01_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
{
FAR nrf24l01_retrcfg_t *ptr = (FAR nrf24l01_retrcfg_t *)(arg);
uint8_t val;
+
DEBUGASSERT(ptr != NULL);
nrf24l01_lock(dev->spi);
@@ -1298,94 +1312,102 @@ static int nrf24l01_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case NRF24L01IOC_GETPIPESENABLED:
{
- FAR uint8_t *en_pipesp = (FAR uint8_t *)(arg);
+ FAR uint8_t *en_pipesp = (FAR uint8_t *)(arg);
- DEBUGASSERT(en_pipesp != NULL);
- *en_pipesp = dev->en_pipes;
- break;
+ DEBUGASSERT(en_pipesp != NULL);
+ *en_pipesp = dev->en_pipes;
+ break;
}
case NRF24L01IOC_SETDATARATE:
{
- FAR nrf24l01_datarate_t *drp = (FAR nrf24l01_datarate_t *)(arg);
- DEBUGASSERT(drp != NULL);
- nrf24l01_setdatarate(dev, *drp);
- break;
+ FAR nrf24l01_datarate_t *drp = (FAR nrf24l01_datarate_t *)(arg);
+
+ DEBUGASSERT(drp != NULL);
+ nrf24l01_setdatarate(dev, *drp);
+ break;
}
case NRF24L01IOC_GETDATARATE:
{
- FAR nrf24l01_datarate_t *drp = (FAR nrf24l01_datarate_t *)(arg);
- uint8_t val;
- DEBUGASSERT(drp != NULL);
-
- nrf24l01_lock(dev->spi);
- val = nrf24l01_readregbyte(dev, NRF24L01_RF_SETUP);
- nrf24l01_unlock(dev->spi);
-
- if (val & NRF24L01_RF_DR_LOW)
- {
- *drp = RATE_250kbps;
- }
- else if (val & NRF24L01_RF_DR_HIGH)
- {
- *drp = RATE_2Mbps;
- }
- else
- {
- *drp = RATE_1Mbps;
- }
- break;
+ FAR nrf24l01_datarate_t *drp = (FAR nrf24l01_datarate_t *)(arg);
+ uint8_t val;
+
+ DEBUGASSERT(drp != NULL);
+
+ nrf24l01_lock(dev->spi);
+ val = nrf24l01_readregbyte(dev, NRF24L01_RF_SETUP);
+ nrf24l01_unlock(dev->spi);
+
+ if (val & NRF24L01_RF_DR_LOW)
+ {
+ *drp = RATE_250kbps;
+ }
+ else if (val & NRF24L01_RF_DR_HIGH)
+ {
+ *drp = RATE_2Mbps;
+ }
+ else
+ {
+ *drp = RATE_1Mbps;
+ }
+ break;
}
case NRF24L01IOC_SETADDRWIDTH:
{
- FAR uint32_t *widthp = (FAR uint32_t *)(arg);
- DEBUGASSERT(widthp != NULL);
+ FAR uint32_t *widthp = (FAR uint32_t *)(arg);
- nrf24l01_setaddrwidth(dev, *widthp);
- break;
+ DEBUGASSERT(widthp != NULL);
+
+ nrf24l01_setaddrwidth(dev, *widthp);
+ break;
}
case NRF24L01IOC_GETADDRWIDTH:
{
- FAR int *widthp = (FAR int *)(arg);
- DEBUGASSERT(widthp != NULL);
+ FAR int *widthp = (FAR int *)(arg);
- *widthp = (int)dev->addrlen;
- break;
+ DEBUGASSERT(widthp != NULL);
+
+ *widthp = (int)dev->addrlen;
+ break;
}
case NRF24L01IOC_SETSTATE:
{
- FAR nrf24l01_state_t *statep = (FAR nrf24l01_state_t *)(arg);
- DEBUGASSERT(statep != NULL);
+ FAR nrf24l01_state_t *statep = (FAR nrf24l01_state_t *)(arg);
- nrf24l01_changestate(dev, *statep);
- break;
+ DEBUGASSERT(statep != NULL);
+
+ nrf24l01_changestate(dev, *statep);
+ break;
}
case NRF24L01IOC_GETSTATE:
{
- FAR nrf24l01_state_t *statep = (FAR nrf24l01_state_t *)(arg);
- DEBUGASSERT(statep != NULL);
+ FAR nrf24l01_state_t *statep = (FAR nrf24l01_state_t *)(arg);
- *statep = dev->state;
- break;
+ DEBUGASSERT(statep != NULL);
+
+ *statep = dev->state;
+ break;
}
case NRF24L01IOC_GETLASTXMITCOUNT:
{
- FAR uint32_t *xmitcntp = (FAR uint32_t *)(arg);
- DEBUGASSERT(xmitcntp != NULL);
+ FAR uint32_t *xmitcntp = (FAR uint32_t *)(arg);
- *xmitcntp = dev->lastxmitcount;
- break;
+ DEBUGASSERT(xmitcntp != NULL);
+
+ *xmitcntp = dev->lastxmitcount;
+ break;
}
case NRF24L01IOC_GETLASTPIPENO:
{
FAR uint32_t *lastpipep = (FAR uint32_t *)(arg);
+
DEBUGASSERT(lastpipep != NULL);
*lastpipep = dev->last_recvpipeno;
@@ -1395,6 +1417,7 @@ static int nrf24l01_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case NRF24L01IOC_SETTXPAYLOADNOACK:
{
FAR uint32_t *tx_payload_noack = (FAR uint32_t *)(arg);
+
DEBUGASSERT(tx_payload_noack != NULL);
dev->tx_payload_noack = (*tx_payload_noack) > 0;
@@ -1404,6 +1427,7 @@ static int nrf24l01_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case NRF24L01IOC_GETTXPAYLOADNOACK:
{
FAR uint32_t *tx_payload_noack = (FAR uint32_t *)(arg);
+
DEBUGASSERT(tx_payload_noack != NULL);
*tx_payload_noack = dev->tx_payload_noack ? 1 : 0;
@@ -1628,6 +1652,7 @@ int nrf24l01_init(FAR struct nrf24l01_dev_s *dev)
*/
uint8_t v = 0x73;
+
nrf24l01_access(dev, MODE_WRITE, NRF24L01_ACTIVATE, &v, 1);
features = nrf24l01_readregbyte(dev, NRF24L01_FEATURE);
@@ -1893,25 +1918,25 @@ int nrf24l01_settxpower(FAR struct nrf24l01_dev_s *dev, int outpower)
switch (outpower)
{
- case 0:
- hwpow = 3 << NRF24L01_RF_PWR_SHIFT;
- break;
+ case 0:
+ hwpow = 3 << NRF24L01_RF_PWR_SHIFT;
+ break;
- case -6:
- hwpow = 2 << NRF24L01_RF_PWR_SHIFT;
- break;
+ case -6:
+ hwpow = 2 << NRF24L01_RF_PWR_SHIFT;
+ break;
- case -12:
- hwpow = 1 << NRF24L01_RF_PWR_SHIFT;
- break;
+ case -12:
+ hwpow = 1 << NRF24L01_RF_PWR_SHIFT;
+ break;
- case -18:
- hwpow = 0;
- break;
+ case -18:
+ hwpow = 0;
+ break;
- default:
- return -EINVAL;
- }
+ default:
+ return -EINVAL;
+ }
nrf24l01_lock(dev->spi);
@@ -2119,6 +2144,7 @@ ssize_t nrf24l01_recv(FAR struct nrf24l01_dev_s *dev, FAR uint8_t *buffer,
size_t buflen, FAR uint8_t *recvpipe)
{
int ret = nxsem_wait(&dev->sem_rx);
+
if (ret < 0)
{
return ret;