-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into camera-chime
- Loading branch information
Showing
40 changed files
with
854 additions
and
525 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
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 |
---|---|---|
|
@@ -24,4 +24,5 @@ typedef void (*EventHandler)(const AppEvent &); | |
struct AppEvent | ||
{ | ||
EventHandler Handler; | ||
void * extra; | ||
}; |
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 |
---|---|---|
|
@@ -24,4 +24,5 @@ typedef void (*EventHandler)(const AppEvent &); | |
struct AppEvent | ||
{ | ||
EventHandler Handler; | ||
void * extra; | ||
}; |
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 |
---|---|---|
|
@@ -48,4 +48,5 @@ struct AppEvent | |
}; | ||
|
||
EventHandler Handler; | ||
void * extra; | ||
}; |
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
52 changes: 52 additions & 0 deletions
52
examples/platform/nxp/common/matter_button/include/Button.h
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,52 @@ | ||
/* | ||
* | ||
* Copyright (c) 2024 Project CHIP Authors | ||
* 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 "fsl_component_button.h" | ||
|
||
#include <lib/core/CHIPError.h> | ||
|
||
namespace chip::NXP::App { | ||
|
||
/** | ||
* @brief This class is an abstraction over an SDK button. | ||
* | ||
*/ | ||
class Button | ||
{ | ||
public: | ||
using Callback = button_status_t (*)(void * handle, button_callback_message_t * message, void * param); | ||
|
||
virtual ~Button() = default; | ||
|
||
virtual CHIP_ERROR Init() = 0; | ||
virtual void HandleShortPress() = 0; | ||
virtual void HandleLongPress() = 0; | ||
virtual void HandleDoubleClick() = 0; | ||
|
||
/** | ||
* @brief This is an SDK handle for a button. | ||
* | ||
* It should be set in the Init method, based on a newly defined | ||
* handle or an already defined handle owned by the SDK. | ||
*/ | ||
button_handle_t handle = nullptr; | ||
}; | ||
|
||
} // namespace chip::NXP::App |
44 changes: 44 additions & 0 deletions
44
examples/platform/nxp/common/matter_button/include/ButtonApp.h
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,44 @@ | ||
/* | ||
* | ||
* Copyright (c) 2024 Project CHIP Authors | ||
* 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 "Button.h" | ||
|
||
namespace chip::NXP::App { | ||
/** | ||
* @brief This class implements a custom app button behavior. | ||
* | ||
* | Action | Effect | | ||
* | ------------ | --------------------------------- | | ||
* | Short press | Switch a cluster attribute state | | ||
* | Long press | Schedule a soft reset taking into | | ||
* | | account Matter shutdown mechanism | | ||
* | Double click | Do nothing | | ||
* | ||
*/ | ||
class ButtonApp : public Button | ||
{ | ||
public: | ||
virtual CHIP_ERROR Init() override; | ||
virtual void HandleShortPress() override; | ||
virtual void HandleLongPress() override; | ||
virtual void HandleDoubleClick() override; | ||
}; | ||
|
||
} // namespace chip::NXP::App |
48 changes: 48 additions & 0 deletions
48
examples/platform/nxp/common/matter_button/include/ButtonBle.h
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,48 @@ | ||
/* | ||
* | ||
* Copyright (c) 2024 Project CHIP Authors | ||
* 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 "ButtonWithTimer.h" | ||
|
||
namespace chip::NXP::App { | ||
|
||
/** | ||
* @brief This class implements a customized default button behavior. | ||
* | ||
* | Action | Effect | | ||
* | ------------ | -------------------------------------------------- | | ||
* | Short press | If a factory reset is scheduled, cancel it. | | ||
* | | Else if the device is commissioned and a factory | | ||
* | | reset is not scheduled, switch to ICD active mode. | | ||
* | | Otherwise, switch commissioning state. | | ||
* | Long press | Schedule a factory reset | | ||
* | Double click | Toggle SIT mode request through DSLS mechanism | | ||
* | ||
*/ | ||
class ButtonBle : public ButtonWithTimer | ||
{ | ||
public: | ||
virtual CHIP_ERROR Init() override; | ||
virtual void HandleShortPress() override; | ||
virtual void HandleLongPress() override; | ||
virtual void HandleDoubleClick() override; | ||
virtual void HandleTimerExpire() override; | ||
}; | ||
|
||
} // namespace chip::NXP::App |
Oops, something went wrong.