Skip to content

Commit

Permalink
drivers/wireless/lpwan/sx126x:
Browse files Browse the repository at this point in the history
[Experimental]
This adds a driver for the SX126x (SX1261 and SX1262) LoRa chips.
All functions and definitions are coming directly from the DS SX1261-2 V2.1 datasheet.

Signed-off-by: Kevin Witteveen (MartiniMarter) <[email protected]>
  • Loading branch information
keever50 committed Feb 24, 2025
1 parent 1aced99 commit 17f7213
Show file tree
Hide file tree
Showing 9 changed files with 2,367 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/wireless/lpwan/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ config LPWAN_SX127X
---help---
This options adds driver support for the Samtech SX127X chip.

config LPWAN_SX126X
bool "SX126X Low Power Long Range transceiver support"
default n
select SPI
---help---
This options adds driver support for the Samtech SX126X chip.

source "drivers/wireless/lpwan/sx126x/Kconfig"

if LPWAN_SX127X

config LPWAN_SX127X_RFFREQ_DEFAULT
Expand Down
1 change: 1 addition & 0 deletions drivers/wireless/lpwan/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@
ifeq ($(CONFIG_DRIVERS_LPWAN),y)

include wireless/lpwan/sx127x/Make.defs
include wireless/lpwan/sx126x/Make.defs

endif # CONFIG_DRIVERS_LPWAN
24 changes: 24 additions & 0 deletions drivers/wireless/lpwan/sx126x/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# ##############################################################################
# drivers/wireless/lpwan/sx126x/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_SX126X)
target_sources(drivers PRIVATE sx126x.c)
endif()
28 changes: 28 additions & 0 deletions drivers/wireless/lpwan/sx126x/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

if LPWAN_SX126X

config LPWAN_SX126X_RFFREQ_DEFAULT
int "SX126X default RF frequency Hz"
default 869252000

config LPWAN_SX126X_SF_DEFAULT
int "SX126X default spreading factor"
default 10

config LPWAN_SX126X_BW_DEFAULT
int "SX126X default bandwidth kHz"
default 125

config LPWAN_SX126X_CR_DEFAULT
int "SX126X default coding rate"
default 8

config LPWAN_SX126X_MAX_DEVICES
int "SX126X maximum devices"
default 1

endif # DRIVERS_LPWAN
35 changes: 35 additions & 0 deletions drivers/wireless/lpwan/sx126x/Make.defs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
############################################################################
# drivers/wireless/lpwan/sx126x/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.
#
############################################################################

# Include SX126X drivers into the build

ifeq ($(CONFIG_LPWAN_SX126X),y)

CSRCS += sx126x.c

# Include SX126X build support

DEPPATH += --dep-path wireless$(DELIM)lpwan$(DELIM)sx126x
VPATH += :wireless$(DELIM)lpwan$(DELIM)sx126x
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)drivers$(DELIM)wireless$(DELIM)lpwan$(DELIM)sx126x

endif # CONFIG_LPWAN_SX126X
Loading

0 comments on commit 17f7213

Please sign in to comment.