forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pull request project-chip#246: Update the thermostat app
Merge in WMN_TOOLS/matter from thermostat_rc1 to RC_1.0.0 Squashed commit of the following: commit 3e066e49a2361905ffdafcd460793f5546d4b032 Author: Junior Martinez <[email protected]> Date: Mon Oct 31 10:05:35 2022 -0400 Fix #else not else{} commit f81ecce0a95d5eab42eacca1c8df03ca0d19185c Author: Junior Martinez <[email protected]> Date: Mon Oct 31 09:58:27 2022 -0400 Fix thermostat for boards without lcd and/or temp sensor support commit 6c3127f0b3b5f470d3fe5a3b812c5bfec647eb21 Author: Rehan Rasool <[email protected]> Date: Sun Oct 30 23:04:32 2022 -0400 Add thermostat example to openthread builds ... and 1 more commit
- Loading branch information
1 parent
266b8dd
commit f53612f
Showing
26 changed files
with
1,479 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* | ||
* Copyright (c) 2020 Project CHIP Authors | ||
* Copyright (c) 2019 Google LLC. | ||
* All rights reserved. | ||
* | ||
* 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. | ||
*/ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include "TemperatureSensor.h" | ||
#include "sl_sensor_rht.h" | ||
|
||
|
||
#define SENSOR_TEMP_OFFSET 800 | ||
|
||
sl_status_t TemperatureSensor::Init(void) | ||
{ | ||
return sl_sensor_rht_init(); | ||
} | ||
|
||
sl_status_t TemperatureSensor::GetTemp(uint32_t * rh, int16_t * t) | ||
{ | ||
// Sensor resolution 0.001 C | ||
// DataModel resolution 0.01 C | ||
int32_t temp; | ||
sl_status_t status = sl_sensor_rht_get(rh, &temp); | ||
*t = static_cast<int16_t>(temp / 10) - SENSOR_TEMP_OFFSET; | ||
return status; | ||
} | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* | ||
* Copyright (c) 2020 Project CHIP Authors | ||
* Copyright (c) 2019 Google LLC. | ||
* All rights reserved. | ||
* | ||
* 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 | ||
|
||
#include "sl_status.h" | ||
#include <stdint.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
class TemperatureSensor | ||
{ | ||
public: | ||
static sl_status_t Init(void); | ||
static sl_status_t GetTemp(uint32_t * rh, int16_t * t); | ||
}; | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* | ||
* Copyright (c) 2019 Google LLC. | ||
* All rights reserved. | ||
* | ||
* 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 | ||
|
||
#include <stdbool.h> | ||
#include <stdint.h> | ||
|
||
#include "AppEvent.h" | ||
|
||
#include "FreeRTOS.h" | ||
#include "timers.h" // provides FreeRTOS timer support | ||
#include <app-common/zap-generated/attributes/Accessors.h> | ||
#include <lib/core/CHIPError.h> | ||
|
||
#define SIMULATED_TEMP 2300, 2400, 2800, 2550, 2200, 2125, 2100, 2600, 1800, 2700 | ||
|
||
|
||
class SensorManager | ||
{ | ||
public: | ||
CHIP_ERROR Init(); | ||
|
||
private: | ||
friend SensorManager & SensorMgr(void); | ||
|
||
|
||
// Reads new generated sensor value, stores it, and updates local temperature attribute | ||
static void SensorTimerEventHandler(TimerHandle_t xTimer); | ||
|
||
static SensorManager sSensorManager; | ||
|
||
}; | ||
|
||
inline SensorManager & SensorMgr(void) | ||
{ | ||
return SensorManager::sSensorManager; | ||
} |
Oops, something went wrong.