-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added LORA-E5 and RAK3172 lorawan modules #14859
Changes from 4 commits
1ed4cff
2a1e103
3e8e052
da1b28a
43185d8
ba833f4
cabc95b
b7aecc7
91e5abe
48ccc9f
637ffe3
b1de779
f8b571e
b227d3a
0c292a8
80d77d5
0a06bc5
95cd992
023b0bc
ce32eb7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,49 @@ | |
#include "STM32WL_radio_driver.h" | ||
#include "drivers/DigitalOut.h" | ||
|
||
|
||
/* Sets up radio switch position according to the radio mode */ | ||
#if defined (TARGET_LORA_E5) || defined (TARGET_RAK3172) | ||
/* This configuration is for RAK3172 or LoRa-E5 modules */ | ||
/* Theese one use only HP mode the LP mode is not connected nor RF Switch ctrl3 */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo issues There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could you precise what do you want me to fix? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
/* Added to avoid declarion in sample code for lorawan example with these mmodules */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
/* But provided as __weak so it has to be overwritten to match each specicific HW board */ | ||
MBED_WEAK void set_antenna_switch(RBI_Switch_TypeDef state) | ||
{ | ||
// Radio specific controls (TX/RX duplexer switch control) | ||
mbed::DigitalOut _rf_switch_ctrl1(MBED_CONF_STM32WL_LORA_DRIVER_RF_SWITCH_CTL1); | ||
mbed::DigitalOut _rf_switch_ctrl2(MBED_CONF_STM32WL_LORA_DRIVER_RF_SWITCH_CTL2); | ||
|
||
switch (state) { | ||
case RBI_SWITCH_OFF: { | ||
/* Turn off switch */ | ||
_rf_switch_ctrl1 = 0; | ||
_rf_switch_ctrl2 = 0; | ||
break; | ||
} | ||
case RBI_SWITCH_RX: { | ||
/*Turns On in Rx Mode the RF Switch */ | ||
_rf_switch_ctrl1 = 1; | ||
_rf_switch_ctrl2 = 0; | ||
break; | ||
} | ||
case RBI_SWITCH_RFO_LP: { | ||
/*Turns On in Tx High Power the RF Switch */ | ||
_rf_switch_ctrl1 = 0; | ||
_rf_switch_ctrl2 = 1; | ||
break; | ||
} | ||
case RBI_SWITCH_RFO_HP: { | ||
/*Turns On in Tx High Power the RF Switch */ | ||
_rf_switch_ctrl1 = 0; | ||
_rf_switch_ctrl2 = 1; | ||
break; | ||
} | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
#else | ||
/* This configuration is for NUCLEO_WL55JC */ | ||
/* But provided as __weak so it has to be overwritten to match each specicific HW board */ | ||
MBED_WEAK void set_antenna_switch(RBI_Switch_TypeDef state) | ||
|
@@ -62,3 +103,4 @@ MBED_WEAK void set_antenna_switch(RBI_Switch_TypeDef state) | |
} | ||
} | ||
|
||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright (c) 2020 ARM Limited. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
add_subdirectory(TARGET_LORA_E5 EXCLUDE_FROM_ALL) | ||
add_subdirectory(TARGET_RAK3172 EXCLUDE_FROM_ALL) | ||
|
||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM") | ||
set(STARTUP_FILE TOOLCHAIN_GCC_ARM/startup_stm32wle5xx.S) | ||
set(LINKER_FILE TOOLCHAIN_GCC_ARM/stm32wle5xc.ld) | ||
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM") | ||
set(STARTUP_FILE TOOLCHAIN_ARM/startup_stm32wle5xx.S) | ||
set(LINKER_FILE TOOLCHAIN_ARM/stm32wle5xc.sct) | ||
endif() | ||
|
||
add_library(mbed-stm32wle5xc INTERFACE) | ||
|
||
target_sources(mbed-stm32wle5xc | ||
INTERFACE | ||
${STARTUP_FILE} | ||
) | ||
|
||
target_include_directories(mbed-stm32wle5xc | ||
INTERFACE | ||
. | ||
) | ||
|
||
mbed_set_linker_script(mbed-stm32wle5xc ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE}) | ||
|
||
target_link_libraries(mbed-stm32wle5xc INTERFACE mbed-stm32wl) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright (c) 2020 ARM Limited. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
add_library(mbed-lora-e5 INTERFACE) | ||
|
||
target_sources(mbed-lora-e5 | ||
INTERFACE | ||
PeripheralPins.c | ||
system_clock.c | ||
) | ||
|
||
target_include_directories(mbed-lora-e5 | ||
INTERFACE | ||
. | ||
) | ||
|
||
target_link_libraries(mbed-lora-e5 INTERFACE mbed-stm32wle5xc) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* mbed Microcontroller Library | ||
* Copyright (c) 2019 ARM Limited | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Licensed 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 MBED_PERIPHERALNAMES_H | ||
#define MBED_PERIPHERALNAMES_H | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As you want, but I think we can move this file at TARGET_STM32WL level to be common for all ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. absolutely, once gain, need knowledge of CMake, will try. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are you ok to move 3 files There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok done |
||
#include "cmsis.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
typedef enum { | ||
DAC_1 = (int)DAC_BASE | ||
} DACName; | ||
|
||
|
||
typedef enum { | ||
ADC_1 = (int)ADC_BASE | ||
} ADCName; | ||
|
||
|
||
typedef enum { | ||
UART_1 = (int)USART1_BASE, | ||
UART_2 = (int)USART2_BASE, | ||
LPUART_1 = (int)LPUART1_BASE | ||
} UARTName; | ||
|
||
#define DEVICE_SPI_COUNT 2 | ||
typedef enum { | ||
SPI_1 = (int)SPI1_BASE, | ||
SPI_2 = (int)SPI2_BASE | ||
} SPIName; | ||
|
||
typedef enum { | ||
I2C_1 = (int)I2C1_BASE, | ||
I2C_2 = (int)I2C2_BASE, | ||
I2C_3 = (int)I2C3_BASE | ||
} I2CName; | ||
|
||
typedef enum { | ||
PWM_1 = (int)TIM1_BASE, | ||
PWM_2 = (int)TIM2_BASE, | ||
PWM_16 = (int)TIM16_BASE, | ||
PWM_17 = (int)TIM17_BASE | ||
} PWMName; | ||
|
||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this list of define will not be "nice" when we will add again more targets? :-)
Proposition:
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah don't like these define either. Subfolder is great, the deal is that I'm not a guru of cmake, so not sure how to tell which dir to include depending on target, I'll try that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't have targets configuration in libraries - these should be hw agnostic.
Instead, you can propose a sw configuration to enable/disable features. This could be used by any target configuration (e.g through mbed_app.json).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, looks like it was easier than I thought