Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
/drivers/*/vexriscv_litex.c @mateusz-holenko @kgugala @pgielda
/drivers/led/ @Mani-Sadhasivam
/drivers/led_strip/ @mbolivar
/drivers/lora/ @Mani-Sadhasivam
/drivers/modem/ @mike-scott
/drivers/pci/ @gnuless
/drivers/pcie/ @gnuless
Expand Down Expand Up @@ -254,6 +255,7 @@
/include/misc/ @andrewboie @andyross
/include/net/ @jukkar @tbursztyka @pfalcon
/include/net/buf.h @jukkar @jhedberg @tbursztyka @pfalcon
/include/net/lora.h @Mani-Sadhasivam
/include/posix/ @pfalcon
/include/power/power.h @wentongwu @nashif
/include/ptp_clock.h @jukkar
Expand Down Expand Up @@ -287,6 +289,7 @@
/samples/display/ @vanwinkeljan
/samples/drivers/CAN/ @alexanderwachter
/samples/drivers/ht16k33/ @henrikbrixandersen
/samples/drivers/lora/ @Mani-Sadhasivam
/samples/gui/ @vanwinkeljan
/samples/net/ @jukkar @tbursztyka @pfalcon
/samples/net/dns_resolve/ @jukkar @tbursztyka @pfalcon
Expand Down
15 changes: 15 additions & 0 deletions boards/arm/96b_wistrio/96b_wistrio.dts
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,18 @@
label = "LIS3DH";
};
};

&spi1 {
status = "okay";
cs-gpios = <&gpiob 0 0>;

sx1276@0 {
compatible = "semtech,sx1276";
reg = <0>;
label = "sx1276";
reset-gpios = <&gpiob 13 0>;
dio-gpios = <&gpioa 11 0>;
clock-frequency = <32000000>;
spi-max-frequency = <1000000>;
};
};
48 changes: 43 additions & 5 deletions boards/arm/96b_wistrio/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
* SPDX-License-Identifier: Apache-2.0
*/

#include <kernel.h>
#include <device.h>
#include <gpio.h>
#include <init.h>
#include <drivers/pinmux.h>
#include <sys/sys_io.h>
#include <kernel.h>
#include <pinmux.h>
#include <sys_io.h>

#include <pinmux/stm32/pinmux_stm32.h>

Expand All @@ -25,16 +26,53 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PB8, STM32L1X_PINMUX_FUNC_PB8_I2C1_SCL},
{STM32_PIN_PB9, STM32L1X_PINMUX_FUNC_PB9_I2C1_SDA},
#endif /* CONFIG_I2C_1 */
#ifdef CONFIG_SPI_1
{STM32_PIN_PA5, STM32L1X_PINMUX_FUNC_PA5_SPI1_SCK},
{STM32_PIN_PA6, STM32L1X_PINMUX_FUNC_PA6_SPI1_MISO},
{STM32_PIN_PA7, STM32L1X_PINMUX_FUNC_PA7_SPI1_MOSI},
#endif /* CONFIG_SPI_1 */
{STM32_PIN_PA4, STM32_PUSHPULL_PULLUP},
{STM32_PIN_PA11, STM32_PUSHPULL_PULLUP},
{STM32_PIN_PB6, STM32_PUSHPULL_PULLUP},
{STM32_PIN_PB7, STM32_PUSHPULL_PULLUP},
};

static int pinmux_stm32_init(struct device *port)
{
ARG_UNUSED(port);
struct device *gpioa, *gpiob, *gpioh;

stm32_setup_pins(pinconf, ARRAY_SIZE(pinconf));

gpioa = device_get_binding(DT_ST_STM32_GPIO_40020000_LABEL);
if (!gpioa) {
return -ENODEV;
}

gpiob = device_get_binding(DT_ST_STM32_GPIO_40020400_LABEL);
if (!gpiob) {
return -ENODEV;
}

gpioh = device_get_binding(DT_ST_STM32_GPIO_40021400_LABEL);
if (!gpioh) {
return -ENODEV;
}

gpio_pin_configure(gpioa, 4, GPIO_DIR_OUT);
gpio_pin_write(gpioa, 4, 1);

gpio_pin_configure(gpiob, 6, GPIO_DIR_OUT);
gpio_pin_write(gpiob, 6, 1);

gpio_pin_configure(gpiob, 7, GPIO_DIR_OUT);
gpio_pin_write(gpiob, 7, 0);

gpio_pin_configure(gpioh, 1, GPIO_DIR_OUT);
gpio_pin_write(gpioh, 1, 1);

return 0;
}

SYS_INIT(pinmux_stm32_init, PRE_KERNEL_1,
CONFIG_PINMUX_STM32_DEVICE_INITIALIZATION_PRIORITY);
/* Need to be initialised after GPIO driver */
SYS_INIT(pinmux_stm32_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
1 change: 1 addition & 0 deletions drivers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ add_subdirectory_if_kconfig(wifi)
add_subdirectory_if_kconfig(can)
add_subdirectory_if_kconfig(audio)
add_subdirectory_if_kconfig(hwinfo)
add_subdirectory_if_kconfig(lora)

add_subdirectory_ifdef(CONFIG_FLASH_HAS_DRIVER_ENABLED flash)
add_subdirectory_ifdef(CONFIG_SERIAL_HAS_DRIVER serial)
Expand Down
2 changes: 2 additions & 0 deletions drivers/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ source "drivers/bluetooth/Kconfig"

source "drivers/ieee802154/Kconfig"

source "drivers/lora/Kconfig"

source "drivers/console/Kconfig"

source "drivers/ethernet/Kconfig"
Expand Down
3 changes: 3 additions & 0 deletions drivers/lora/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0

zephyr_sources_ifdef(CONFIG_LORA_SX1276 sx1276.c)
28 changes: 28 additions & 0 deletions drivers/lora/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# Copyright (c) 2019 Manivannan Sadhasivam
#
# SPDX-License-Identifier: Apache-2.0
#

# Top-level configuration file for LORA drivers.

menuconfig LORA
bool "LoRa drivers"
help
Include LoRa drivers in the system configuration.

if LORA

module = LORA
module-str = lora
source "subsys/logging/Kconfig.template.log_config"

config LORA_INIT_PRIORITY
int "LoRa initialization priority"
default 90
help
System initialization priority for LoRa drivers.

source "drivers/lora/Kconfig.sx1276"

endif # LORA
33 changes: 33 additions & 0 deletions drivers/lora/Kconfig.sx1276
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#
# Copyright (c) 2019 Manivannan Sadhasivam
#
# SPDX-License-Identifier: Apache-2.0
#

menuconfig LORA_SX1276
bool "Semtech SX1276 driver"
depends on SPI
help
Enable LoRa driver for Semtech SX1276.

if LORA_SX1276

choice
prompt "SX1276 PA Output pin"
default PA_BOOST_PIN
help
Antenna connection type.

config PA_RFO_PIN
bool "PA_RFO_PIN"
help
Antenna connected to PA_RFO pin.

config PA_BOOST_PIN
bool "PA_BOOST_PIN"
help
Antenna connected to PA_BOOST pin.

endchoice

endif # LORA_SX1276
Loading