Skip to content

Commit

Permalink
[Telink] Added W91 v2.1 board configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
interfer committed Sep 23, 2024
1 parent e103352 commit c8f41cb
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 45 deletions.
2 changes: 1 addition & 1 deletion config/telink/chip-module/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ config CHIP_IPV4

config CHIP_BUTTON_MANAGER_IRQ_MODE
bool "Use GPIO in an IRQ mode instead of polling the GPIO"
default PM
default y if BOARD_TLSR9118BDK40D_V2
help
Use GPIO in an IRQ mode to avoid button polling loop and extend the battery lifetime by waking up by GPIO event.
GPIO events are working only with GPIO IRQ. This option changes button matrix configuration.
Expand Down
5 changes: 3 additions & 2 deletions config/telink/chip-module/Kconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ config PWM
endif

# Board non-retention config
if BOARD_TLSR9118BDK40D || BOARD_TLSR9528A || BOARD_TLSR9258A || BOARD_TLSR9518ADK80D
if BOARD_TLSR9118BDK40D_V1 || BOARD_TLSR9118BDK40D_V2 || \
BOARD_TLSR9528A || BOARD_TLSR9258A || BOARD_TLSR9518ADK80D
config PWM
default y
endif
Expand Down Expand Up @@ -292,7 +293,7 @@ config NET_CONFIG_INIT_TIMEOUT

config CHIP_WIFI
bool "Enable Telink Wi-Fi support"
default y if BOARD_TLSR9118BDK40D
default y if BOARD_TLSR9118BDK40D_V1 || BOARD_TLSR9118BDK40D_V2
select WIFI_W91
select WIFI
select NET_STATISTICS
Expand Down
9 changes: 7 additions & 2 deletions examples/platform/telink/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
string(REPLACE "_retention" "" BASE_BOARD ${BOARD})

if(NOT FLASH_SIZE)
if(${BASE_BOARD} MATCHES "tlsr9118bdk40d")
if(${BASE_BOARD} MATCHES "tlsr9118bdk40d" OR ${BASE_BOARD} MATCHES "tlsr9118bdk40d_v1"
OR ${BASE_BOARD} MATCHES "tlsr9118bdk40d_v2")
set(FLASH_SIZE "3m")
else()
set(FLASH_SIZE "2m")
Expand Down Expand Up @@ -96,7 +97,11 @@ endif()

set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BASE_BOARD}_${FLASH_SIZE}_flash.overlay")
if(NOT EXISTS "${FLASH_DTC_OVERLAY_FILE}")
message(FATAL_ERROR "${FLASH_DTC_OVERLAY_FILE} doesn't exist")
if(${BASE_BOARD} MATCHES "tlsr9118bdk40d_v1" OR ${BASE_BOARD} MATCHES "tlsr9118bdk40d_v2")
set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/tlsr9118bdk40d_${FLASH_SIZE}_flash.overlay")
else()
message(FATAL_ERROR "${FLASH_DTC_OVERLAY_FILE} doesn't exist")
endif()
endif()

if(DTC_OVERLAY_FILE)
Expand Down
3 changes: 2 additions & 1 deletion examples/platform/telink/common/src/AppTaskCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,8 @@ void AppTaskCommon::InitPwms()

void AppTaskCommon::LinkPwms(PwmManager & pwmManager)
{
#if CONFIG_BOARD_TLSR9118BDK40D // TLSR9118BDK40D EVK supports only 1 PWM channel connected to LED
#if CONFIG_BOARD_TLSR9118BDK40D_V1 || CONFIG_BOARD_TLSR9118BDK40D_v2
// TLSR9118BDK40D EVK supports only 1 PWM channel connected to LED
pwmManager.linkPwm(PwmManager::EAppPwm_Red, 0);
#elif CONFIG_WS2812_STRIP
pwmManager.linkPwm(PwmManager::EAppPwm_Red, 0);
Expand Down
39 changes: 0 additions & 39 deletions src/platform/telink/tlsr9118bdk40d.overlay

This file was deleted.

1 change: 1 addition & 0 deletions src/platform/telink/tlsr9118bdk40d.overlay
39 changes: 39 additions & 0 deletions src/platform/telink/tlsr9118bdk40d_v1.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/ {
/* Short TL_Key1 (J20 pin 11) to ground (J20 pin 25-35) */
key_pool {
compatible = "gpio-keys";

inp {
gpios = <&gpio0 16 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>,
<&gpio0 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
};
};

key_matrix {
compatible = "gpio-keys";

col {
gpios = <&gpio0 18 GPIO_ACTIVE_HIGH>,
<&gpio0 17 GPIO_ACTIVE_HIGH>;
};

row {
gpios = <&gpio0 16 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>,
<&gpio0 15 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
};
};

led_pool{
compatible = "gpio-leds";

out {
gpios = <&gpio0 19 GPIO_ACTIVE_HIGH>;
};
};
pwm_pool {
compatible = "pwm-leds";
out {
pwms = <&pwm0 4 PWM_MSEC(1) PWM_POLARITY_NORMAL>;
};
};
};
30 changes: 30 additions & 0 deletions src/platform/telink/tlsr9118bdk40d_v2.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

/* TLSR9118BDK40D V2.1 */

/ {
key_pool {
compatible = "gpio-keys";

inp {
gpios = <&gpio0 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>,
<&gpio0 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>,
<&gpio0 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>,
<&gpio0 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
};
};

led_pool{
compatible = "gpio-leds";

out {
gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
};
};

pwm_pool {
compatible = "pwm-leds";
out {
pwms = <&pwm0 3 PWM_MSEC(1) PWM_POLARITY_NORMAL>;
};
};
};

0 comments on commit c8f41cb

Please sign in to comment.