Skip to content

Commit

Permalink
Pull request project-chip#184: Cherry-Pick Thermostat Updates
Browse files Browse the repository at this point in the history
Merge in WMN_TOOLS/matter from cherry-pick/thermostat_updates to RC_0.4.0

Squashed commit of the following:

commit dc14eae3bde510ceb498bd4d59ee90f318dba306
Author: Ezra Hale <[email protected]>
Date:   Thu Sep 8 14:01:13 2022 +0000

    Pull request #75: updated thermostat README to remove mention of light switch

    Merge in WMN_TOOLS/matter from fix_thermostat_doc to RC_0.3.0

    Squashed commit of the following:

    commit 75541a429db4164b7c09b8c165114cbd67f9372e
    Author: Ezra Hale <[email protected]>
    Date:   Thu Sep 8 08:51:26 2022 -0400

        further minor cleanup on the urls etc...

    commit 7a90c063f2f936dfed3489060c7abb54bf6be2f5
    Author: Ezra Hale <[email protected]>
    Date:   Thu Sep 8 08:43:56 2022 -0400

        projectchip -> project-chip

    commit 1e30b31f1eab975c7dfd6d3b925485e8ac23f570
    Author: Ezra Hale <[email protected]>
    Date:   Thu Sep 8 08:22:09 2022 -0400

        addressed comments, fixed errors caused by brute force replace of CHIP

    commit 4d97ea794d56f97f950d949bf723931edf27d7b8
    Author: Ezra Hale <[email protected]>
    Date:   Wed Sep 7 13:51:18 2022 -0400

        chip -> matter

    commit 6b9d0f57c0489b7f213d7dd8f12b26b023f7032e
    Author: Ezra Hale <[email protected]>
    Date:   Wed Sep 7 13:28:42 2022 -0400

        updated thermostat README to remove mention of light switch

commit 220622601d8c58e0d9d1583edc6b472ebc91f126
Author: Shayna Kaushal <[email protected]>
Date:   Wed Sep 7 15:59:53 2022 +0000

    Pull request #62: Thermostat updates

    Merge in WMN_TOOLS/matter from thermostat_updates to RC_0.3.0

    Squashed commit of the following:

    commit 7d27ef4020e859b35c1f43b142c82af1eaed7a60
    Author: shayna <[email protected]>
    Date:   Tue Sep 6 16:24:44 2022 -0400

        [thermo] get/set attributes done

    commit ae9eee59524145a062dcf950ce07996c02c631aa
    Author: Shayna Kaushal <[email protected]>
    Date:   Tue Sep 6 12:15:09 2022 -0400

        [thermo] jenkins: wifi thermostat build

    commit 7ec590237f1c3de688953f0a408561275ea386c6
    Author: Shayna Kaushal <[email protected]>
    Date:   Tue Sep 6 10:32:08 2022 -0400

        [thermo] jenkins trial

    commit a6b5f390ab08c43611770d553f2b3b03985c4cbd
    Author: Shayna Kaushal <[email protected]>
    Date:   Fri Sep 2 17:26:28 2022 -0400

        no changes - added comments to be removed

    commit 818fb2fd098b5eb12f800c76329380d9cbdb5617
    Author: Shayna Kaushal <[email protected]>
    Date:   Fri Sep 2 11:12:28 2022 -0400

        [thermo] some comments resolved, todo: read attributes

    commit 64a2cf609bdfa0f40dab187aaedb4a24d95f205a
    Author: Shayna Kaushal <[email protected]>
    Date:   Thu Sep 1 15:47:58 2022 -0400

        [thermo] cleaned

    commit bb75e776644941054d06069608d370ee00f8f8f8
    Author: Shayna Kaushal <[email protected]>
    Date:   Thu Sep 1 15:47:06 2022 -0400

        [thermo] cleaned

    commit cec89f46cfa7011d5e8eabd6bdb09152a675a5b2
    Author: Shayna Kaushal <[email protected]>
    Date:   Thu Sep 1 15:40:33 2022 -0400

        [thermo] readme edits

    commit 20f1608706c0cdacefb8fbf72c62b54db0c64e64
    Author: Shayna Kaushal <[email protected]>
    Date:   Thu Sep 1 15:23:06 2022 -0400

        [thermo] added limits

    commit 9d012ab60ec602f809c6f1c2d8b7a8f1cfc465e7
    Author: Shayna Kaushal <[email protected]>
    Date:   Thu Sep 1 12:56:23 2022 -0400

        [thermo] cleaned - todo: add limits, docs

    commit 23150e76b129b9e0181965a987e6a0b62fbda651
    Author: Shayna Kaushal <[email protected]>
    Date:   Thu Sep 1 10:16:27 2022 -0400

        code added, todo: clean+docs
  • Loading branch information
rerasool committed Oct 12, 2022
1 parent 97c37d9 commit e4771af
Show file tree
Hide file tree
Showing 3 changed files with 469 additions and 40 deletions.
80 changes: 52 additions & 28 deletions examples/thermostat/efr32/README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,49 @@
# CHIP EFR32 Light Switch Example
# Matter EFR32 Thermostat Example

An example showing the use of CHIP on the Silicon Labs EFR32 MG12.
An example showing the use of Matter on the Silicon Labs EFR32 MG12 and MG24.

<hr>

- [CHIP EFR32 Light Switch Example](#chip-efr32-light-switch-example)
- [Introduction](#introduction)
- Matter EFR32 Thermostat Example
- [Introduction](#intro)
- [Building](#building)
- [Note](#note)
- [Linux](#linux)
- [Mac OS X](#mac-os-x)
- [Flashing the Application](#flashing-the-application)
- [Viewing Logging Output](#viewing-logging-output)
- [Running the Complete Example](#running-the-complete-example)
- [Notes](#notes)
- [On Border Router:](#on-border-router)
- [On PC(Linux):](#on-pclinux)
- [Running RPC console](#running-rpc-console)
- [Memory settings](#memory-settings)
- [OTA Software Update](#ota-software-update)
- [Building options](#building-options)
- [Disabling logging](#disabling-logging)
- [Debug build / release build](#debug-build--release-build)
- [Disabling LCD](#disabling-lcd)
- [KVS maximum entry count](#kvs-maximum-entry-count)

<hr>

<a name="intro"></a>

## Introduction

The EFR32 light switch example provides a baseline demonstration of a on-off
light switch device, built using CHIP and the Silicon Labs gecko SDK. It can be
controlled by a Chip controller over Openthread network.
The EFR32 thermostat example provides a baseline demonstration of a thermostat
device, built using Matter and the Silicon Labs gecko SDK. It can be controlled
by a Matter controller over OpenThread network.

The EFR32 device can be commissioned over Bluetooth Low Energy where the device
and the Chip controller will exchange security information with the Rendez-vous
procedure. Thread Network credentials are then provided to the EFR32 device
which will then join the network.
and the Matter controller will exchange security information with the
Rendez-vous procedure. Thread Network credentials are then provided to the EFR32
device which will then join the network.

The LCD on the Silabs WSTK shows a QR Code containing the needed commissioning
information for the BLE connection and starting the Rendez-vous procedure.

The light switch example is intended to serve both as a means to explore the
workings of CHIP as well as a template for creating real products based on the
The thermostat example is intended to serve both as a means to explore the
workings of Matter as well as a template for creating real products based on the
Silicon Labs platform.

<a name="building"></a>
Expand All @@ -44,14 +52,15 @@ Silicon Labs platform.

- Download the
[Simplicity Commander](https://www.silabs.com/mcu/programming-options)
command line tool, and ensure that `commander` is your shell search path.
command line tool, and ensure that `commander` is in your shell search path.
(For Mac OS X, `commander` is located inside
`Commander.app/Contents/MacOS/`.)

- Download and install a suitable ARM gcc tool chain:
- Download and install a suitable ARM GCC tool chain:
[GNU Arm Embedded Toolchain 9-2019-q4-major](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads)

- Install some additional tools(likely already present for CHIP developers):
- Install some additional tools (likely already present for Matter
developers):

#### Linux

Expand Down Expand Up @@ -116,7 +125,7 @@ Silicon Labs platform.

./scripts/examples/gn_efr32_example.sh examples/thermostat/efr32/ out/thermostat-app BRD4161A chip_build_libshell=true

* Build the example as Sleepy End Device (SED)
* Build the example as a Sleepy End Device (SED)

$ ./scripts/examples/gn_efr32_example.sh ./examples/thermostat/efr32/ ./out/thermostat-app_SED BRD4161A --sed

Expand Down Expand Up @@ -224,7 +233,7 @@ combination with JLinkRTTClient as follows:
commissioned on the same openthread network

- User interface : **LCD** The LCD on Silabs WSTK shows a QR Code. This QR
Code is be scanned by the CHIP Tool app For the Rendez-vous procedure over
Code is be scanned by the Chip Tool app For the Rendez-vous procedure over
BLE

* On devices that do not have or support the LCD Display like the BRD4166A Thunderboard Sense 2,
Expand Down Expand Up @@ -253,16 +262,30 @@ combination with JLinkRTTClient as follows:

**Push Button 0**

- _Press and Release_ : Start, or restart, BLE advertisement in fast mode. It will advertise in this mode
for 30 seconds. The device will then switch to a slower interval advertisement.
After 15 minutes, the advertisement stops.
- _Press and Release_ :

- _Pressed and hold for 6 s_ : Initiates the factory reset of the device.
Releasing the button within the 6-second window cancels the factory reset
procedure. **LEDs** blink in unison when the factory reset procedure is
initiated.
- Decreases temperature by 0.01C depending on current mode.

* You can provision and control the Chip device using the python controller,
- Start, or restart, BLE advertisement in fast mode. It will advertise
in this mode for 30 seconds. The device will then switch to a
slower interval advertisement.
After 15 minutes, the advertisement stops.

- _Pressed and hold for 6.5 s_ : Initiates the factory reset of the device.
Releasing button within the 0.5-second window cancels initiation of factory
reset.
Releasing the button within the 6-second window post that cancels the
factory reset procedure. **LEDs** blink in unison when the factory reset
procedure is initiated.

**Push Button 1**

- _Press and Release_ : Increases temperature by 0.01C depending on current
mode.

- _Pressed and hold for 1 s_ : Toggles the mode of the thermostat.

* You can provision and control the Matter device using the python controller,
[CHIPTool](https://github.com/project-chip/connectedhomeip/blob/master/examples/chip-tool/README.md)
standalone, Android or iOS app

Expand Down Expand Up @@ -303,7 +326,8 @@ via 2002::2
- To use the chip-rpc console after it has been installed run:
`chip-console --device /dev/tty.<SERIALDEVICE> -b 115200 -o /<YourFolder>/pw_log.out`
chip-console --device /dev/tty.<SERIALDEVICE> -b 115200 -o
/<YourFolder>/pw_log.out`
- Then you can simulate a button press or release using the following command
where : idx = 0 or 1 for Button PB0 or PB1 action = 0 for PRESSED, 1 for
Expand All @@ -313,7 +337,7 @@ via 2002::2
## Memory settings
While most of the RAM usage in CHIP is static, allowing easier debugging and
While most of the RAM usage in Matter is static, allowing easier debugging and
optimization with symbols analysis, we still need some HEAP for the crypto and
OpenThread. Size of the HEAP can be modified by changing the value of the
`configTOTAL_HEAP_SIZE` define inside of the FreeRTOSConfig.h file of this
Expand Down
72 changes: 68 additions & 4 deletions examples/thermostat/efr32/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ class AppTask : public BaseApplication
*/
static void OnIdentifyStop(Identify * identify);

enum ThermoFunction_t
{
kFunction_Nothing = 0,
kFunction_AppFn = 1,
kFunction_Temp = 2,

kFunction_Invalid
} ThermoFunction;

private:
static AppTask sAppTask;

Expand All @@ -113,10 +122,65 @@ class AppTask : public BaseApplication
static void ButtonHandler(AppEvent * aEvent);

/**
* @brief PB1 Button event processing function
* Function triggers a thermostat action sent to the CHIP task
* @brief Function called to start the mode timer
*
* @param aEvent button event being processed
* @param aTimeoutMs timer duration in ms
*/
static void StartModeTimer(uint32_t aTimeoutInMs);

/**
* @brief Function to stop the mode timer
*/
static void CancelModeTimer();

/**
* @brief Function called to start the app function timer
*
* @param aTimeoutMs timer duration in ms
*/
static void StartAppFnTimer(uint32_t aTimeoutInMs);

/**
* @brief Function to stop app function timer
*/
static void CancelAppFnTimer();

/**
* @brief Mode Timer finished callback function
* Post an ModeHandler event
*
* @param xTimer timer that finished
*/
static void ModeTimerEventHandler(TimerHandle_t xTimer);

/**
* @brief App Function Timer finished callback function
* Post an AppFnHandler event
*
* @param xTimer timer that finished
*/
static void AppFnTimerEventHandler(TimerHandle_t xTimer);

/**
* @brief Mode Timer Event processing function
* Handles toggling the mode
*
* @param aEvent post event being processed
*/
static void ModeHandler(AppEvent * aEvent);

/**
* @brief App Function Timer Event processing function
* Calls factory reset handler from BaseApplication.cpp
*
* @param aEvent post event being processed
*/
static void AppFnHandler(AppEvent * aEvent);

/**
* @brief Handles temperature changes depending on timer status
*
* @param aEvent post event being processed
*/
static void ThermostatActionEventHandler(AppEvent * aEvent);
static void TemperatureHandler(AppEvent * aEvent);
};
Loading

0 comments on commit e4771af

Please sign in to comment.