mirror of
https://github.com/apache/nuttx.git
synced 2026-03-26 18:23:50 +08:00
wireless/lpwan: Add support for the RN903 and RN2483 family of LoRa
radio transceivers. This initial support includes transmit and receive functionality and configuration and reading of radio parameters like frequency and bandwidth. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
This commit is contained in:
committed by
Alan C. Assis
parent
219fb1a717
commit
b9b505a2b2
@@ -5,6 +5,13 @@
|
|||||||
|
|
||||||
if DRIVERS_LPWAN
|
if DRIVERS_LPWAN
|
||||||
|
|
||||||
|
config LPWAN_RN2XX3
|
||||||
|
bool "Microchip RN2xx3 driver support"
|
||||||
|
default n
|
||||||
|
depends on UART
|
||||||
|
---help---
|
||||||
|
Enable driver support for the RN2xx3 LoRa radio transceiver family.
|
||||||
|
|
||||||
config LPWAN_SX127X
|
config LPWAN_SX127X
|
||||||
bool "SX127X Low Power Long Range transceiver support"
|
bool "SX127X Low Power Long Range transceiver support"
|
||||||
default n
|
default n
|
||||||
|
|||||||
@@ -26,5 +26,6 @@ ifeq ($(CONFIG_DRIVERS_LPWAN),y)
|
|||||||
|
|
||||||
include wireless/lpwan/sx127x/Make.defs
|
include wireless/lpwan/sx127x/Make.defs
|
||||||
include wireless/lpwan/sx126x/Make.defs
|
include wireless/lpwan/sx126x/Make.defs
|
||||||
|
include wireless/lpwan/rn2xx3/Make.defs
|
||||||
|
|
||||||
endif # CONFIG_DRIVERS_LPWAN
|
endif # CONFIG_DRIVERS_LPWAN
|
||||||
|
|||||||
25
drivers/wireless/lpwan/rn2xx3/CMakeLists.txt
Normal file
25
drivers/wireless/lpwan/rn2xx3/CMakeLists.txt
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# ##############################################################################
|
||||||
|
# drivers/wireless/lpwan/rn2xx3/CMakeLists.txt
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
|
||||||
|
# license agreements. See the NOTICE file distributed with this work for
|
||||||
|
# additional information regarding copyright ownership. The ASF licenses this
|
||||||
|
# file to you under the Apache License, Version 2.0 (the "License"); you may not
|
||||||
|
# use this file except in compliance with the License. You may obtain a copy of
|
||||||
|
# the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations under
|
||||||
|
# the License.
|
||||||
|
#
|
||||||
|
# ##############################################################################
|
||||||
|
|
||||||
|
if(CONFIG_LPWAN_RN2903)
|
||||||
|
target_sources(drivers PRIVATE rn2xx3.c)
|
||||||
|
endif()
|
||||||
31
drivers/wireless/lpwan/rn2xx3/Make.defs
Normal file
31
drivers/wireless/lpwan/rn2xx3/Make.defs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
############################################################################
|
||||||
|
# drivers/wireless/lpwan/rn2xx3/Make.defs
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
# contributor license agreements. See the NOTICE file distributed with
|
||||||
|
# this work for additional information regarding copyright ownership. The
|
||||||
|
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance with the
|
||||||
|
# License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_LPWAN_RN2XX3),y)
|
||||||
|
|
||||||
|
CSRCS += rn2xx3.c
|
||||||
|
|
||||||
|
DEPPATH += --dep-path wireless$(DELIM)lpwan$(DELIM)rn2xx3
|
||||||
|
VPATH += :wireless$(DELIM)lpwan$(DELIM)rn2xx3
|
||||||
|
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)drivers$(DELIM)wireless$(DELIM)lpwan$(DELIM)rn2xx3
|
||||||
|
|
||||||
|
endif # CONFIG_LPWAN_RN2903
|
||||||
1940
drivers/wireless/lpwan/rn2xx3/rn2xx3.c
Normal file
1940
drivers/wireless/lpwan/rn2xx3/rn2xx3.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -57,8 +57,50 @@
|
|||||||
#define WLIOC_GETADDR _WLCIOC(0x0004) /* arg: Pointer to address value, format
|
#define WLIOC_GETADDR _WLCIOC(0x0004) /* arg: Pointer to address value, format
|
||||||
* of the address is driver specific */
|
* of the address is driver specific */
|
||||||
#define WLIOC_SETTXPOWER _WLCIOC(0x0005) /* arg: Pointer to int32_t, */
|
#define WLIOC_SETTXPOWER _WLCIOC(0x0005) /* arg: Pointer to int32_t, */
|
||||||
/* output power (in dBm) */
|
/* output power (in 0.01 dBm) */
|
||||||
#define WLIOC_GETTXPOWER _WLCIOC(0x0006) /* arg: Pointer to int32_t, */
|
#define WLIOC_GETTXPOWER _WLCIOC(0x0006) /* arg: Pointer to int32_t, */
|
||||||
|
/* output power (in 0.01 dBm) */
|
||||||
|
|
||||||
|
/* WARNING: The following WLIOC command are EXPERIMENTAL and unstable. They
|
||||||
|
* may be removed or modified in upcoming changes that introduce a common
|
||||||
|
* LoRa API. These commands are currently only used by the RN2XX3 driver.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define WLIOC_SETBANDWIDTH _WLCIOC(0x0007) /* arg: Pointer to uint32_t, */
|
||||||
|
/* bandwidth in Hz */
|
||||||
|
#define WLIOC_GETBANDWIDTH _WLCIOC(0x0008) /* arg: Pointer to uint32_t, */
|
||||||
|
/* bandwidth in Hz */
|
||||||
|
#define WLIOC_SETSPREAD _WLCIOC(0x0009) /* arg: Pointer to uint8_t, */
|
||||||
|
/* spread factor */
|
||||||
|
#define WLIOC_GETSPREAD _WLCIOC(0x000a) /* arg: Pointer to uint8_t, */
|
||||||
|
/* spread factor */
|
||||||
|
#define WLIOC_GETSNR _WLCIOC(0x000b) /* arg: Pointer to int8_t, */
|
||||||
|
/* signal to noise ratio */
|
||||||
|
#define WLIOC_SETPRLEN _WLCIOC(0x000c) /* arg: uint16_t, */
|
||||||
|
/* preamble length */
|
||||||
|
#define WLIOC_GETPRLEN _WLCIOC(0x000d) /* arg: Pointer to uint16_t, */
|
||||||
|
/* preamble length */
|
||||||
|
#define WLIOC_SETMOD _WLCIOC(0x000e) /* arg: enum, */
|
||||||
|
/* modulation type */
|
||||||
|
#define WLIOC_GETMOD _WLCIOC(0x000f) /* arg: enum pointer, */
|
||||||
|
/* modulation type */
|
||||||
|
#define WLIOC_RESET _WLCIOC(0x0010) /* arg: none */
|
||||||
|
#define WLIOC_SETSYNC _WLCIOC(0x0011) /* arg: uint64_t pointer */
|
||||||
|
/* sync word */
|
||||||
|
#define WLIOC_GETSYNC _WLCIOC(0x0012) /* arg: uint64_t pointer, */
|
||||||
|
/* sync word */
|
||||||
|
#define WLIOC_SETBITRATE _WLCIOC(0x0013) /* arg: uint32_t */
|
||||||
|
/* sync word */
|
||||||
|
#define WLIOC_GETBITRATE _WLCIOC(0x0014) /* arg: uint32_t pointer, */
|
||||||
|
/* sync word */
|
||||||
|
#define WLIOC_IQIEN _WLCIOC(0x0015) /* arg: bool, enable invert IQ */
|
||||||
|
#define WLIOC_CRCEN _WLCIOC(0x0016) /* arg: bool, enable CRC */
|
||||||
|
#define WLIOC_SETCODERATE _WLCIOC(0x0017) /* arg: enum, coding rate */
|
||||||
|
#define WLIOC_GETCODERATE _WLCIOC(0x0018) /* arg: enum pointer, */
|
||||||
|
/* coding rate */
|
||||||
|
#define WLIOC_SETTXPOWERF _WLCIOC(0x0019) /* arg: Pointer to flaot, */
|
||||||
|
/* output power (in dBm) */
|
||||||
|
#define WLIOC_GETTXPOWERF _WLCIOC(0x0020) /* arg: Pointer to float, */
|
||||||
/* output power (in dBm) */
|
/* output power (in dBm) */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -66,7 +108,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define WL_FIRST 0x0001 /* First common command */
|
#define WL_FIRST 0x0001 /* First common command */
|
||||||
#define WL_NCMDS 0x0006 /* Number of common commands */
|
#define WL_NCMDS 0x0020 /* Number of common commands */
|
||||||
|
|
||||||
/* User defined ioctl commands are also supported. These will be forwarded
|
/* User defined ioctl commands are also supported. These will be forwarded
|
||||||
* by the upper-half driver to the lower-half driver via the ioctl()
|
* by the upper-half driver to the lower-half driver via the ioctl()
|
||||||
|
|||||||
83
include/nuttx/wireless/lpwan/rn2xx3.h
Normal file
83
include/nuttx/wireless/lpwan/rn2xx3.h
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* include/nuttx/wireless/lpwan/rn2xx3.h
|
||||||
|
*
|
||||||
|
* NOTE: EXPERIMENTAL DRIVER
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __INCLUDE_NUTTX_WIRELESS_LPWAN_RN2XX3_H
|
||||||
|
#define __INCLUDE_NUTTX_WIRELESS_LPWAN_RN2XX3_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
#include <nuttx/wireless/ioctl.h>
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-Processor Declarations
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data Types
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Modulation types */
|
||||||
|
|
||||||
|
enum rn2xx3_mod_e
|
||||||
|
{
|
||||||
|
RN2XX3_MOD_LORA = 0, /* LoRa modulation */
|
||||||
|
RN2XX3_MOD_FSK = 1, /* FSK modulation */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Coding rates */
|
||||||
|
|
||||||
|
enum rn2xx3_cr_e
|
||||||
|
{
|
||||||
|
RN2XX3_CR_4_5 = 0, /* 4/5 coding rate */
|
||||||
|
RN2XX3_CR_4_6 = 1, /* 4/6 coding rate */
|
||||||
|
RN2XX3_CR_4_7 = 2, /* 4/7 coding rate */
|
||||||
|
RN2XX3_CR_4_8 = 3, /* 4/8 coding rate */
|
||||||
|
};
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: rn2xx3_register
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Register the RN2xx3 LoRa transceiver driver.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* devpath - The device path to use for the driver
|
||||||
|
* uartpath - The path to the UART character driver connected to the
|
||||||
|
* transceiver
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int rn2xx3_register(FAR const char *devpath, FAR const char *uartpath);
|
||||||
|
|
||||||
|
#endif /* __INCLUDE_NUTTX_WIRELESS_LPWAN_RN2XX3_H */
|
||||||
Reference in New Issue
Block a user