Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
srickardti authored Aug 22, 2022
2 parents c8ef977 + b85c5ec commit c5bddd4
Show file tree
Hide file tree
Showing 196 changed files with 7,769 additions and 2,614 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/examples-efr32.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ jobs:
- name: Build example EFR32 Lighting App for BRD4161A with RPCs
timeout-minutes: 15
run: |
scripts/examples/gn_efr32_example.sh examples/lighting-app/efr32/ out/lighting_app_debug_rpc BRD4161A \
'import("//with_pw_rpc.gni")'
scripts/examples/gn_efr32_example.sh examples/lighting-app/efr32/ out/lighting_app_debug_rpc BRD4161A "is_debug=false" \
disable_lcd=true 'import("//with_pw_rpc.gni")'
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py efr32 BRD4161A+rpc lighting-app \
out/lighting_app_debug_rpc/BRD4161A/chip-efr32-lighting-example.out /tmp/bloat_reports/
- name: Build example EFR32+WF200 WiFi Lock app for BRD4161A
Expand Down
54 changes: 27 additions & 27 deletions .github/workflows/examples-nrfconnect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,6 @@ jobs:
nrfconnect nrf52840dk_nrf52840 lock-app \
examples/lock-app/nrfconnect/build/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: Build example nRF Connect SDK Lighting App on nRF52840 DK
if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true'
timeout-minutes: 15
run: |
scripts/examples/nrfconnect_example.sh lighting-app nrf52840dk_nrf52840
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
nrfconnect nrf52840dk_nrf52840 lighting-app \
examples/lighting-app/nrfconnect/build/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: Build example nRF Connect SDK Lighting App on nRF52840 Dongle
if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true'
timeout-minutes: 15
Expand All @@ -122,6 +113,15 @@ jobs:
nrfconnect nrf52840dk_nrf52840+rpc lighting-app \
examples/lighting-app/nrfconnect/build/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: Build example nRF Connect SDK Light Switch App on nRF52840 DK
if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true'
timeout-minutes: 15
run: |
scripts/examples/nrfconnect_example.sh light-switch-app nrf52840dk_nrf52840
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
nrfconnect nrf52840dk_nrf52840 light-switch-app \
examples/light-switch-app/nrfconnect/build/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: Build example nRF Connect SDK Shell on nRF52840 DK
if: github.event_name == 'push' || steps.changed_paths.outputs.shell == 'true'
timeout-minutes: 15
Expand All @@ -140,24 +140,6 @@ jobs:
nrfconnect nrf52840dk_nrf52840 pigweed-app \
examples/pigweed-app/nrfconnect/build/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: Build example nRF Connect SDK Lock App on nRF5340 DK
if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true'
timeout-minutes: 15
run: |
scripts/examples/nrfconnect_example.sh lock-app nrf5340dk_nrf5340_cpuapp
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
nrfconnect nrf5340dk_nrf5340_cpuapp lock-app \
examples/lock-app/nrfconnect/build/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: Build example nRF Connect SDK Lighting App on nRF5340 DK
if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true'
timeout-minutes: 15
run: |
scripts/examples/nrfconnect_example.sh lighting-app nrf5340dk_nrf5340_cpuapp
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
nrfconnect nrf5340dk_nrf5340_cpuapp lighting-app \
examples/lighting-app/nrfconnect/build/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: Build example nRF Connect SDK Pump App on nRF52840 DK
if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true'
timeout-minutes: 15
Expand Down Expand Up @@ -192,6 +174,24 @@ jobs:
nrfconnect nrf52840dk_nrf52840 all-clusters-minimal-app \
examples/all-clusters-minimal-app/nrfconnect/build/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: Build example nRF Connect SDK Lock App on nRF5340 DK
if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true'
timeout-minutes: 15
run: |
scripts/examples/nrfconnect_example.sh lock-app nrf5340dk_nrf5340_cpuapp
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
nrfconnect nrf5340dk_nrf5340_cpuapp lock-app \
examples/lock-app/nrfconnect/build/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: Build example nRF Connect SDK Lighting App on nRF5340 DK
if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true'
timeout-minutes: 15
run: |
scripts/examples/nrfconnect_example.sh lighting-app nrf5340dk_nrf5340_cpuapp
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
nrfconnect nrf5340dk_nrf5340_cpuapp lighting-app \
examples/lighting-app/nrfconnect/build/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: Run unit tests for Zephyr native_posix_64 platform
if: github.event_name == 'push' || steps.changed_paths.outputs.tests == 'true'
timeout-minutes: 15
Expand Down
6 changes: 5 additions & 1 deletion examples/chef/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,11 @@ efr32_executable("chef_app") {
}

if (!disable_lcd) {
sources += [ "${examples_plat_dir}/display/lcd.c" ]
sources += [
"${examples_plat_dir}/display/demo-ui.c",
"${examples_plat_dir}/display/lcd.cpp",
]
include_dirs += [ "${examples_plat_dir}/display" ]
defines += [ "DISPLAY_ENABLED" ]
if (show_qr_code) {
defines += [ "QR_CODE_ENABLED" ]
Expand Down
6 changes: 6 additions & 0 deletions examples/chip-tool/commands/common/CHIPCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,12 @@ CHIP_ERROR CHIPCommand::InitializeCommissioner(std::string key, chip::FabricId f
// store the credentials in persistent storage, and
// generate when not available in the storage.
ReturnLogErrorOnFailure(mCommissionerStorage.Init(key.c_str()));
if (mUseMaxSizedCerts.HasValue())
{
auto option = CredentialIssuerCommands::CredentialIssuerOptions::kMaximizeCertificateSizes;
mCredIssuerCmds->SetCredentialIssuerOption(option, mUseMaxSizedCerts.Value());
}

ReturnLogErrorOnFailure(mCredIssuerCmds->InitializeCredentialsIssuer(mCommissionerStorage));

chip::MutableByteSpan nocSpan(noc.Get(), chip::Controller::kMaxCHIPDERCertLength);
Expand Down
4 changes: 4 additions & 0 deletions examples/chip-tool/commands/common/CHIPCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ class CHIPCommand : public Command
"4. The default if not specified is \"alpha\".");
AddArgument("commissioner-nodeid", 0, UINT64_MAX, &mCommissionerNodeId,
"The node id to use for chip-tool. If not provided, kTestControllerNodeId (112233, 0x1B669) will be used.");
AddArgument("use-max-sized-certs", 0, 1, &mUseMaxSizedCerts,
"Maximize the size of operational certificates. If not provided or 0 (\"false\"), normally sized operational "
"certificates are generated.");
#if CHIP_CONFIG_TRANSPORT_TRACE_ENABLED
AddArgument("trace_file", &mTraceFile);
AddArgument("trace_log", 0, 1, &mTraceLog);
Expand Down Expand Up @@ -153,6 +156,7 @@ class CHIPCommand : public Command
chip::Optional<chip::NodeId> mCommissionerNodeId;
chip::Optional<uint16_t> mBleAdapterId;
chip::Optional<char *> mPaaTrustStorePath;
chip::Optional<bool> mUseMaxSizedCerts;

// Cached trust store so commands other than the original startup command
// can spin up commissioners as needed.
Expand Down
19 changes: 19 additions & 0 deletions examples/chip-tool/commands/common/CredentialIssuerCommands.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,23 @@ class CredentialIssuerCommands
virtual CHIP_ERROR GenerateControllerNOCChain(chip::NodeId nodeId, chip::FabricId fabricId, const chip::CATValues & cats,
chip::Crypto::P256Keypair & keypair, chip::MutableByteSpan & rcac,
chip::MutableByteSpan & icac, chip::MutableByteSpan & noc) = 0;

// All options must start false
enum CredentialIssuerOptions : uint8_t
{
kMaximizeCertificateSizes = 0, // If set, certificate chains will be maximized for testing via padding
};

virtual void SetCredentialIssuerOption(CredentialIssuerOptions option, bool isEnabled)
{
// Do nothing
(void) option;
(void) isEnabled;
}

virtual bool GetCredentialIssuerOption(CredentialIssuerOptions option)
{
// All options always start false
return false;
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,33 @@ class ExampleCredentialIssuerCommands : public CredentialIssuerCommands
return mOpCredsIssuer.GenerateNOCChainAfterValidation(nodeId, fabricId, cats, keypair.Pubkey(), rcac, icac, noc);
}

void SetCredentialIssuerOption(CredentialIssuerOptions option, bool isEnabled) override
{
switch (option)
{
case CredentialIssuerOptions::kMaximizeCertificateSizes:
mUsesMaxSizedCerts = isEnabled;
mOpCredsIssuer.SetMaximallyLargeCertsUsed(mUsesMaxSizedCerts);
break;
default:
break;
}
}

bool GetCredentialIssuerOption(CredentialIssuerOptions option) override
{
switch (option)
{
case CredentialIssuerOptions::kMaximizeCertificateSizes:
return mUsesMaxSizedCerts;
default:
return false;
}
}

protected:
bool mUsesMaxSizedCerts = false;

private:
chip::Controller::ExampleOperationalCredentialsIssuer mOpCredsIssuer;
};
11 changes: 9 additions & 2 deletions examples/light-switch-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,15 @@ efr32_executable("light_switch_app") {
}

if (!disable_lcd) {
sources += [ "${examples_plat_dir}/display/lcd.c" ]
defines += [ "DISPLAY_ENABLED" ]
sources += [
"${examples_plat_dir}/display/demo-ui.c",
"${examples_plat_dir}/display/lcd.cpp",
]
include_dirs += [ "${examples_plat_dir}/display" ]
defines += [
"DISPLAY_ENABLED",
"IS_DEMO_SWITCH=1",
]
if (show_qr_code) {
defines += [ "QR_CODE_ENABLED" ]
deps += [ "${chip_root}/examples/common/QRCode" ]
Expand Down
21 changes: 20 additions & 1 deletion examples/light-switch-app/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ namespace {

EmberAfIdentifyEffectIdentifier sIdentifyEffect = EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_STOP_EFFECT;

bool mCurrentButtonState = false;

/**********************************************************
* Identify Callbacks
*********************************************************/
Expand Down Expand Up @@ -146,6 +148,9 @@ AppTask AppTask::sAppTask;
CHIP_ERROR AppTask::Init()
{
CHIP_ERROR err = CHIP_NO_ERROR;
#ifdef DISPLAY_ENABLED
GetLCD().Init((uint8_t *) "Light Switch");
#endif

err = BaseApplication::Init(&gIdentify);
if (err != CHIP_NO_ERROR)
Expand Down Expand Up @@ -221,9 +226,23 @@ void AppTask::SwitchActionEventHandler(AppEvent * aEvent)
if (aEvent->Type == AppEvent::kEventType_Button)
{
BindingCommandData * data = Platform::New<BindingCommandData>();
data->commandId = chip::app::Clusters::OnOff::Commands::Toggle::Id;
data->clusterId = chip::app::Clusters::OnOff::Id;

if (mCurrentButtonState)
{
mCurrentButtonState = false;
data->commandId = chip::app::Clusters::OnOff::Commands::Off::Id;
}
else
{
data->commandId = chip::app::Clusters::OnOff::Commands::On::Id;
mCurrentButtonState = true;
}

#ifdef DISPLAY_ENABLED
sAppTask.GetLCD().WriteDemoUI(mCurrentButtonState);
#endif

DeviceLayer::PlatformMgr().ScheduleWork(SwitchWorkerFunction, reinterpret_cast<intptr_t>(data));
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/light-switch-app/nrfconnect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ target_sources(app PRIVATE
main/BindingHandler.cpp
${GEN_DIR}/light-switch-app/zap-generated/callback-stub.cpp
${GEN_DIR}/light-switch-app/zap-generated/IMClusterCommandHandler.cpp
${NRFCONNECT_COMMON}/util/LEDWidget.cpp
${NRFCONNECT_COMMON}/util/LEDWidget.cpp)


if(CONFIG_CHIP_OTA_REQUESTOR)
Expand Down
12 changes: 10 additions & 2 deletions examples/lighting-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,16 @@ efr32_executable("lighting_app") {
}

if (!disable_lcd) {
sources += [ "${examples_plat_dir}/display/lcd.c" ]
defines += [ "DISPLAY_ENABLED" ]
sources += [
"${examples_plat_dir}/display/demo-ui.c",
"${examples_plat_dir}/display/lcd.cpp",
]

include_dirs += [ "${examples_plat_dir}/display" ]
defines += [
"DISPLAY_ENABLED",
"IS_DEMO_LIGHT=1",
]
if (show_qr_code) {
defines += [ "QR_CODE_ENABLED" ]

Expand Down
27 changes: 11 additions & 16 deletions examples/lighting-app/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@
#include "AppConfig.h"
#include "AppEvent.h"
#include "LEDWidget.h"
#ifdef DISPLAY_ENABLED
#include "lcd.h"
#ifdef QR_CODE_ENABLED
#include "qrcodegen.h"
#endif // QR_CODE_ENABLED
#endif // DISPLAY_ENABLED

#include "sl_simple_led_instances.h"
#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attribute-type.h>
Expand Down Expand Up @@ -132,6 +127,9 @@ AppTask AppTask::sAppTask;
CHIP_ERROR AppTask::Init()
{
CHIP_ERROR err = CHIP_NO_ERROR;
#ifdef DISPLAY_ENABLED
GetLCD().Init((uint8_t *) "Lighting-App");
#endif

err = BaseApplication::Init(&gIdentify);
if (err != CHIP_NO_ERROR)
Expand Down Expand Up @@ -266,16 +264,13 @@ void AppTask::ButtonEventHandler(const sl_button_t * buttonHandle, uint8_t btnAc
void AppTask::ActionInitiated(LightingManager::Action_t aAction, int32_t aActor)
{
// Action initiated, update the light led
if (aAction == LightingManager::ON_ACTION)
{
EFR32_LOG("Turning light ON")
sLightLED.Set(true);
}
else if (aAction == LightingManager::OFF_ACTION)
{
EFR32_LOG("Turning light OFF")
sLightLED.Set(false);
}
bool lightOn = aAction == LightingManager::ON_ACTION;
EFR32_LOG("Turning light %s", (lightOn) ? "On" : "Off")
sLightLED.Set(lightOn);

#ifdef DISPLAY_ENABLED
sAppTask.GetLCD().WriteDemoUI(lightOn);
#endif

if (aActor == AppEvent::kEventType_Button)
{
Expand Down
11 changes: 9 additions & 2 deletions examples/lock-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,15 @@ efr32_executable("lock_app") {
}

if (!disable_lcd) {
sources += [ "${examples_plat_dir}/display/lcd.c" ]
defines += [ "DISPLAY_ENABLED" ]
sources += [
"${examples_plat_dir}/display/demo-ui.c",
"${examples_plat_dir}/display/lcd.cpp",
]
include_dirs += [ "${examples_plat_dir}/display" ]
defines += [
"DISPLAY_ENABLED",
"IS_DEMO_LOCK=1",
]
if (show_qr_code) {
defines += [ "QR_CODE_ENABLED" ]
deps += [ "${chip_root}/examples/common/QRCode" ]
Expand Down
20 changes: 11 additions & 9 deletions examples/lock-app/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ CHIP_ERROR AppTask::Init()
{
CHIP_ERROR err = CHIP_NO_ERROR;

#ifdef DISPLAY_ENABLED
GetLCD().Init((uint8_t *) "Lock-App", true);
#endif

err = BaseApplication::Init(&gIdentify);
if (err != CHIP_NO_ERROR)
{
Expand Down Expand Up @@ -354,16 +358,14 @@ void AppTask::ButtonEventHandler(const sl_button_t * buttonHandle, uint8_t btnAc

void AppTask::ActionInitiated(LockManager::Action_t aAction, int32_t aActor)
{
// Action initiated, update the light led
if (aAction == LockManager::LOCK_ACTION)
if (aAction == LockManager::UNLOCK_ACTION || aAction == LockManager::LOCK_ACTION)
{
EFR32_LOG("Lock Action has been initiated")
sLockLED.Set(false);
}
else if (aAction == LockManager::UNLOCK_ACTION)
{
EFR32_LOG("Unlock Action has been initiated")
sLockLED.Set(true);
bool locked = (aAction == LockManager::LOCK_ACTION);
EFR32_LOG("%s Action has been initiated", (locked) ? "Lock" : "Unlock");
sLockLED.Set(!locked);
#ifdef DISPLAY_ENABLED
sAppTask.GetLCD().WriteDemoUI(locked);
#endif
}

if (aActor == AppEvent::kEventType_Button)
Expand Down
Loading

0 comments on commit c5bddd4

Please sign in to comment.