Add NSRF42L01 driver. From Laurent Latil

This commit is contained in:
Gregory Nutt
2013-06-01 08:03:55 -06:00
parent 49fd78a70a
commit 0e37ec1bfc
16 changed files with 3410 additions and 757 deletions
+123
View File
@@ -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 868870 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}
};
+121
View File
@@ -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 902928 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}
};
+52
View File
@@ -2,3 +2,55 @@
# For a description of the syntax of this configuration file,
# 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
+12 -6
View File
@@ -37,11 +37,17 @@ ifeq ($(CONFIG_WIRELESS),y)
# Include wireless drivers
ifeq ($(CONFIG_WL_CC1101),y)
CSRCS += cc1101.c ISM1_868MHzGFSK100kbps.c ISM2_905MHzGFSK250kbps.c
# Include wireless build support
DEPPATH += --dep-path wireless$(DELIM)cc1101
VPATH += :wireless$(DELIM)cc1101
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)wireless$(DELIM)cc1101}
endif
ifeq ($(CONFIG_WL_NRF24L01),y)
CSRCS += nrf24l01.c
endif
# Include wireless devices build support
DEPPATH += --dep-path wireless
VPATH += :wireless
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)wireless}
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 868870 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 902928 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}
};
-4
View File
@@ -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
+183
View File
@@ -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 */