mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 03:45:50 +08:00
Add NSRF42L01 driver. From Laurent Latil
This commit is contained in:
@@ -4839,3 +4839,12 @@
|
|||||||
avoid requests of exactly MAXPACKET size and, hence, avoid so many
|
avoid requests of exactly MAXPACKET size and, hence, avoid so many
|
||||||
NULL packets. Also, fix the OUT request buffers size to exactly
|
NULL packets. Also, fix the OUT request buffers size to exactly
|
||||||
the max packet size. It cannot be any other size (2013-5-29).
|
the max packet size. It cannot be any other size (2013-5-29).
|
||||||
|
* .gitignore: Clean-up of most all .gitignore files: Make scope of
|
||||||
|
ignore to be only the current directory; Ignore .dSYM files in
|
||||||
|
directories where .exe's may be build. Also, in Makefiles,
|
||||||
|
clean .dSYM files in directories where .exe may be built (2013-5-30).
|
||||||
|
* drivers/wireless/nrf24101.c/.h and include/nuttx/wireless/nrf24101.h:
|
||||||
|
Add new driver for the wireless nRF24L01+ transceiver. From Laurent
|
||||||
|
Latil (2013-6-1).
|
||||||
|
* drivers/wireless/cc1101: Move files in the cc1101 up one directory.
|
||||||
|
From Laurent Latil (2013-6-1).
|
||||||
|
|||||||
@@ -194,6 +194,7 @@ CONFIG_I2C=y
|
|||||||
# Note: this has (at the moment) nothing to do with WIFI
|
# Note: this has (at the moment) nothing to do with WIFI
|
||||||
#
|
#
|
||||||
CONFIG_WIRELESS=y
|
CONFIG_WIRELESS=y
|
||||||
|
CONFIG_WL_CC1101=y
|
||||||
|
|
||||||
#
|
#
|
||||||
# OS support for hardware RTC
|
# OS support for hardware RTC
|
||||||
|
|||||||
@@ -0,0 +1,123 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* drivers/wireless/ISM1_868MHzGFSK100kbps.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||||
|
* Copyright (C) 2011 Ales Verbic. All rights reserved.
|
||||||
|
*
|
||||||
|
* Authors: Uros Platise <uros.platise@isotel.eu>
|
||||||
|
* Ales Verbic <ales.verbic@isotel.eu>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/wireless/cc1101.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/** Settings for 868 MHz, GFSK at 100kbps
|
||||||
|
*
|
||||||
|
* ISM Region 1 (Europe) only, Band 868–870 MHz
|
||||||
|
*
|
||||||
|
* Frequency ERP Duty Cycle Bandwidth Remarks
|
||||||
|
* 868 – 868.6 MHz +14 dBm < 1% No limits
|
||||||
|
* 868.7 – 869.2 MHz +14 dBm < 0.1% No limits
|
||||||
|
* 869.3 – 869.4 MHz +10 dBm No limits < 25 kHz Appropriate access protocol required
|
||||||
|
* 869.4 – 869.65 MHz +27 dBm < 10% < 25 kHz Channels may be combined to one high speed channel
|
||||||
|
* 869.7 -870 MHz +7 dBm No limits No limits
|
||||||
|
*
|
||||||
|
* Deviation = 46.142578
|
||||||
|
* Base frequency = 867.999985
|
||||||
|
* Carrier frequency = 867.999985
|
||||||
|
* Channel number = 0
|
||||||
|
* Carrier frequency = 867.999985
|
||||||
|
* Modulated = true
|
||||||
|
* Modulation format = GFSK
|
||||||
|
* Manchester enable = false
|
||||||
|
* Sync word qualifier mode = 30/32 sync word bits detected
|
||||||
|
* Preamble count = 4
|
||||||
|
* Channel spacing = 199.813843
|
||||||
|
* Carrier frequency = 867.999985
|
||||||
|
* Data rate = 99.9069
|
||||||
|
* RX filter BW = 210.937500
|
||||||
|
* Data format = Normal mode
|
||||||
|
* Length config = Fixed packet length mode. Length configured in PKTLEN register
|
||||||
|
* CRC enable = true
|
||||||
|
* Packet length = 62
|
||||||
|
* Device address = 00
|
||||||
|
* Address config = NO Address check, no broadcast
|
||||||
|
* CRC autoflush = true
|
||||||
|
* PA ramping = false
|
||||||
|
* TX power = 0
|
||||||
|
*/
|
||||||
|
|
||||||
|
const struct c1101_rfsettings_s cc1101_rfsettings_ISM1_868MHzGFSK100kbps =
|
||||||
|
{
|
||||||
|
.FSCTRL1 = 0x08, /* FSCTRL1 Frequency Synthesizer Control */
|
||||||
|
.FSCTRL0 = 0x00, /* FSCTRL0 Frequency Synthesizer Control */
|
||||||
|
|
||||||
|
.FREQ2 = 0x20, /* FREQ2 Frequency Control Word, High Byte */
|
||||||
|
.FREQ1 = 0x25, /* FREQ1 Frequency Control Word, Middle Byte */
|
||||||
|
.FREQ0 = 0xED, /* FREQ0 Frequency Control Word, Low Byte */
|
||||||
|
|
||||||
|
.MDMCFG4 = 0x8B, /* MDMCFG4 Modem Configuration */
|
||||||
|
.MDMCFG3 = 0xE5, /* MDMCFG3 Modem Configuration */
|
||||||
|
.MDMCFG2 = 0x13, /* MDMCFG2 Modem Configuration */
|
||||||
|
.MDMCFG1 = 0x22, /* MDMCFG1 Modem Configuration */
|
||||||
|
.MDMCFG0 = 0xE5, /* MDMCFG0 Modem Configuration */
|
||||||
|
|
||||||
|
.DEVIATN = 0x46, /* DEVIATN Modem Deviation Setting */
|
||||||
|
|
||||||
|
.FOCCFG = 0x1D, /* FOCCFG Frequency Offset Compensation Configuration */
|
||||||
|
|
||||||
|
.BSCFG = 0x1C, /* BSCFG Bit Synchronization Configuration */
|
||||||
|
|
||||||
|
.AGCCTRL2= 0xC7, /* AGCCTRL2 AGC Control */
|
||||||
|
.AGCCTRL1= 0x00, /* AGCCTRL1 AGC Control */
|
||||||
|
.AGCCTRL0= 0xB2, /* AGCCTRL0 AGC Control */
|
||||||
|
|
||||||
|
.FREND1 = 0xB6, /* FREND1 Front End RX Configuration */
|
||||||
|
.FREND0 = 0x10, /* FREND0 Front End TX Configuration */
|
||||||
|
|
||||||
|
.FSCAL3 = 0xEA, /* FSCAL3 Frequency Synthesizer Calibration */
|
||||||
|
.FSCAL2 = 0x2A, /* FSCAL2 Frequency Synthesizer Calibration */
|
||||||
|
.FSCAL1 = 0x00, /* FSCAL1 Frequency Synthesizer Calibration */
|
||||||
|
.FSCAL0 = 0x1F, /* FSCAL0 Frequency Synthesizer Calibration */
|
||||||
|
|
||||||
|
.CHMIN = 0, /* Fix at 9th channel: 869.80 MHz +- 100 kHz RF Bandwidth */
|
||||||
|
.CHMAX = 9, /* single channel */
|
||||||
|
|
||||||
|
.PAMAX = 8, /* 0 means power OFF, 8 represents PA[7] */
|
||||||
|
.PA = {0x03, 0x0F, 0x1E, 0x27, 0x67, 0x50, 0x81, 0xC2}
|
||||||
|
};
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* drivers/wireless/ISM2_905MHzGFSK250kbps.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||||
|
* Copyright (C) 2011 Ales Verbic. All rights reserved.
|
||||||
|
*
|
||||||
|
* Authors: Uros Platise <uros.platise@isotel.eu>
|
||||||
|
* Ales Verbic <ales.verbic@isotel.eu>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/wireless/cc1101.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/** Settings for 905 MHz, GFSK at 250kbps
|
||||||
|
*
|
||||||
|
* ISM Region 2 (America) only, Band 902–928 MHz
|
||||||
|
*
|
||||||
|
* Cordless phones 1 W
|
||||||
|
* Microwave ovens 750 W
|
||||||
|
* Industrial heaters 100 kW
|
||||||
|
* Military radar 1000 kW
|
||||||
|
*
|
||||||
|
* Deviation = 126.953125
|
||||||
|
* Base frequency = 901.999969
|
||||||
|
* Carrier frequency = 905.998993
|
||||||
|
* Channel number = 20
|
||||||
|
* Carrier frequency = 905.998993
|
||||||
|
* Modulated = true
|
||||||
|
* Modulation format = GFSK
|
||||||
|
* Manchester enable = false
|
||||||
|
* Sync word qualifier mode = 30/32 sync word bits detected
|
||||||
|
* Preamble count = 4
|
||||||
|
* Channel spacing = 199.951172
|
||||||
|
* Carrier frequency = 905.998993
|
||||||
|
* Data rate = 249.939
|
||||||
|
* RX filter BW = 541.666667
|
||||||
|
* Data format = Normal mode
|
||||||
|
* Length config = Variable packet length mode. Packet length configured by the first byte after sync word
|
||||||
|
* CRC enable = true
|
||||||
|
* Packet length = 61
|
||||||
|
* Device address = 0
|
||||||
|
* Address config = No address check
|
||||||
|
* CRC autoflush = false
|
||||||
|
* PA ramping = false
|
||||||
|
* TX power = 0
|
||||||
|
*/
|
||||||
|
|
||||||
|
const struct c1101_rfsettings_s cc1101_rfsettings_ISM2_905MHzGFSK250kbps =
|
||||||
|
{
|
||||||
|
.FSCTRL1 = 0x0C, /* FSCTRL1 Frequency Synthesizer Control */
|
||||||
|
.FSCTRL0 = 0x00, /* FSCTRL0 Frequency Synthesizer Control */
|
||||||
|
|
||||||
|
.FREQ2 = 0x22, /* FREQ2 Frequency Control Word, High Byte */
|
||||||
|
.FREQ1 = 0xB1, /* FREQ1 Frequency Control Word, Middle Byte */
|
||||||
|
.FREQ0 = 0x3B, /* FREQ0 Frequency Control Word, Low Byte */
|
||||||
|
|
||||||
|
.MDMCFG4 = 0x2D, /* MDMCFG4 Modem Configuration */
|
||||||
|
.MDMCFG3 = 0x3B, /* MDMCFG3 Modem Configuration */
|
||||||
|
.MDMCFG2 = 0x13, /* MDMCFG2 Modem Configuration */
|
||||||
|
.MDMCFG1 = 0x22, /* MDMCFG1 Modem Configuration */
|
||||||
|
.MDMCFG0 = 0xF8, /* MDMCFG0 Modem Configuration */
|
||||||
|
|
||||||
|
.DEVIATN = 0x62, /* DEVIATN Modem Deviation Setting */
|
||||||
|
|
||||||
|
.FOCCFG = 0x1D, /* FOCCFG Frequency Offset Compensation Configuration */
|
||||||
|
|
||||||
|
.BSCFG = 0x1C, /* BSCFG Bit Synchronization Configuration */
|
||||||
|
|
||||||
|
.AGCCTRL2= 0xC7, /* AGCCTRL2 AGC Control */
|
||||||
|
.AGCCTRL1= 0x00, /* AGCCTRL1 AGC Control */
|
||||||
|
.AGCCTRL0= 0xB0, /* AGCCTRL0 AGC Control */
|
||||||
|
|
||||||
|
.FREND1 = 0xB6, /* FREND1 Front End RX Configuration */
|
||||||
|
.FREND0 = 0x10, /* FREND0 Front End TX Configuration */
|
||||||
|
|
||||||
|
.FSCAL3 = 0xEA, /* FSCAL3 Frequency Synthesizer Calibration */
|
||||||
|
.FSCAL2 = 0x2A, /* FSCAL2 Frequency Synthesizer Calibration */
|
||||||
|
.FSCAL1 = 0x00, /* FSCAL1 Frequency Synthesizer Calibration */
|
||||||
|
.FSCAL0 = 0x1F, /* FSCAL0 Frequency Synthesizer Calibration */
|
||||||
|
|
||||||
|
.CHMIN = 0, /* VERIFY REGULATIONS! */
|
||||||
|
.CHMAX = 0xFF,
|
||||||
|
|
||||||
|
.PAMAX = 8, /* 0 means power OFF, 8 represents PA[7] */
|
||||||
|
.PA = {0x03, 0x0E, 0x1E, 0x27, 0x39, 0x8E, 0xCD, 0xC0}
|
||||||
|
};
|
||||||
@@ -2,3 +2,55 @@
|
|||||||
# For a description of the syntax of this configuration file,
|
# For a description of the syntax of this configuration file,
|
||||||
# see misc/tools/kconfig-language.txt.
|
# see misc/tools/kconfig-language.txt.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
config WL_CC1101
|
||||||
|
bool "CC1101 RF transceiver support"
|
||||||
|
default n
|
||||||
|
select SPI
|
||||||
|
|
||||||
|
config WL_NRF24L01
|
||||||
|
bool "nRF24l01+ transceiver support"
|
||||||
|
default n
|
||||||
|
select SPI
|
||||||
|
---help---
|
||||||
|
This options adds driver support for the Nordic nRF24L01+ chip.
|
||||||
|
|
||||||
|
if WL_NRF24L01
|
||||||
|
|
||||||
|
config WL_NRF24L01_DFLT_ADDR_WIDTH
|
||||||
|
int "Default address width"
|
||||||
|
default 5
|
||||||
|
range 3 5
|
||||||
|
---help---
|
||||||
|
Default address width to be used by the nRF24l01+ driver.
|
||||||
|
Note that this default can be changed through the driver API.
|
||||||
|
|
||||||
|
config WL_NRF24L01_CHECK_PARAMS
|
||||||
|
bool "Check call parameters"
|
||||||
|
default y
|
||||||
|
---help---
|
||||||
|
This option adds some sanity check code to parameters given in the
|
||||||
|
driver API functions. If this option is disabled, parameter
|
||||||
|
values are passed 'as is' to the module hardware registers.
|
||||||
|
|
||||||
|
config WL_NRF24L01_RXSUPPORT
|
||||||
|
bool "Support messages reception"
|
||||||
|
default y
|
||||||
|
---help---
|
||||||
|
If this opion is disabled the driver supports only the transmission of messages.
|
||||||
|
Reception of messages will be disabled (and corresponding functions removed).
|
||||||
|
Note: this option is intended to reduce driver code size for 'transmission
|
||||||
|
only' devices.
|
||||||
|
|
||||||
|
if WL_NRF24L01_RXSUPPORT
|
||||||
|
|
||||||
|
config WL_NRF24L01_RXFIFO_LEN
|
||||||
|
int "RX fifo length"
|
||||||
|
default 128
|
||||||
|
range 34 2048
|
||||||
|
---help---
|
||||||
|
Length of the software based fifo used to store content of
|
||||||
|
received messages.
|
||||||
|
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|||||||
@@ -37,11 +37,17 @@ ifeq ($(CONFIG_WIRELESS),y)
|
|||||||
|
|
||||||
# Include wireless drivers
|
# Include wireless drivers
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_WL_CC1101),y)
|
||||||
CSRCS += cc1101.c ISM1_868MHzGFSK100kbps.c ISM2_905MHzGFSK250kbps.c
|
CSRCS += cc1101.c ISM1_868MHzGFSK100kbps.c ISM2_905MHzGFSK250kbps.c
|
||||||
|
endif
|
||||||
# Include wireless build support
|
|
||||||
|
ifeq ($(CONFIG_WL_NRF24L01),y)
|
||||||
DEPPATH += --dep-path wireless$(DELIM)cc1101
|
CSRCS += nrf24l01.c
|
||||||
VPATH += :wireless$(DELIM)cc1101
|
endif
|
||||||
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)wireless$(DELIM)cc1101}
|
|
||||||
|
# Include wireless devices build support
|
||||||
|
|
||||||
|
DEPPATH += --dep-path wireless
|
||||||
|
VPATH += :wireless
|
||||||
|
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)wireless}
|
||||||
endif
|
endif
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,113 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
* drivers/wireless/cc1101/ISM1_868MHzGFSK100kbps.c
|
|
||||||
*
|
|
||||||
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
|
||||||
* Copyright (C) 2011 Ales Verbic. All rights reserved.
|
|
||||||
*
|
|
||||||
* Authors: Uros Platise <uros.platise@isotel.eu>
|
|
||||||
* Ales Verbic <ales.verbic@isotel.eu>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include <nuttx/wireless/cc1101.h>
|
|
||||||
|
|
||||||
/** Settings for 868 MHz, GFSK at 100kbps
|
|
||||||
*
|
|
||||||
* ISM Region 1 (Europe) only, Band 868–870 MHz
|
|
||||||
*
|
|
||||||
* Frequency ERP Duty Cycle Bandwidth Remarks
|
|
||||||
* 868 – 868.6 MHz +14 dBm < 1% No limits
|
|
||||||
* 868.7 – 869.2 MHz +14 dBm < 0.1% No limits
|
|
||||||
* 869.3 – 869.4 MHz +10 dBm No limits < 25 kHz Appropriate access protocol required
|
|
||||||
* 869.4 – 869.65 MHz +27 dBm < 10% < 25 kHz Channels may be combined to one high speed channel
|
|
||||||
* 869.7 -870 MHz +7 dBm No limits No limits
|
|
||||||
*
|
|
||||||
* Deviation = 46.142578
|
|
||||||
* Base frequency = 867.999985
|
|
||||||
* Carrier frequency = 867.999985
|
|
||||||
* Channel number = 0
|
|
||||||
* Carrier frequency = 867.999985
|
|
||||||
* Modulated = true
|
|
||||||
* Modulation format = GFSK
|
|
||||||
* Manchester enable = false
|
|
||||||
* Sync word qualifier mode = 30/32 sync word bits detected
|
|
||||||
* Preamble count = 4
|
|
||||||
* Channel spacing = 199.813843
|
|
||||||
* Carrier frequency = 867.999985
|
|
||||||
* Data rate = 99.9069
|
|
||||||
* RX filter BW = 210.937500
|
|
||||||
* Data format = Normal mode
|
|
||||||
* Length config = Fixed packet length mode. Length configured in PKTLEN register
|
|
||||||
* CRC enable = true
|
|
||||||
* Packet length = 62
|
|
||||||
* Device address = 00
|
|
||||||
* Address config = NO Address check, no broadcast
|
|
||||||
* CRC autoflush = true
|
|
||||||
* PA ramping = false
|
|
||||||
* TX power = 0
|
|
||||||
*/
|
|
||||||
const struct c1101_rfsettings_s cc1101_rfsettings_ISM1_868MHzGFSK100kbps = {
|
|
||||||
.FSCTRL1 = 0x08, // FSCTRL1 Frequency Synthesizer Control
|
|
||||||
.FSCTRL0 = 0x00, // FSCTRL0 Frequency Synthesizer Control
|
|
||||||
|
|
||||||
.FREQ2 = 0x20, // FREQ2 Frequency Control Word, High Byte
|
|
||||||
.FREQ1 = 0x25, // FREQ1 Frequency Control Word, Middle Byte
|
|
||||||
.FREQ0 = 0xED, // FREQ0 Frequency Control Word, Low Byte
|
|
||||||
|
|
||||||
.MDMCFG4 = 0x8B, // MDMCFG4 Modem Configuration
|
|
||||||
.MDMCFG3 = 0xE5, // MDMCFG3 Modem Configuration
|
|
||||||
.MDMCFG2 = 0x13, // MDMCFG2 Modem Configuration
|
|
||||||
.MDMCFG1 = 0x22, // MDMCFG1 Modem Configuration
|
|
||||||
.MDMCFG0 = 0xE5, // MDMCFG0 Modem Configuration
|
|
||||||
|
|
||||||
.DEVIATN = 0x46, // DEVIATN Modem Deviation Setting
|
|
||||||
|
|
||||||
.FOCCFG = 0x1D, // FOCCFG Frequency Offset Compensation Configuration
|
|
||||||
|
|
||||||
.BSCFG = 0x1C, // BSCFG Bit Synchronization Configuration
|
|
||||||
|
|
||||||
.AGCCTRL2= 0xC7, // AGCCTRL2 AGC Control
|
|
||||||
.AGCCTRL1= 0x00, // AGCCTRL1 AGC Control
|
|
||||||
.AGCCTRL0= 0xB2, // AGCCTRL0 AGC Control
|
|
||||||
|
|
||||||
.FREND1 = 0xB6, // FREND1 Front End RX Configuration
|
|
||||||
.FREND0 = 0x10, // FREND0 Front End TX Configuration
|
|
||||||
|
|
||||||
.FSCAL3 = 0xEA, // FSCAL3 Frequency Synthesizer Calibration
|
|
||||||
.FSCAL2 = 0x2A, // FSCAL2 Frequency Synthesizer Calibration
|
|
||||||
.FSCAL1 = 0x00, // FSCAL1 Frequency Synthesizer Calibration
|
|
||||||
.FSCAL0 = 0x1F, // FSCAL0 Frequency Synthesizer Calibration
|
|
||||||
|
|
||||||
.CHMIN = 0, // Fix at 9th channel: 869.80 MHz +- 100 kHz RF Bandwidth
|
|
||||||
.CHMAX = 9, // single channel
|
|
||||||
|
|
||||||
.PAMAX = 8, // 0 means power OFF, 8 represents PA[7]
|
|
||||||
.PA = {0x03, 0x0F, 0x1E, 0x27, 0x67, 0x50, 0x81, 0xC2}
|
|
||||||
};
|
|
||||||
@@ -1,111 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
* drivers/wireless/cc1101/ISM2_905MHzGFSK250kbps.c
|
|
||||||
*
|
|
||||||
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
|
||||||
* Copyright (C) 2011 Ales Verbic. All rights reserved.
|
|
||||||
*
|
|
||||||
* Authors: Uros Platise <uros.platise@isotel.eu>
|
|
||||||
* Ales Verbic <ales.verbic@isotel.eu>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include <nuttx/wireless/cc1101.h>
|
|
||||||
|
|
||||||
/** Settings for 905 MHz, GFSK at 250kbps
|
|
||||||
*
|
|
||||||
* ISM Region 2 (America) only, Band 902–928 MHz
|
|
||||||
*
|
|
||||||
* Cordless phones 1 W
|
|
||||||
* Microwave ovens 750 W
|
|
||||||
* Industrial heaters 100 kW
|
|
||||||
* Military radar 1000 kW
|
|
||||||
*
|
|
||||||
* Deviation = 126.953125
|
|
||||||
* Base frequency = 901.999969
|
|
||||||
* Carrier frequency = 905.998993
|
|
||||||
* Channel number = 20
|
|
||||||
* Carrier frequency = 905.998993
|
|
||||||
* Modulated = true
|
|
||||||
* Modulation format = GFSK
|
|
||||||
* Manchester enable = false
|
|
||||||
* Sync word qualifier mode = 30/32 sync word bits detected
|
|
||||||
* Preamble count = 4
|
|
||||||
* Channel spacing = 199.951172
|
|
||||||
* Carrier frequency = 905.998993
|
|
||||||
* Data rate = 249.939
|
|
||||||
* RX filter BW = 541.666667
|
|
||||||
* Data format = Normal mode
|
|
||||||
* Length config = Variable packet length mode. Packet length configured by the first byte after sync word
|
|
||||||
* CRC enable = true
|
|
||||||
* Packet length = 61
|
|
||||||
* Device address = 0
|
|
||||||
* Address config = No address check
|
|
||||||
* CRC autoflush = false
|
|
||||||
* PA ramping = false
|
|
||||||
* TX power = 0
|
|
||||||
*/
|
|
||||||
const struct c1101_rfsettings_s cc1101_rfsettings_ISM2_905MHzGFSK250kbps = {
|
|
||||||
.FSCTRL1 = 0x0C, // FSCTRL1 Frequency Synthesizer Control
|
|
||||||
.FSCTRL0 = 0x00, // FSCTRL0 Frequency Synthesizer Control
|
|
||||||
|
|
||||||
.FREQ2 = 0x22, // FREQ2 Frequency Control Word, High Byte
|
|
||||||
.FREQ1 = 0xB1, // FREQ1 Frequency Control Word, Middle Byte
|
|
||||||
.FREQ0 = 0x3B, // FREQ0 Frequency Control Word, Low Byte
|
|
||||||
|
|
||||||
.MDMCFG4 = 0x2D, // MDMCFG4 Modem Configuration
|
|
||||||
.MDMCFG3 = 0x3B, // MDMCFG3 Modem Configuration
|
|
||||||
.MDMCFG2 = 0x13, // MDMCFG2 Modem Configuration
|
|
||||||
.MDMCFG1 = 0x22, // MDMCFG1 Modem Configuration
|
|
||||||
.MDMCFG0 = 0xF8, // MDMCFG0 Modem Configuration
|
|
||||||
|
|
||||||
.DEVIATN = 0x62, // DEVIATN Modem Deviation Setting
|
|
||||||
|
|
||||||
.FOCCFG = 0x1D, // FOCCFG Frequency Offset Compensation Configuration
|
|
||||||
|
|
||||||
.BSCFG = 0x1C, // BSCFG Bit Synchronization Configuration
|
|
||||||
|
|
||||||
.AGCCTRL2= 0xC7, // AGCCTRL2 AGC Control
|
|
||||||
.AGCCTRL1= 0x00, // AGCCTRL1 AGC Control
|
|
||||||
.AGCCTRL0= 0xB0, // AGCCTRL0 AGC Control
|
|
||||||
|
|
||||||
.FREND1 = 0xB6, // FREND1 Front End RX Configuration
|
|
||||||
.FREND0 = 0x10, // FREND0 Front End TX Configuration
|
|
||||||
|
|
||||||
.FSCAL3 = 0xEA, // FSCAL3 Frequency Synthesizer Calibration
|
|
||||||
.FSCAL2 = 0x2A, // FSCAL2 Frequency Synthesizer Calibration
|
|
||||||
.FSCAL1 = 0x00, // FSCAL1 Frequency Synthesizer Calibration
|
|
||||||
.FSCAL0 = 0x1F, // FSCAL0 Frequency Synthesizer Calibration
|
|
||||||
|
|
||||||
.CHMIN = 0, // VERIFY REGULATIONS!
|
|
||||||
.CHMAX = 0xFF,
|
|
||||||
|
|
||||||
.PAMAX = 8, // 0 means power OFF, 8 represents PA[7]
|
|
||||||
.PA = {0x03, 0x0E, 0x1E, 0x27, 0x39, 0x8E, 0xCD, 0xC0}
|
|
||||||
};
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#
|
|
||||||
# For a description of the syntax of this configuration file,
|
|
||||||
# see misc/tools/kconfig-language.txt.
|
|
||||||
#
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,183 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* include/nuttx/drivers/wireless/nrf24l01.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2013 Laurent Latil
|
||||||
|
* Author: Laurent Latil <laurent@latil.nom.fr>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __DRIVERS_WIRELESS_NRF24L01_H
|
||||||
|
#define __DRIVERS_WIRELESS_NRF24L01_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
#include <nuttx/spi.h>
|
||||||
|
#include <nuttx/irq.h>
|
||||||
|
#include <nuttx/wireless/wireless.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-Processor Declarations
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* nRF24L01 hardware definitions */
|
||||||
|
|
||||||
|
/* Commands */
|
||||||
|
|
||||||
|
#define NRF24L01_R_REGISTER 0x00
|
||||||
|
#define NRF24L01_W_REGISTER 0x20
|
||||||
|
#define NRF24L01_R_RX_PAYLOAD 0x61
|
||||||
|
#define NRF24L01_W_TX_PAYLOAD 0xA0
|
||||||
|
#define NRF24L01_FLUSH_TX 0xE1
|
||||||
|
#define NRF24L01_FLUSH_RX 0xE2
|
||||||
|
#define NRF24L01_REUSE_TX_PL 0xE3
|
||||||
|
|
||||||
|
#define NRF24L01_ACTIVATE 0x50
|
||||||
|
#define NRF24L01_R_RX_PL_WID 0x60
|
||||||
|
#define NRF24L01_W_TX_PAYLOAD_NOACK 0xB0
|
||||||
|
#define NRF24L01_W_ACK_PAYLOAD 0xA8
|
||||||
|
#define NRF24L01_NOP 0xFF
|
||||||
|
|
||||||
|
/* Registers */
|
||||||
|
|
||||||
|
#define NRF24L01_CONFIG 0x00
|
||||||
|
#define NRF24L01_EN_AA 0x01
|
||||||
|
#define NRF24L01_EN_RXADDR 0x02
|
||||||
|
#define NRF24L01_SETUP_AW 0x03
|
||||||
|
#define NRF24L01_SETUP_RETR 0x04
|
||||||
|
#define NRF24L01_RF_CH 0x05
|
||||||
|
#define NRF24L01_RF_SETUP 0x06
|
||||||
|
#define NRF24L01_STATUS 0x07
|
||||||
|
#define NRF24L01_OBSERVE_TX 0x08
|
||||||
|
#define NRF24L01_CD 0x09
|
||||||
|
#define NRF24L01_RX_ADDR_P0 0x0A
|
||||||
|
#define NRF24L01_RX_ADDR_P1 0x0B
|
||||||
|
#define NRF24L01_RX_ADDR_P2 0x0C
|
||||||
|
#define NRF24L01_RX_ADDR_P3 0x0D
|
||||||
|
#define NRF24L01_RX_ADDR_P4 0x0E
|
||||||
|
#define NRF24L01_RX_ADDR_P5 0x0F
|
||||||
|
#define NRF24L01_TX_ADDR 0x10
|
||||||
|
#define NRF24L01_RX_PW_P0 0x11
|
||||||
|
#define NRF24L01_RX_PW_P1 0x12
|
||||||
|
#define NRF24L01_RX_PW_P2 0x13
|
||||||
|
#define NRF24L01_RX_PW_P3 0x14
|
||||||
|
#define NRF24L01_RX_PW_P4 0x15
|
||||||
|
#define NRF24L01_RX_PW_P5 0x16
|
||||||
|
#define NRF24L01_FIFO_STATUS 0x17
|
||||||
|
#define NRF24L01_DYNPD 0x1C
|
||||||
|
#define NRF24L01_FEATURE 0x1D
|
||||||
|
|
||||||
|
/* STATUS register definitions */
|
||||||
|
|
||||||
|
#define NRF24L01_RX_DR (1 << 6)
|
||||||
|
#define NRF24L01_TX_DS (1 << 5)
|
||||||
|
#define NRF24L01_MAX_RT (1 << 4)
|
||||||
|
#define NRF24L01_RX_P_NO_SHIFT 1
|
||||||
|
#define NRF24L01_RX_P_NO_MASK (7 << NRF24L01_RX_P_NO_SHIFT)
|
||||||
|
#define NRF24L01_STAT_TX_FULL (1 << 0)
|
||||||
|
|
||||||
|
/* CONFIG register definitions */
|
||||||
|
|
||||||
|
#define NRF24L01_MASK_RX_DR (1 << 6)
|
||||||
|
#define NRF24L01_MASK_TX_DS (1 << 5)
|
||||||
|
#define NRF24L01_MASK_MAX_RT (1 << 4)
|
||||||
|
#define NRF24L01_EN_CRC (1 << 3)
|
||||||
|
#define NRF24L01_CRCO (1 << 2)
|
||||||
|
#define NRF24L01_PWR_UP (1 << 1)
|
||||||
|
#define NRF24L01_PRIM_RX (1 << 0)
|
||||||
|
|
||||||
|
/* RF_SETUP register definition */
|
||||||
|
|
||||||
|
#define NRF24L01_CONT_WAVE (1 << 7)
|
||||||
|
#define NRF24L01_RF_DR_LOW (1 << 5)
|
||||||
|
#define NRF24L01_PLL_LOCK (1 << 4)
|
||||||
|
#define NRF24L01_RF_DR_HIGH (1 << 3)
|
||||||
|
|
||||||
|
#define NRF24L01_RF_PWR_SHIFT 1
|
||||||
|
#define NRF24L01_RF_PWR_MASK (3 << NRF24L01_RF_PWR_SHIFT)
|
||||||
|
|
||||||
|
/* FIFO STATUS register definitions */
|
||||||
|
|
||||||
|
#define NRF24L01_TX_REUSE (1 << 6)
|
||||||
|
#define NRF24L01_TX_FULL (1 << 5)
|
||||||
|
#define NRF24L01_TX_EMPTY (1 << 4)
|
||||||
|
#define NRF24L01_RX_FULL (1 << 1)
|
||||||
|
#define NRF24L01_RX_EMPTY (1 << 0)
|
||||||
|
|
||||||
|
/* SETUP_RETR */
|
||||||
|
|
||||||
|
#define NRF24L01_ARC_SHIFT 0
|
||||||
|
#define NRF24L01_ARC_MASK (0xF << NRF24L01_ARC_SHIFT)
|
||||||
|
|
||||||
|
#define NRF24L01_ARD_SHIFT 4
|
||||||
|
#define NRF24L01_ARD_MASK (0xF << NRF24L01_ARD_SHIFT)
|
||||||
|
|
||||||
|
/* OBSERVE_TX register definitions */
|
||||||
|
#define NRF24L01_PLOS_CNT_SHIFT 4
|
||||||
|
#define NRF24L01_PLOS_CNT_MASK (0xF << NRF24L01_PLOS_CNT_SHIFT)
|
||||||
|
#define NRF24L01_ARC_CNT_SHIFT 0
|
||||||
|
#define NRF24L01_ARC_CNT_MASK (0xF << NRF24L01_ARC_CNT_SHIFT)
|
||||||
|
#define NRF24L01_RX_P_NO_SHIFT 1
|
||||||
|
#define NRF24L01_RX_P_NO_MASK (7 << NRF24L01_RX_P_NO_SHIFT)
|
||||||
|
|
||||||
|
/* FEATURE register definitions */
|
||||||
|
|
||||||
|
#define NRF24L01_EN_DPL (1 << 2)
|
||||||
|
#define NRF24L01_EN_ACK_PAY (1 << 1)
|
||||||
|
#define NRF24L01_EN_DYN_ACK (1 << 0)
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data Types
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
# define EXTERN extern "C"
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
# define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __DRIVERS_WIRELESS_NRF24L01_H */
|
||||||
@@ -68,6 +68,7 @@
|
|||||||
#define _QEIOCBASE (0x0f00) /* Quadrature encoder ioctl commands */
|
#define _QEIOCBASE (0x0f00) /* Quadrature encoder ioctl commands */
|
||||||
#define _AUDIOIOCBASE (0x1000) /* Audio ioctl commands */
|
#define _AUDIOIOCBASE (0x1000) /* Audio ioctl commands */
|
||||||
#define _SLCDIOCBASE (0x1100) /* Segment LCD ioctl commands */
|
#define _SLCDIOCBASE (0x1100) /* Segment LCD ioctl commands */
|
||||||
|
#define _WLIOCBASE (0x1100) /* Wireless modules ioctl commands */
|
||||||
|
|
||||||
/* Macros used to manage ioctl commands */
|
/* Macros used to manage ioctl commands */
|
||||||
|
|
||||||
@@ -246,6 +247,12 @@
|
|||||||
#define _SLCDIOCVALID(c) (_IOC_TYPE(c)==_SLCDIOCBASE)
|
#define _SLCDIOCVALID(c) (_IOC_TYPE(c)==_SLCDIOCBASE)
|
||||||
#define _SLCDIOC(nr) _IOC(_SLCDIOCBASE,nr)
|
#define _SLCDIOC(nr) _IOC(_SLCDIOCBASE,nr)
|
||||||
|
|
||||||
|
/* Wireless driver ioctl definitions ************************************/
|
||||||
|
/* (see nuttx/include/wireless/wireless.h */
|
||||||
|
|
||||||
|
#define _WLIOCVALID(c) (_IOC_TYPE(c)==_WLIOCBASE)
|
||||||
|
#define _WLIOC(nr) _IOC(_WLIOCBASE,nr)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Type Definitions
|
* Public Type Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|||||||
+218
-173
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,444 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* include/nuttx/wireless/nrf24l01.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2013 Laurent Latil
|
||||||
|
* Author: Laurent Latil <laurent@latil.nom.fr>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __INCLUDE_NUTTX_NRF24L01_H
|
||||||
|
#define __INCLUDE_NUTTX_NRF24L01_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
#include <nuttx/spi.h>
|
||||||
|
#include <nuttx/irq.h>
|
||||||
|
#include <nuttx/wireless/wireless.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-Processor Declarations
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#define NRF24L01_MIN_ADDR_LEN 3 /* Minimal length (in bytes) of a pipe address */
|
||||||
|
#define NRF24L01_MAX_ADDR_LEN 5 /* Maximum length (in bytes) of a pipe address */
|
||||||
|
#define NRF24L01_MAX_PAYLOAD_LEN 32 /* Maximum length (in bytes) of a payload */
|
||||||
|
#define NRF24L01_MAX_XMIT_RETR 15 /* Maximum auto retransmit count (for AA transmissions) */
|
||||||
|
#define NRF24L01_PIPE_COUNT 6 /* Number of available pipes */
|
||||||
|
|
||||||
|
#define NRF24L01_MIN_FREQ 2400 /* Lower bound for RF frequency */
|
||||||
|
#define NRF24L01_MAX_FREQ 2525 /* Upper bound for RF frequency */
|
||||||
|
|
||||||
|
#define NRF24L01_DYN_LENGTH 33 /* Specific length value to use to enable dynamic packet length */
|
||||||
|
#define NRF24L01_XMIT_MAXRT 255 /* Specific value returned by Number of available pipes */
|
||||||
|
|
||||||
|
/* #define NRF24L01_DEBUG 1 */
|
||||||
|
|
||||||
|
/* IOCTL commands */
|
||||||
|
|
||||||
|
#define NRF24L01IOC_SETRETRCFG _WLIOC_USER(0x0001) /* arg: Pointer to nrf24l01_retrcfg_t structure */
|
||||||
|
#define NRF24L01IOC_GETRETRCFG _WLIOC_USER(0x0002) /* arg: Pointer to nrf24l01_retrcfg_t structure */
|
||||||
|
#define NRF24L01IOC_SETPIPESCFG _WLIOC_USER(0x0003) /* arg: Pointer to an array of nrf24l01_pipecfg_t pointers */
|
||||||
|
#define NRF24L01IOC_GETPIPESCFG _WLIOC_USER(0x0004) /* arg: Pointer to an array of nrf24l01_pipecfg_t pointers */
|
||||||
|
#define NRF24L01IOC_SETPIPESENABLED _WLIOC_USER(0x0005) /* arg: Pointer to a uint8_t value, bit field of enabled / disabled pipes */
|
||||||
|
#define NRF24L01IOC_GETPIPESENABLED _WLIOC_USER(0x0006) /* arg: Pointer to a uint8_t value, bit field of enabled / disabled pipes */
|
||||||
|
#define NRF24L01IOC_SETDATARATE _WLIOC_USER(0x0007) /* arg: Pointer to a nrf24l01_datarate_t value */
|
||||||
|
#define NRF24L01IOC_GETDATARATE _WLIOC_USER(0x0008) /* arg: Pointer to a nrf24l01_datarate_t value */
|
||||||
|
#define NRF24L01IOC_SETADDRWIDTH _WLIOC_USER(0x0009) /* arg: Pointer to an uint32_t value, width of the address */
|
||||||
|
#define NRF24L01IOC_GETADDRWIDTH _WLIOC_USER(0x000A) /* arg: Pointer to an uint32_t value, width of the address */
|
||||||
|
#define NRF24L01IOC_SETSTATE _WLIOC_USER(0x000B) /* arg: Pointer to a nrf24l01_state_t value */
|
||||||
|
#define NRF24L01IOC_GETSTATE _WLIOC_USER(0x000C) /* arg: Pointer to a nrf24l01_state_t value */
|
||||||
|
#define NRF24L01IOC_GETLASTXMITCOUNT _WLIOC_USER(0x000D) /* arg: Pointer to an uint32_t value, retransmission count of the last send operation (NRF24L01_XMIT_MAXRT if no ACK received)*/
|
||||||
|
#define NRF24L01IOC_GETLASTPIPENO _WLIOC_USER(0x000E) /* arg: Pointer to an uint32_t value, pipe # of the last received packet */
|
||||||
|
|
||||||
|
/* Aliased name for these commands */
|
||||||
|
|
||||||
|
#define NRF24L01IOC_SETTXADDR WLIOC_SETADDR
|
||||||
|
#define NRF24L01IOC_GETTXADDR WLIOC_GETADDR
|
||||||
|
|
||||||
|
/* NRF24L01 debug */
|
||||||
|
|
||||||
|
#ifdef NRF24L01_DEBUG
|
||||||
|
# define wdbg(format, arg...) dbg(format, ##arg)
|
||||||
|
# define wlldbg(format, arg...) lldbg(format, ##arg)
|
||||||
|
# define wvdbg(format, arg...) vdbg(format, ##arg)
|
||||||
|
# define wllvdbg(format, arg...) llvdbg(format, ##arg)
|
||||||
|
#else
|
||||||
|
# define wdbg(x...)
|
||||||
|
# define wlldbg(x...)
|
||||||
|
# define wvdbg(x...)
|
||||||
|
# define wllvdbg(x...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data Types
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
# define EXTERN extern "C"
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
# define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Data rates available for transmission */
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
RATE_1Mbps,
|
||||||
|
RATE_2Mbps,
|
||||||
|
RATE_250kbps
|
||||||
|
} nrf24l01_datarate_t;
|
||||||
|
|
||||||
|
/* Definition of the different possible states of the module */
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
ST_UNKNOWN,
|
||||||
|
ST_POWER_DOWN,
|
||||||
|
ST_STANDBY,
|
||||||
|
#ifdef CONFIG_WL_NRF24L01_RXSUPPORT
|
||||||
|
ST_RX
|
||||||
|
#endif
|
||||||
|
} nrf24l01_state_t;
|
||||||
|
|
||||||
|
/* Re-transmission delay */
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
DELAY_250us,
|
||||||
|
DELAY_500us,
|
||||||
|
DELAY_750us,
|
||||||
|
DELAY_1000us,
|
||||||
|
DELAY_1250us,
|
||||||
|
DELAY_1500us,
|
||||||
|
DELAY_1750us,
|
||||||
|
DELAY_2000us,
|
||||||
|
DELAY_2250us,
|
||||||
|
DELAY_2500us,
|
||||||
|
DELAY_2750us,
|
||||||
|
DELAY_3000us,
|
||||||
|
DELAY_3250us,
|
||||||
|
DELAY_3500us,
|
||||||
|
DELAY_3750us,
|
||||||
|
DELAY_4000us
|
||||||
|
} nrf24l01_retransmit_delay_t;
|
||||||
|
|
||||||
|
/* Opaque definition of a nRF24L01 device */
|
||||||
|
|
||||||
|
struct nrf24l01_dev_s;
|
||||||
|
|
||||||
|
/* Configuration info for a RX pipe */
|
||||||
|
|
||||||
|
struct nrf24l01_pipecfg_s
|
||||||
|
{
|
||||||
|
bool en_aa; /* Enable auto-acknowledge */
|
||||||
|
uint8_t rx_addr[NRF24L01_MAX_ADDR_LEN]; /* Receive address for the data pipe (LSB first) */
|
||||||
|
uint8_t payload_length; /* Define packet size (NRF24L01_DYN_LENGTH : dynamic length payload ) */
|
||||||
|
};
|
||||||
|
typedef struct nrf24l01_pipecfg_s nrf24l01_pipecfg_t;
|
||||||
|
|
||||||
|
/* Configuration of the retransmission parameters (used when AA is enabled) */
|
||||||
|
|
||||||
|
struct nrf24l01_retrcfg_s
|
||||||
|
{
|
||||||
|
nrf24l01_retransmit_delay_t delay; /* Delay before retransmitting (when no ACK received) */
|
||||||
|
uint8_t count; /* Retransmit retries count */
|
||||||
|
};
|
||||||
|
typedef struct nrf24l01_retrcfg_s nrf24l01_retrcfg_t;
|
||||||
|
|
||||||
|
/* A reference to a structure of this type must be passed to the initialization
|
||||||
|
* method (nrf24l01_init() ). It provides some board-specific hooks used
|
||||||
|
* by driver to manage the GPIO lines (IRQ and CE).
|
||||||
|
*
|
||||||
|
* Memory for this structure is provided by the caller. It is not copied
|
||||||
|
* by the driver and is presumed to persist while the driver is active.
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct nrf24l01_config_s
|
||||||
|
{
|
||||||
|
/* IRQ/GPIO access callbacks. These operations all hidden behind
|
||||||
|
* callbacks to isolate the ADS7843E driver from differences in GPIO
|
||||||
|
* interrupt handling by varying boards and MCUs. If possible,
|
||||||
|
* interrupts should be configured on both rising and falling edges
|
||||||
|
* so that contact and loss-of-contact events can be detected.
|
||||||
|
*
|
||||||
|
* irqattach - Attach the driver interrupt handler to the GPIO interrupt
|
||||||
|
* chipenable - Enable or disable the chip (CE line)
|
||||||
|
*/
|
||||||
|
|
||||||
|
int (*irqattach)(xcpt_t isr);
|
||||||
|
void (*chipenable)(bool enable);
|
||||||
|
};
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/** Register the nRF24L01+ device.
|
||||||
|
*
|
||||||
|
* \param spi SPI Device structure
|
||||||
|
* \param cfg Board specific configuration info
|
||||||
|
* \return Pointer to newly allocated nrf24l01 device structure or NULL on error (errno is set accordingly in this case).
|
||||||
|
*
|
||||||
|
* Possible errors:
|
||||||
|
* - ENOMEM: Out of kernel memory to allocate the device
|
||||||
|
**/
|
||||||
|
|
||||||
|
int nrf24l01_register(FAR struct spi_dev_s *spi, FAR struct nrf24l01_config_s *cfg);
|
||||||
|
|
||||||
|
/** Initialize the nRF24L01+ chip to a default initial state.
|
||||||
|
*
|
||||||
|
* \param dev Pointer to a registered nRF24L01 device structure
|
||||||
|
**/
|
||||||
|
|
||||||
|
int nrf24l01_init(FAR struct nrf24l01_dev_s *dev);
|
||||||
|
|
||||||
|
/** Get a pointer to the registered device
|
||||||
|
*/
|
||||||
|
|
||||||
|
FAR struct nrf24l01_dev_s * nrf24l01_getinstance(void);
|
||||||
|
|
||||||
|
/** Set the default TX address.
|
||||||
|
*
|
||||||
|
* \param dev Pointer to an nRF24L01 device structure
|
||||||
|
* \param addr TX address (LSByte first)
|
||||||
|
*
|
||||||
|
* \return 0
|
||||||
|
**/
|
||||||
|
|
||||||
|
int nrf24l01_settxaddr(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *addr);
|
||||||
|
|
||||||
|
/** Get the default TX address.
|
||||||
|
*
|
||||||
|
* \param dev Pointer to an nRF24L01 device structure
|
||||||
|
* \param addr TX address (LSByte first)
|
||||||
|
*
|
||||||
|
* \return 0
|
||||||
|
**/
|
||||||
|
|
||||||
|
int nrf24l01_gettxaddr(FAR struct nrf24l01_dev_s *dev, FAR uint8_t *addr);
|
||||||
|
|
||||||
|
/** Configure auto-retransmit
|
||||||
|
*
|
||||||
|
* \param dev Pointer to an nRF24L01 device structure
|
||||||
|
* \param retrdelay Auto-retransmit delay
|
||||||
|
* \param retrcount Auto-retransmit count (0 - 15)
|
||||||
|
* \return 0
|
||||||
|
**/
|
||||||
|
|
||||||
|
int nrf24l01_setretransmit(FAR struct nrf24l01_dev_s *dev, nrf24l01_retransmit_delay_t retrdelay, uint8_t retrcount);
|
||||||
|
|
||||||
|
/** Configure a RX pipe.
|
||||||
|
*
|
||||||
|
* \param dev Pointer to an nRF24L01 device structure
|
||||||
|
* \param pipeno Pipe number to configure
|
||||||
|
* \param pipecfg Pointer to configuration data
|
||||||
|
*
|
||||||
|
* \return 0
|
||||||
|
**/
|
||||||
|
|
||||||
|
int nrf24l01_setpipeconfig(FAR struct nrf24l01_dev_s *dev, unsigned int pipeno,
|
||||||
|
FAR const nrf24l01_pipecfg_t *pipecfg);
|
||||||
|
|
||||||
|
/** Get pipe configuration.
|
||||||
|
*
|
||||||
|
* \param dev Pointer to an nRF24L01 device structure
|
||||||
|
* \param pipeno Pipe number to configure
|
||||||
|
* \param pipecfg Pointer to configuration data used to store the config
|
||||||
|
*
|
||||||
|
* \return 0
|
||||||
|
**/
|
||||||
|
|
||||||
|
int nrf24l01_getpipeconfig(FAR struct nrf24l01_dev_s *dev, unsigned int pipeno,
|
||||||
|
FAR nrf24l01_pipecfg_t *pipecfg);
|
||||||
|
|
||||||
|
/** Enable a RX pipe.
|
||||||
|
*
|
||||||
|
* \param dev Pointer to an nRF24L01 device structure
|
||||||
|
* \param pipeno Pipe number
|
||||||
|
* \param enable true to enable the pipe, false to disable it
|
||||||
|
*
|
||||||
|
* \return 0
|
||||||
|
**/
|
||||||
|
|
||||||
|
int nrf24l01_enablepipe(FAR struct nrf24l01_dev_s *dev, unsigned int pipeno, bool enable);
|
||||||
|
|
||||||
|
/** Configure RF.
|
||||||
|
*
|
||||||
|
* \param dev Pointer to an nRF24L01 device structure
|
||||||
|
* \param datarate Datarate
|
||||||
|
* \param outpower Output power
|
||||||
|
*
|
||||||
|
* \return 0
|
||||||
|
**/
|
||||||
|
|
||||||
|
int nrf24l01_setuprf(FAR struct nrf24l01_dev_s *dev, nrf24l01_datarate_t datarate,
|
||||||
|
int outpower);
|
||||||
|
|
||||||
|
/** Configure the TX output power.
|
||||||
|
*
|
||||||
|
* Note that hardware supports only -18, -12, -6 and 0 dBm values.
|
||||||
|
*
|
||||||
|
* \param dev Pointer to an nRF24L01 device structure
|
||||||
|
* \param outpower Output power (in dBm).
|
||||||
|
*
|
||||||
|
* \return 0
|
||||||
|
**/
|
||||||
|
|
||||||
|
int nrf24l01_settxpower(FAR struct nrf24l01_dev_s *dev, int outpower);
|
||||||
|
|
||||||
|
/** Get the current TX output power.
|
||||||
|
*
|
||||||
|
* Note that hardware supports only -18, -12, -6 and 0 dBm values.
|
||||||
|
*
|
||||||
|
* \param dev Pointer to an nRF24L01 device structure
|
||||||
|
* \return outpower Output power (in dBm)
|
||||||
|
**/
|
||||||
|
|
||||||
|
int nrf24l01_gettxpower(FAR struct nrf24l01_dev_s *dev);
|
||||||
|
|
||||||
|
/** Set transmission data rate
|
||||||
|
|
||||||
|
* \param dev Pointer to an nRF24L01 device structure
|
||||||
|
* \return datarate Data rate
|
||||||
|
**/
|
||||||
|
|
||||||
|
int nrf24l01_setdatarate(FAR struct nrf24l01_dev_s *dev, nrf24l01_datarate_t datarate);
|
||||||
|
|
||||||
|
/** Set radio frequency.
|
||||||
|
*
|
||||||
|
* \param dev Pointer to an nRF24L01 device structure
|
||||||
|
* \param freq New frequency value (in Mhz: 2400 to 2525)
|
||||||
|
*
|
||||||
|
* \return OK
|
||||||
|
**/
|
||||||
|
|
||||||
|
int nrf24l01_setradiofreq(FAR struct nrf24l01_dev_s *dev, uint32_t freq);
|
||||||
|
|
||||||
|
/** Get current radio frequency.
|
||||||
|
*
|
||||||
|
* \param dev Pointer to an nRF24L01 device structure
|
||||||
|
*
|
||||||
|
* \return Radio frequency (in Mhz)
|
||||||
|
**/
|
||||||
|
|
||||||
|
uint32_t nrf24l01_getradiofreq(FAR struct nrf24l01_dev_s *dev);
|
||||||
|
|
||||||
|
/** Configure address length.
|
||||||
|
*
|
||||||
|
* \param dev Pointer to an nRF24L01 device structure
|
||||||
|
* \param width Address width to use (3-5)
|
||||||
|
* \return 0
|
||||||
|
**/
|
||||||
|
|
||||||
|
int nrf24l01_setaddrwidth(FAR struct nrf24l01_dev_s *dev, uint32_t width);
|
||||||
|
|
||||||
|
/** Change the current lifecycle state of the nRF24L01+ chip.
|
||||||
|
*
|
||||||
|
* \param dev Pointer to an nRF24L01 device structure
|
||||||
|
* \param state New state to put the nRF24L01 module into
|
||||||
|
**/
|
||||||
|
|
||||||
|
int nrf24l01_changestate(FAR struct nrf24l01_dev_s *dev, nrf24l01_state_t state);
|
||||||
|
|
||||||
|
/** Send data to the default address.
|
||||||
|
*
|
||||||
|
* \param dev Pointer to an nRF24L01 device structure
|
||||||
|
* \param data Pointer on the data buffer
|
||||||
|
* \param datalen Length of the buffer (in bytes)
|
||||||
|
*
|
||||||
|
* \return
|
||||||
|
**/
|
||||||
|
|
||||||
|
int nrf24l01_send(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data, size_t datalen);
|
||||||
|
|
||||||
|
/** Send data to the specified address.
|
||||||
|
*
|
||||||
|
* \param dev Pointer to an nRF24L01 device structure
|
||||||
|
* \param data Pointer on the data buffer
|
||||||
|
* \param datalen Length of the buffer (in bytes)
|
||||||
|
* \param destaddr Destination address
|
||||||
|
*
|
||||||
|
* \return
|
||||||
|
**/
|
||||||
|
|
||||||
|
int nrf24l01_sendto(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data,
|
||||||
|
size_t datalen, FAR const uint8_t *destaddr);
|
||||||
|
|
||||||
|
/** Get the retransmits count of the last transmission.
|
||||||
|
* This value is meaningful only if auto-acknowledge is enabled.
|
||||||
|
*
|
||||||
|
* \param dev Pointer to an nRF24L01 device structure
|
||||||
|
* \return Retransmit count, or NRF24L01_XMIT_MAXRT if no ACK received (transmission failure)
|
||||||
|
*/
|
||||||
|
|
||||||
|
int nrf24l01_xmitcount(FAR struct nrf24l01_dev_s *dev);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CONFIG_WL_NRF24L01_RXSUPPORT
|
||||||
|
|
||||||
|
/** Read the next received frame.
|
||||||
|
*
|
||||||
|
* \param dev Pointer to an nRF24L01 device structure
|
||||||
|
* \param buffer Pointer on buffer used to store the received frame bytes
|
||||||
|
* \param buflen Length of the buffer (in bytes)
|
||||||
|
* \param recvpipe Pointer to a byte value used to store the pipe number of the frame
|
||||||
|
* (use NULL if the pipe number info is not required)
|
||||||
|
*
|
||||||
|
* \return Length of the actual data
|
||||||
|
**/
|
||||||
|
|
||||||
|
ssize_t nrf24l01_recv(struct nrf24l01_dev_s *dev, uint8_t *buffer,
|
||||||
|
size_t buflen, uint8_t *recvpipe);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef NRF24L01_DEBUG
|
||||||
|
|
||||||
|
void nrf24l01_dumpregs(FAR struct nrf24l01_dev_s *dev);
|
||||||
|
|
||||||
|
void nrf24l01_dumprxfifo(FAR struct nrf24l01_dev_s *dev);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __INCLUDE_NUTTX_NRF24L01_H */
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
/************************************************************************************
|
||||||
|
* include/nuttx/wireless/wireless.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Laurent Latil <gnutt@nuttx.org>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/* This file includes common definitions to be used in all wireless drivers
|
||||||
|
* (when applicable).
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __INCLUDE_NUTTX_WIRELESS_H
|
||||||
|
#define __INCLUDE_NUTTX_WIRELESS_H
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Included Files
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
#include <nuttx/fs/ioctl.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_WIRELESS
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Pre-Processor Definitions
|
||||||
|
************************************************************************************/
|
||||||
|
/* IOCTL Commands *******************************************************************/
|
||||||
|
|
||||||
|
#define WLIOC_SETRADIOFREQ _WLIOC(0x0001) /* arg: Pointer to uint32_t, frequency value (in Mhz) */
|
||||||
|
#define WLIOC_GETRADIOFREQ _WLIOC(0x0002) /* arg: Pointer to uint32_t, frequency value (in Mhz) */
|
||||||
|
#define WLIOC_SETADDR _WLIOC(0x0003) /* arg: Pointer to address value, format of the address is driver specific */
|
||||||
|
#define WLIOC_GETADDR _WLIOC(0x0004) /* arg: Pointer to address value, format of the address is driver specific */
|
||||||
|
#define WLIOC_SETTXPOWER _WLIOC(0x0005) /* arg: Pointer to int32_t, output power (in dBm) */
|
||||||
|
#define WLIOC_GETTXPOWER _WLIOC(0x0006) /* arg: Pointer to int32_t, output power (in dBm) */
|
||||||
|
|
||||||
|
/* Wireless drivers can provide additional, device specific ioctl
|
||||||
|
* commands, beginning with this value:
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define WLIOC_USER 0x0007 /* Lowest, unused WL ioctl command */
|
||||||
|
|
||||||
|
#define _WLIOC_USER(nr) _WLIOC(nr + WLIOC_USER)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __INCLUDE_NUTTX_WIRELESS_H */
|
||||||
Reference in New Issue
Block a user