1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 14:33:52 +01:00

Merge pull request #7855 from kYc0o/fix_nrf24l01p_var_sizes

drivers/nrf24l01p: misc fixed
This commit is contained in:
Peter Kietzmann 2017-11-09 08:06:28 +01:00 committed by GitHub
commit 87b0477b70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 8 deletions

View File

@ -36,11 +36,11 @@ extern "C" {
* @brief Structure that represents the hardware setup of the nrf24l01+ transceiver.
*/
typedef struct {
spi_t spi; /**< SPI device to initialize */
gpio_t ce; /**< GPIO pin to initialize as chip enable */
gpio_t cs; /**< GPIO pin to initialize as chip select */
gpio_t irq; /**< GPIO pin to initialize as interrupt request */
int listener; /**< Place to store an ID in */
spi_t spi; /**< SPI device to initialize */
gpio_t ce; /**< GPIO pin to initialize as chip enable */
gpio_t cs; /**< GPIO pin to initialize as chip select */
gpio_t irq; /**< GPIO pin to initialize as interrupt request */
unsigned listener; /**< Place to store an ID in */
} nrf24l01p_t;
/**

View File

@ -386,7 +386,7 @@ int nrf24l01p_set_tx_address_long(const nrf24l01p_t *dev, uint64_t saddr, unsign
char buf[length];
if (length <= INITIAL_ADDRESS_WIDTH) {
for (int i = 0; i < length; i++) {
for (unsigned int i = 0; i < length; i++) {
buf[i] = (uint8_t)(saddr >> (((length - 1) - i) * sizeof(uint64_t)));
}
@ -483,7 +483,7 @@ int nrf24l01p_set_rx_address_long(const nrf24l01p_t *dev, nrf24l01p_rx_pipe_t pi
char buf[length];
if (length <= INITIAL_ADDRESS_WIDTH) {
for (int i = 0; i < length; i++) {
for (unsigned int i = 0; i < length; i++) {
buf[i] = (uint8_t)(saddr >> (((length - 1) - i) * 8));
}

View File

@ -113,6 +113,7 @@ char rx_handler_stack[THREAD_STACKSIZE_MAIN];
/* RX handler that waits for a message from the ISR */
void *nrf24l01p_rx_handler(void *arg)
{
(void)arg;
msg_t msg_q[1];
msg_init_queue(msg_q, 1);
unsigned int pid = thread_getpid();
@ -209,7 +210,7 @@ int cmd_send(int argc, char **argv)
char tx_buf[NRF24L01P_MAX_DATA_LENGTH];
/* fill TX buffer with numbers 32..1 */
for (int i = 0; i < sizeof(tx_buf); i++) {
for (size_t i = 0; i < sizeof(tx_buf); i++) {
tx_buf[i] = NRF24L01P_MAX_DATA_LENGTH - i;
}
/* power on the device */