Skip to content

Commit

Permalink
initial build for MJWSD05MMC (no display)
Browse files Browse the repository at this point in the history
  • Loading branch information
devbis committed Nov 13, 2023
1 parent 0155a2e commit c484079
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 46 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,23 @@ jobs:
- name: Get SDK
run: git clone https://github.com/devbis/tl_zigbee_sdk.git -b 3.6.8.5 --depth 1 ${{ env.SDK_DIR }}

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DSDK_PREFIX=${{env.SDK_DIR}} -DTOOLCHAIN_PREFIX=${{env.TOOLCHAIN_DIR}}
- name: Build LYWSD03MMC
id: make_lywsd03mmc
run: |
cmake -B ${{github.workspace}}/build -DDEVICE=LYWSD03MMC -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DSDK_PREFIX=${{env.SDK_DIR}} -DTOOLCHAIN_PREFIX=${{env.TOOLCHAIN_DIR}}
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target=zlywsd03mmc.zigbee
echo "status=success" >> $GITHUB_OUTPUT
- name: Build
id: make
- name: Build MJWSD05MMC
id: make_mjwsd05mmc
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target=z03mmc.zigbee
cmake -B ${{github.workspace}}/build -DDEVICE=MJWSD05MMC -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DSDK_PREFIX=${{env.SDK_DIR}} -DTOOLCHAIN_PREFIX=${{env.TOOLCHAIN_DIR}}
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target=zmjwsd05mmc.zigbee
echo "status=success" >> $GITHUB_OUTPUT
- name: Upload a Build Artifact
uses: actions/upload-artifact@v3
if: steps.make.outputs.status == 'success' && !cancelled()
if: (steps.make_lywsd03mmc.outputs.status == 'success' || steps.make_mjwsd05mmc.outputs.status == 'success') && !cancelled()
with:
# Artifact name
name: firmware
Expand Down
15 changes: 8 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
################################
# Common settings

SET(TARGET z03mmc)

IF(NOT MIMIC_HEIMAN)
SET(MIMIC_HEIMAN 0)
IF(DEVICE STREQUAL "LYWSD03MMC")
SET(DEVICE_TYPE 3)
SET(TARGET zlywsd03mmc)
ELSEIF(DEVICE STREQUAL "MJWSD05MMC")
SET(DEVICE_TYPE 4)
SET(TARGET zmjwsd05mmc)
ELSE()
SET(TARGET ${TARGET}_heiman)
message(FATAL_ERROR "No DEVICE specified (use one of LYWSD03MMC, MJWSD05MMC)")
ENDIF()



ADD_DEFINITIONS(
-DEND_DEVICE=1
-DMCU_CORE_${TELINK_PLATFORM}=1
-DMCU_STARTUP_${TELINK_PLATFORM}=1
-DMIMIC_HEIMAN=${MIMIC_HEIMAN}
-DDEVICE_TYPE=${DEVICE_TYPE}
)

################################
Expand Down
43 changes: 17 additions & 26 deletions src/app_cfg.h
Original file line number Diff line number Diff line change
@@ -1,26 +1,3 @@
/********************************************************************************************************
* @file app_cfg.h
*
* @brief This is the header file for app_cfg
*
* @author Zigbee Group
* @date 2021
*
* @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK")
*
* 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.
*******************************************************************************************************/

#pragma once

/* Enable C linkage for C++ Compilers: */
Expand Down Expand Up @@ -63,6 +40,7 @@ extern "C" {
#define BOARD_B91_EVK 8
#define BOARD_B91_DONGLE 9
#define BOARD_8258_03MMC 10
#define BOARD_8258_05MMC 11

/* Board define */
#if defined(MCU_CORE_826x)
Expand All @@ -76,8 +54,19 @@ extern "C" {
#if (CHIP_TYPE == TLSR_8258_1M)
#define FLASH_CAP_SIZE_1M 1
#endif
#define BOARD BOARD_8258_03MMC//BOARD_8258_DONGLE//BOARD_8258_EVK
#define CLOCK_SYS_CLOCK_HZ 24000000 //48000000

#define DEVICE_LYWSD03MMC 3
#define DEVICE_MJWSD05MMC 4

#if DEVICE == DEVICE_LYWSD03MMC
#define BOARD BOARD_8258_03MMC
#elif DEVICE == DEVICE_LYWSD05MMC
#define BOARD BOARD_8258_05MMC
#else
#error "Please, specify device type"
#endif
#define CLOCK_SYS_CLOCK_HZ 24000000 //48000000

#elif defined(MCU_CORE_8278)
#define FLASH_CAP_SIZE_1M 1
#define BOARD BOARD_8278_DONGLE//BOARD_8278_EVK
Expand All @@ -98,7 +87,9 @@ extern "C" {
#elif (BOARD == BOARD_826x_DONGLE_PA)
#include "board_826x_dongle_pa.h"
#elif (BOARD == BOARD_8258_03MMC)
#include "board_8258_03mmc.h"
#include "board_lywsd03mmc.h"
#elif (BOARD == BOARD_8258_05MMC)
#include "board_mjwsd05mmc.h"
#elif (BOARD == BOARD_8258_DONGLE)
#include "board_8258_dongle.h"
#elif (BOARD == BOARD_8258_EVK)
Expand Down
11 changes: 5 additions & 6 deletions src/app_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ void buttonKeepPressed(u8 btNum){
g_sensorAppCtx.state = APP_FACTORY_NEW_DOING;
tl_bdbReset2FN();
zb_resetDevice();
}else if(btNum == VK_SW2){

// }else if(btNum == VK_SW2){
}
}

Expand All @@ -165,10 +164,10 @@ void buttonShortPressed(u8 btNum){

// zcl_iasZone_statusChangeNotificationCmd(SENSOR_DEVICE_ENDPOINT, &dstEpInfo, TRUE, &statusChangeNotification);
}
}else if(btNum == VK_SW2){
if(zb_isDeviceJoinedNwk()){

}
// }else if(btNum == VK_SW2){
// if(zb_isDeviceJoinedNwk()){
//
// }
}
}

Expand Down
File renamed without changes.
55 changes: 55 additions & 0 deletions src/board_mjwsd05mmc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/********************************************************************************************************
* @file board_8258_05mmc.h
*
* @brief This is the header file for board_8258_mjwsd05mmc
*
*******************************************************************************************************/

#pragma once

/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif

// BUTTON
#define BUTTON1 GPIO_PA5 // reset test point
#define PA5_FUNC AS_GPIO
#define PA5_OUTPUT_ENABLE 0
#define PA5_INPUT_ENABLE 1
#define PULL_WAKEUP_SRC_PA5 PM_PIN_PULLUP_10K

#define I2C_CLOCK 100000
#define I2C_GPIO_GROUP I2C_GPIO_GROUP_C2C3

#define PM_WAKEUP_LEVEL PM_WAKEUP_LEVEL_LOW

// UART
#if ZBHCI_UART
#error please configurate uart PIN!!!!!!
#endif

// DEBUG
#if UART_PRINTF_MODE
#define DEBUG_INFO_TX_PIN GPIO_SWS //print
#endif


enum{
VK_SW1 = 0x01,
};

#define KB_MAP_NORMAL {\
{VK_SW1,}, }

#define KB_MAP_NUM KB_MAP_NORMAL
#define KB_MAP_FN KB_MAP_NORMAL

#define KB_DRIVE_PINS {NULL }
#define KB_SCAN_PINS {BUTTON1}


/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
2 changes: 1 addition & 1 deletion src/common/comm_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@
#define IMAGE_TYPE_CONTACT_SENSOR (0x03 | (IMAGE_TYPE_BOOT_FLAG << 7))

// leave image type the same as for contact sensor to allow updating it with sample firmware if needed
#define IMAGE_TYPE_TEMP_HUMIDITY (0x03 | (IMAGE_TYPE_BOOT_FLAG << 7))
#define IMAGE_TYPE_TEMP_HUMIDITY ((DEVICE_TYPE) | (IMAGE_TYPE_BOOT_FLAG << 7))
2 changes: 2 additions & 0 deletions src/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@ drv_pm_pinCfg_t g_sensorPmCfg[] = {
BUTTON1,
PM_WAKEUP_LEVEL
},
#ifdef BUTTON2
{
BUTTON2,
PM_WAKEUP_LEVEL
}
#endif
};
#endif
/**********************************************************************
Expand Down

0 comments on commit c484079

Please sign in to comment.