Skip to content

Commit 3f7c597

Browse files
committed
feat(matter):replacing code in examples and header files
1 parent 7d465f3 commit 3f7c597

File tree

23 files changed

+130
-117
lines changed

23 files changed

+130
-117
lines changed

libraries/Matter/examples/MatterColorLight/MatterColorLight.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
// Color Light Endpoint
2222
MatterColorLight ColorLight;
2323

24+
// WiFi is manually set and started
25+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
26+
const char *password = "your-password"; // Change this to your WiFi password
27+
2428
// it will keep last OnOff & HSV Color state stored, using Preferences
2529
Preferences matterPref;
2630
const char *onOffPrefKey = "OnOff";
@@ -43,10 +47,6 @@ bool button_state = false; // false = released | true = pres
4347
const uint32_t debouceTime = 250; // button debouncing time (ms)
4448
const uint32_t decommissioningTimeout = 5000; // keep the button pressed for 5s, or longer, to decommission
4549

46-
// WiFi is manually set and started
47-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
48-
const char *password = "your-password"; // Change this to your WiFi password
49-
5050
// Set the RGB LED Light based on the current state of the Color Light
5151
bool setLightState(bool state, espHsvColor_t colorHSV) {
5252

libraries/Matter/examples/MatterContactSensor/MatterContactSensor.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
// Matter Contact Sensor Endpoint
3737
MatterContactSensor ContactSensor;
3838

39+
// WiFi is manually set and started
40+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
41+
const char *password = "your-password"; // Change this to your WiFi password
42+
3943
// LED will be used to indicate the Contact Sensor state
4044
// set your board RGB LED pin here
4145
#ifdef RGB_BUILTIN
@@ -48,10 +52,6 @@ const uint8_t ledPin = 2; // Set your pin here if your board has not defined LE
4852
// set your board USER BUTTON pin here - decommissioning and Manual Contact Sensor toggle button
4953
const uint8_t buttonPin = BOOT_PIN; // Set your pin here. Using BOOT Button.
5054

51-
// WiFi is manually set and started
52-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
53-
const char *password = "your-password"; // Change this to your WiFi password
54-
5555
// Button control
5656
uint32_t button_time_stamp = 0; // debouncing control
5757
bool button_state = false; // false = released | true = pressed

libraries/Matter/examples/MatterDimmableLight/MatterDimmableLight.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
// Dimmable Light Endpoint
2222
MatterDimmableLight DimmableLight;
2323

24+
// WiFi is manually set and started
25+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
26+
const char *password = "your-password"; // Change this to your WiFi password
27+
2428
// it will keep last OnOff & Brightness state stored, using Preferences
2529
Preferences matterPref;
2630
const char *onOffPrefKey = "OnOff";
@@ -43,10 +47,6 @@ bool button_state = false; // false = released | true = pres
4347
const uint32_t debouceTime = 250; // button debouncing time (ms)
4448
const uint32_t decommissioningTimeout = 5000; // keep the button pressed for 5s, or longer, to decommission
4549

46-
// WiFi is manually set and started
47-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
48-
const char *password = "your-password"; // Change this to your WiFi password
49-
5050
// Set the RGB LED Light based on the current state of the Dimmable Light
5151
bool setLightState(bool state, uint8_t brightness) {
5252
if (state) {

libraries/Matter/examples/MatterEnhancedColorLight/MatterEnhancedColorLight.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
// Color Light Endpoint
2222
MatterEnhancedColorLight EnhancedColorLight;
2323

24+
// WiFi is manually set and started
25+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
26+
const char *password = "your-password"; // Change this to your WiFi password
27+
2428
// It will use HSV color to control all Matter Attribute Changes
2529
HsvColor_t currentHSVColor = {0, 0, 0};
2630

@@ -46,10 +50,6 @@ bool button_state = false; // false = released | true = pres
4650
const uint32_t debouceTime = 250; // button debouncing time (ms)
4751
const uint32_t decommissioningTimeout = 5000; // keep the button pressed for 5s, or longer, to decommission
4852

49-
// WiFi is manually set and started
50-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
51-
const char *password = "your-password"; // Change this to your WiFi password
52-
5353
// Set the RGB LED Light based on the current state of the Enhanced Color Light
5454
bool setLightState(bool state, espHsvColor_t colorHSV, uint8_t brighteness, uint16_t temperature_Mireds) {
5555

libraries/Matter/examples/MatterFan/MatterFan.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
// Fan Endpoint - On/Off control + Speed Percent Control + Fan Modes
2121
MatterFan Fan;
2222

23+
// WiFi is manually set and started
24+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
25+
const char *password = "your-password"; // Change this to your WiFi password
26+
2327
// set your board USER BUTTON pin here - used for toggling On/Off and decommission the Matter Node
2428
const uint8_t buttonPin = BOOT_PIN; // Set your pin here. Using BOOT Button.
2529

@@ -41,10 +45,6 @@ const uint8_t dcMotorPin = 2; // Set your pin here if your board has not define
4145
#warning "Do not forget to set the RGB LED pin"
4246
#endif
4347

44-
// WiFi is manually set and started
45-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
46-
const char *password = "your-password"; // Change this to your WiFi password
47-
4848
void fanDCMotorDrive(bool fanState, uint8_t speedPercent) {
4949
// drive the Fan DC motor
5050
if (fanState == false) {

libraries/Matter/examples/MatterHumiditySensor/MatterHumiditySensor.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
// Matter Humidity Sensor Endpoint
2828
MatterHumiditySensor SimulatedHumiditySensor;
2929

30-
// set your board USER BUTTON pin here - decommissioning button
31-
const uint8_t buttonPin = BOOT_PIN; // Set your pin here. Using BOOT Button.
32-
3330
// WiFi is manually set and started
3431
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
3532
const char *password = "your-password"; // Change this to your WiFi password
3633

34+
// set your board USER BUTTON pin here - decommissioning button
35+
const uint8_t buttonPin = BOOT_PIN; // Set your pin here. Using BOOT Button.
36+
3737
// Button control - decommision the Matter Node
3838
uint32_t button_time_stamp = 0; // debouncing control
3939
bool button_state = false; // false = released | true = pressed

libraries/Matter/examples/MatterMinimum/MatterMinimum.ino

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
// Single On/Off Light Endpoint - at least one per node
2929
MatterOnOffLight OnOffLight;
3030

31+
// WiFi is manually set and started
32+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
33+
const char *password = "your-password"; // Change this to your WiFi password
34+
3135
// Light GPIO that can be controlled by Matter APP
3236
#ifdef LED_BUILTIN
3337
const uint8_t ledPin = LED_BUILTIN;
@@ -44,16 +48,12 @@ bool button_state = false; // false = released | true = pres
4448
const uint32_t decommissioningTimeout = 5000; // keep the button pressed for 5s, or longer, to decommission
4549

4650
// Matter Protocol Endpoint (On/OFF Light) Callback
47-
bool matterCB(bool state) {
51+
bool onOffLightCallback(bool state) {
4852
digitalWrite(ledPin, state ? HIGH : LOW);
4953
// This callback must return the success state to Matter core
5054
return true;
5155
}
5256

53-
// WiFi is manually set and started
54-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
55-
const char *password = "your-password"; // Change this to your WiFi password
56-
5757
void setup() {
5858
// Initialize the USER BUTTON (Boot button) that will be used to decommission the Matter Node
5959
pinMode(buttonPin, INPUT_PULLUP);
@@ -71,7 +71,7 @@ void setup() {
7171
OnOffLight.begin();
7272

7373
// Associate a callback to the Matter Controller
74-
OnOffLight.onChange(matterCB);
74+
OnOffLight.onChange(onOffLightCallback);
7575

7676
// Matter beginning - Last step, after all EndPoints are initialized
7777
Matter.begin();

libraries/Matter/examples/MatterOccupancySensor/MatterOccupancySensor.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@
3434
// Matter Occupancy Sensor Endpoint
3535
MatterOccupancySensor OccupancySensor;
3636

37-
// set your board USER BUTTON pin here - decommissioning only
38-
const uint8_t buttonPin = BOOT_PIN; // Set your pin here. Using BOOT Button.
39-
4037
// WiFi is manually set and started
4138
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
4239
const char *password = "your-password"; // Change this to your WiFi password
4340

41+
// set your board USER BUTTON pin here - decommissioning only
42+
const uint8_t buttonPin = BOOT_PIN; // Set your pin here. Using BOOT Button.
43+
4444
// Button control
4545
uint32_t button_time_stamp = 0; // debouncing control
4646
bool button_state = false; // false = released | true = pressed

libraries/Matter/examples/MatterOnOffLight/MatterOnOffLight.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
#include <WiFi.h>
1818
#include <Preferences.h>
1919

20+
// WiFi is manually set and started
21+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
22+
const char *password = "your-password"; // Change this to your WiFi password
23+
2024
// List of Matter Endpoints for this Node
2125
// On/Off Light Endpoint
2226
MatterOnOffLight OnOffLight;
@@ -42,10 +46,6 @@ bool button_state = false; // false = released | true = pres
4246
const uint32_t debouceTime = 250; // button debouncing time (ms)
4347
const uint32_t decommissioningTimeout = 5000; // keep the button pressed for 5s, or longer, to decommission
4448

45-
// WiFi is manually set and started
46-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
47-
const char *password = "your-password"; // Change this to your WiFi password
48-
4949
// Matter Protocol Endpoint Callback
5050
bool setLightOnOff(bool state) {
5151
Serial.printf("User Callback :: New Light State = %s\r\n", state ? "ON" : "OFF");

libraries/Matter/examples/MatterOnOffPlugin/MatterOnOffPlugin.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
// On/Off Plugin Endpoint
2222
MatterOnOffPlugin OnOffPlugin;
2323

24+
// WiFi is manually set and started
25+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
26+
const char *password = "your-password"; // Change this to your WiFi password
27+
2428
// it will keep last OnOff state stored, using Preferences
2529
Preferences matterPref;
2630
const char *onOffPrefKey = "OnOff";
@@ -41,10 +45,6 @@ uint32_t button_time_stamp = 0; // debouncing control
4145
bool button_state = false; // false = released | true = pressed
4246
const uint32_t decommissioningTimeout = 5000; // keep the button pressed for 5s, or longer, to decommission
4347

44-
// WiFi is manually set and started
45-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
46-
const char *password = "your-password"; // Change this to your WiFi password
47-
4848
// Matter Protocol Endpoint Callback
4949
bool setPluginOnOff(bool state) {
5050
Serial.printf("User Callback :: New Plugin State = %s\r\n", state ? "ON" : "OFF");

0 commit comments

Comments
 (0)