This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2652R7: I got the board to connect to my nest. I there a way to make it so that it will notify me?

Part Number: CC2652R7
Other Parts Discussed in Thread: SYSCONFIG, CC2674R10, , LAUNCHCC3235MOD

I am trying to create a device that takes an input and then notifies the user. For example with the lock app enable it to notify my phone when the lock is opened and closed.

  • Hi Corey,

    Can you confirm whether the Google Home app receives updates on the lock-app's status when changed locally (through the LaunchPad push buttons)?  From my past experience, both lighting-app, lock-app, and pump-app will report updates to their state (as-needed) with their subscribers (Google or Apple ecosystems have been tested), as these Matter controllers establish subscriptions by default.  Since the Matter device does not maintain a Bluetooth connection with the mobile phone (BLE is only used for provisioning/commissioning), it is the responsibility of the Matter controller (Google Nest/Apple TV) and phone application (Google Home/Apple Home) to notify users accordingly.

    Regards,
    Ryan

  • I can change the state of the cc device, but it doesn't notify me when the device locks. My end game is a device that detects when a pin goes high. When that pin goes high it sends a notification to the user. With that, I also need to make it so that a user can set it up to turn on a light or make a next make a sound. I got the lock app running. I have it set up so that when it is locked either by phone, cc or the nest it turns on a light and plays a song. But, it fails to notify me. I am also trying to find out where the pins are located. I programmed them before on CCS but the files aren't in the same place.

  • You can speak with Google about Matter controller subscription settings.  Notifications are not managed by the SimpleLink Matter device.  Pins are configured inside lock-app\cc13x2x7_26x2x7\chip.syscfg and controlled within lock-app\cc13x2x7_26x2x7\src\AppTask.cpp

    Regards,
    Ryan

  • That's is where I am currently at. But, I have to have a google sub to be able to have my device notify a user? Would that be only a google side of things or would I have to also program it in?

  • Also, thank you very much for the help. I greatly appreciate it.

  • If Google is sending a subscription to the Matter device, then the SimpleLink example should support it automatically and act accordingly.

    Regards,
    Ryan

  • I Can't get CCS to open syscfg for some odd reason. It did on windows no problem but not on linux.

  • For Linux and modifying Matter SysConfig files, I found the best solution is to use the standalone tool and open the chip.syscfg after editing with a minor addition (also described in a Migration Guide): 

    // @cliArgs --product <your_SDK_path_here>/.metadata/product.json --board /ti/boards/LAUNCHXL_CC2652R7 --rtos freertos

    Regards,
    Ryan

  • The Migration guide did not link me to anything and I can't get the standalone tool to launch either.

  • The link should be valid.  Have you signed into GitHub?  How are you trying to launch the SysConfig standalone tool and what errors are you encountering, if any?  There are similar instructions available in the SysConfig File section of the Configure Matter Device Application SLA.

    Regards,
    Ryan 

  • I still haven't been able to open up the file. But now I have a new problem. I have tried to add an input pin to it, but when I go to compile it says "region 'FLASH' overflowed by 0 bytes.

  • How exactly do you try to add the input pin, and what is the exact error shown on the compiler?  Also, although I don't understand your Linux SysConfig issues you could try to work around this by modifying the SysConfig file inside of your Windows environment before sending to your Linux system.

    Regards,
    Ryan

  • FAILED: chip-LP_CC2652R7-lock-example.out chip-LP_CC2652R7-lock-example.out.map
    arm-none-eabi-g++ -L../../third_party/connectedhomeip/third_party/ti_simplelink_sdk/repo_cc13xx_cc26xx/source gen/sysconfig/ti_utils_build_linker.cmd.genlibs -T../../third_party/connectedhomeip/src/platform/cc13xx_26xx/cc13x2_26x2/cc13x2x7_cc26x2x7_freertos_ota.lds -march=armv7e-m -mcpu=cortex-m4 -mabi=aapcs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb -Os --specs=nosys.specs --specs=nano.specs -Werror -Wl,--fatal-warnings -fdiagnostics-color -Wl,--gc-sections -nostartfiles -fno-exceptions -fno-unwind-tables -Wl,-Map,./chip-LP_CC2652R7-lock-example.out.map -Wl,--cref @./chip-LP_CC2652R7-lock-example.out.rsp -o ./chip-LP_CC2652R7-lock-example.out
    /home/corey/connectedhomeip/.environment/cipd/packages/arm/bin/../lib/gcc/arm-none-eabi/12.2.1/../../../../arm-none-eabi/bin/ld: ./chip-LP_CC2652R7-lock-example.out section `.rodata' will not fit in region `FLASH'
    /home/corey/connectedhomeip/.environment/cipd/packages/arm/bin/../lib/gcc/arm-none-eabi/12.2.1/../../../../arm-none-eabi/bin/ld: section .nvs VMA [000aa000,000adfff] overlaps section .rodata VMA [00094190,000b0bb6]
    /home/corey/connectedhomeip/.environment/cipd/packages/arm/bin/../lib/gcc/arm-none-eabi/12.2.1/../../../../arm-none-eabi/bin/ld: region `FLASH' overflowed by 0 bytes
    collect2: error: ld returned 1 exit status

  • I tried to create a new sysconfig file but it wouldnt work. As soon as i tried to put it in CCS it wouldnt open. So, I went into ti drivers and changed one of the pins not being used. But, it has resulted in this.

  • ti_drivers_config.c are generated by SysConfig and should not be manually edited.  There is typically a warning in the comments of these files which mention as much.

    /*
     *  ======== ti_drivers_config.c ========
     *  Configured TI-Drivers module definitions
     *
     *  DO NOT EDIT - This file is generated for the LP_EM_CC2340R5
     *  by the SysConfig tool.
     */

    This could also be causing the FLASH error you observed.  Thus I recommend that you directly modify the chip.syscfg file for the pin changes you desire.  You can follow the SLA I previously referenced as well as the examples of SysConfig files that you are able to open inside of CCS or the standalone tool using Windows.  Here is pseudo-code of what changes might look like:

    const GPIO        = scripting.addModule("/ti/drivers/GPIO", {}, false);
    const GPIO11      = GPIO.addInstance();
    
    GPIO11.$name = "CONFIG_GPIO_1";
    
    GPIO11.gpioPin.$suggestSolution              = "boosterpack.29";

    Of course this should be verified with the SysConfig tool using the desired GPIO designation.

    Regards,
    Ryan

  • The problem is, anytime I try to open up either chip.syscfg or chip_ota.syscfg sysconfig cant open the files. I can't even open the sysconfig program at all on ubuntu. That is why i tried to edit it through the code.

  • What exact errors do you observe when trying to open the files?  Please provide screenshots.

    Regards,
    Ryan

  • That is what happens when I try to open it in CCS. I can't get the sysconfig program to open at all on ubuntu.

  • You will not be able to open the SysConfig file in CCS.  You should make sure that sysconfig_gui.sh is executable after downloading and installing 

    cd ~
    wget https://dr-download.ti.com/software-development/ide-configuration-compiler-or-debugger/MD-nsUM6f7Vvb/1.15.0.2826/sysconfig-1.15.0_2826-setup.run
    chmod +x sysconfig-1.15.0_2826-setup.run
    ./sysconfig-1.15.0_2826-setup.run 
    
    cd ~/ti/sysconfig_1.15.0
    chmod +x sysconfig_gui.sh
    ./sysconfig_gui.sh

    Regards,
    Ryan

  • I tried the chmod thing before and it didn't work. But, the page also didn't have the 3rd line. But, this is the same response I get on windows.

  • I explained the necessary .syscfg code line which should be added earlier in this E2E thread, in order to open with they SysConfig standalone tool:

    // @cliArgs --product <your_SDK_path_here>/.metadata/product.json --board /ti/boards/LAUNCHXL_CC2652R7 --rtos freertos

  • I tried that and it didn't do anything. It just says command not found. I am sorry about all this. The other Launchpad didn't have any of these problems.

  • I would need another screenshot of the new issue.  I also don't know what you mean about "The other LaunchPad" since these steps should not need a physical hardware connection.

  • I also have a cc3235 launchpad as well. But, work wants this one.

  • That was not meant to be a command line argument

    Regards,
    Ryan

  • I got all that working. Sorry I missed that line. I am still trying to fix a flash error. So, I am currently looking through what I added into the code. Thank you again.

  • I am sorry for constantly bothering you, I am new to this device and this language. So, I am learning as I go. You have been a huge help. So, again, thank you very much. My next problem is it says i am out of flash. I don't know if because the app is taking up too much space or if it's the code that I added. My end game is to take an input from a device, trigger an event or notification and then have a pin that functions as an out to be able to control a relay. But, my first step is trying to have an input. I tried to copy what they have written for the buttons minus the long click. But its not working. I says i am out of flash by 0 bytes. But, i just don't know if its my added code or if I actually ran out of space. Again, I am sorry for repeatedly asking you questions. But, it is greatly appreciated.

  • Although the error itself is a bit nonsensical, I think the following line (from your previous log) is more important:

    .nvs VMA [000aa000,000adfff] overlaps section .rodata VMA [00094190,000b0bb6]

    This would imply that the read-only data extends to 0xb0bb6, and since the NVS starts at 0xaa000 this creates an overlap of 0x6BB6 which is quite significant.  Can you confirm that the default project builds without errors?  What are the exact changes to the SysConfig and application files you've tried to implement so far?  Please try to make incremental changes to find what introduces the error.  Also note that if you plan to add a fair amount of functionality to the application then you should consider using the CC2674R10, as this device has more flash memory and the Matter project is already quite constrained on the CC2652R7 device.

    Regards,
    Ryan

  • The lock app default build builds fine. Its only when i have tried to add an input pin to it. I can send the files that I have modified/messed up.

    /*
     *
     *    Copyright (c) 2020 Project CHIP Authors
     *    Copyright (c) 2020 Texas Instruments Incorporated
     *    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.
     */
    
    #include "AppTask.h"
    #include "AppConfig.h"
    #include "AppEvent.h"
    #include <app/server/Server.h>
    
    #include "FreeRTOS.h"
    
    #include <credentials/DeviceAttestationCredsProvider.h>
    #include <credentials/examples/DeviceAttestationCredsExample.h>
    
    #include <DeviceInfoProviderImpl.h>
    #include <platform/CHIPDeviceLayer.h>
    
    #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
    #include <app/clusters/ota-requestor/BDXDownloader.h>
    #include <app/clusters/ota-requestor/DefaultOTARequestor.h>
    #include <app/clusters/ota-requestor/DefaultOTARequestorDriver.h>
    #include <app/clusters/ota-requestor/DefaultOTARequestorStorage.h>
    #include <platform/cc13x2_26x2/OTAImageProcessorImpl.h>
    #endif
    
    #include <lib/support/CHIPMem.h>
    #include <lib/support/CHIPPlatformMemory.h>
    
    #include <app/server/OnboardingCodesUtil.h>
    
    #include <ti/drivers/apps/Button.h>
    #include <ti/drivers/apps/LED.h>
    #include <ti/drivers/GPIO.h>
    
    /* syscfg */
    #include <ti_drivers_config.h>
    
    #define APP_TASK_STACK_SIZE (4096)
    #define APP_TASK_PRIORITY 4
    #define APP_EVENT_QUEUE_SIZE 10
    
    using namespace ::chip;
    using namespace ::chip::Credentials;
    using namespace ::chip::DeviceLayer;
    
    static TaskHandle_t sAppTaskHandle;
    static QueueHandle_t sAppEventQueue;
    
    static LED_Handle sAppRedHandle;
    static LED_Handle sAppGreenHandle;
    static Button_Handle sAppLeftHandle;
    static Button_Handle sAppRightHandle;
    static Pin23_Handle sAppPin23Handle;
    static DeviceInfoProviderImpl sExampleDeviceInfoProvider;
    
    AppTask AppTask::sAppTask;
    
    #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
    static DefaultOTARequestor sRequestorCore;
    static DefaultOTARequestorStorage sRequestorStorage;
    static DefaultOTARequestorDriver sRequestorUser;
    static BDXDownloader sDownloader;
    static OTAImageProcessorImpl sImageProcessor;
    
    void InitializeOTARequestor(void)
    {
        // Initialize and interconnect the Requestor and Image Processor objects
        SetRequestorInstance(&sRequestorCore);
    
        sRequestorStorage.Init(Server::GetInstance().GetPersistentStorage());
        sRequestorCore.Init(Server::GetInstance(), sRequestorStorage, sRequestorUser, sDownloader);
        sImageProcessor.SetOTADownloader(&sDownloader);
        sDownloader.SetImageProcessorDelegate(&sImageProcessor);
        sRequestorUser.Init(&sRequestorCore, &sImageProcessor);
    }
    #endif
    
    int AppTask::StartAppTask()
    {
        int ret = 0;
    
        sAppEventQueue = xQueueCreate(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent));
        if (sAppEventQueue == NULL)
        {
            PLAT_LOG("Failed to allocate app event queue");
            while (true)
                ;
        }
    
        // Start App task.
        if (xTaskCreate(AppTaskMain, "APP", APP_TASK_STACK_SIZE / sizeof(StackType_t), NULL, APP_TASK_PRIORITY, &sAppTaskHandle) !=
            pdPASS)
        {
            PLAT_LOG("Failed to create app task");
            while (true)
                ;
        }
        return ret;
    }
    
    int AppTask::Init()
    {
        LED_Params ledParams;
        Button_Params buttonParams;
        Pin_Params pinParams;
    
        cc13x2_26x2LogInit();
    
        // Init Chip memory management before the stack
        Platform::MemoryInit();
    
        CHIP_ERROR ret = PlatformMgr().InitChipStack();
        if (ret != CHIP_NO_ERROR)
        {
            PLAT_LOG("PlatformMgr().InitChipStack() failed");
            while (true)
                ;
        }
    
        ret = ThreadStackMgr().InitThreadStack();
        if (ret != CHIP_NO_ERROR)
        {
            PLAT_LOG("ThreadStackMgr().InitThreadStack() failed");
            while (true)
                ;
        }
    #if CHIP_DEVICE_CONFIG_THREAD_FTD
        ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router);
    #else
        ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice);
    #endif
        if (ret != CHIP_NO_ERROR)
        {
            PLAT_LOG("ConnectivityMgr().SetThreadDeviceType() failed");
            while (true)
                ;
        }
    
        ret = PlatformMgr().StartEventLoopTask();
        if (ret != CHIP_NO_ERROR)
        {
            PLAT_LOG("PlatformMgr().StartEventLoopTask() failed");
            while (true)
                ;
        }
    
        ret = ThreadStackMgrImpl().StartThreadTask();
        if (ret != CHIP_NO_ERROR)
        {
            PLAT_LOG("ThreadStackMgr().StartThreadTask() failed");
            while (true)
                ;
        }
    
        // Init ZCL Data Model and start server
        PLAT_LOG("Initialize Server");
        static chip::CommonCaseDeviceServerInitParams initParams;
        (void) initParams.InitializeStaticResourcesBeforeServerInit();
    
        // Initialize info provider
        sExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate);
        SetDeviceInfoProvider(&sExampleDeviceInfoProvider);
    
        chip::Server::GetInstance().Init(initParams);
    
        // Initialize device attestation config
        SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
    
        // Initialize LEDs
        PLAT_LOG("Initialize LEDs");
        LED_init();
    
        LED_Params_init(&ledParams); // default PWM LED
        sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams);
        LED_setOff(sAppRedHandle);
    
        LED_Params_init(&ledParams); // default PWM LED
        sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams);
        LED_setOff(sAppGreenHandle);
    
    /* Call driver init functions */
        GPIO_init();
        extern void GPIO_enableInt(uint_least8_t index);
        extern void GPIO_callbacks(uint_least8_t index);
        extern void GPIO_CallbackFxn(uint_least8_t index);
        
        GPIO_setConfig(CONFIG_GPIO_23, GPIO_CFG_IN_INT_RISING | GPIO_CFG_PULL_DOWN_INTERNAL);
        
        Pin_Params_init(&pinParams);
        pinParams.pinEventMask    = Pin_23_ACTIVE;
        sAppPin23Handle	      = Pin_23_open(CONFIG_GPIO_23, &pinParams);
        GPIO_setCallback(sAppPin23Handle, Pin15EventHandler);
        
    
        // Initialize buttons
        PLAT_LOG("Initialize buttons");
        Button_init();
    
        Button_Params_init(&buttonParams);
        buttonParams.buttonEventMask   = Button_EV_CLICKED | Button_EV_LONGCLICKED;
        buttonParams.longPressDuration = 1000U; // ms
        sAppLeftHandle                 = Button_open(CONFIG_BTN_LEFT, &buttonParams);
        Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler);
    
        Button_Params_init(&buttonParams);
        buttonParams.buttonEventMask   = Button_EV_CLICKED | Button_EV_LONGCLICKED;
        buttonParams.longPressDuration = 1000U; // ms
        sAppRightHandle                = Button_open(CONFIG_BTN_RIGHT, &buttonParams);
        Button_setCallback(sAppRightHandle, ButtonRightEventHandler);
    
        // Initialize BoltLock module
        PLAT_LOG("Initialize BoltLock");
        BoltLockMgr().Init();
    
        BoltLockMgr().SetCallbacks(ActionInitiated, ActionCompleted);
    
        ConfigurationMgr().LogDeviceConfig();
    
    #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
        InitializeOTARequestor();
    #endif
        // QR code will be used with CHIP Tool
        PrintOnboardingCodes(RendezvousInformationFlags(RendezvousInformationFlag::kBLE));
    
        return 0;
    }
    
    void AppTask::AppTaskMain(void * pvParameter)
    {
        AppEvent event;
    
        sAppTask.Init();
    
        while (true)
        {
            /* Task pend until we have stuff to do */
            if (xQueueReceive(sAppEventQueue, &event, portMAX_DELAY) == pdTRUE)
            {
                sAppTask.DispatchEvent(&event);
            }
        }
    }
    
    void AppTask::PostEvent(const AppEvent * aEvent)
    {
        if (xQueueSend(sAppEventQueue, aEvent, 0) != pdPASS)
        {
            /* Failed to post the message */
        }
    }
    
    void AppTask::Pin23EventHandler(Pin23_Handle handle, Pin_EventMask events)
    {
    	AppEvent event;
    	event.Type = AppEvent::kEventType_Pin23;
    	
    	if (events & Pin_23_ACTIVE)
    	{
    		event.PinEvent.Type = AppEvent::kAppEventPinType_Active;
    	}
    }
    
    void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events)
    {
        AppEvent event;
        event.Type = AppEvent::kEventType_ButtonLeft;
    
        if (events & Button_EV_CLICKED)
        {
            event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked;
        }
        else if (events & Button_EV_LONGCLICKED)
        {
            event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked;
        }
        // button callbacks are in ISR context
        if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS)
        {
            /* Failed to post the message */
        }
    }
    
    void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask events)
    {
        AppEvent event;
        event.Type = AppEvent::kEventType_ButtonRight;
    
        if (events & Button_EV_CLICKED)
        {
            event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked;
        }
        else if (events & Button_EV_LONGCLICKED)
        {
            event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked;
        }
        // button callbacks are in ISR context
        if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS)
        {
            /* Failed to post the message */
        }
    }
    
    void AppTask::ActionInitiated(BoltLockManager::Action_t aAction, int32_t aActor)
    {
        // If the action has been initiated by the lock, update the bolt lock trait
        // and start flashing the LEDs rapidly to indicate action initiation.
        if (aAction == BoltLockManager::LOCK_ACTION)
        {
            PLAT_LOG("Lock initiated");
            ; // TODO
        }
        else if (aAction == BoltLockManager::UNLOCK_ACTION)
        {
            PLAT_LOG("Unlock initiated");
            ; // TODO
        }
    
        LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX);
        LED_startBlinking(sAppGreenHandle, 50 /* ms */, LED_BLINK_FOREVER);
        LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX);
        LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER);
    }
    
    void AppTask::ActionCompleted(BoltLockManager::Action_t aAction)
    {
        // if the action has been completed by the lock, update the bolt lock trait.
        // Turn on the lock LED if in a LOCKED state OR
        // Turn off the lock LED if in an UNLOCKED state.
        if (aAction == BoltLockManager::LOCK_ACTION)
        {
            PLAT_LOG("Lock completed");
            LED_stopBlinking(sAppGreenHandle);
            LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX);
            LED_stopBlinking(sAppRedHandle);
            LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX);
        }
        else if (aAction == BoltLockManager::UNLOCK_ACTION)
        {
            PLAT_LOG("Unlock completed");
            LED_stopBlinking(sAppGreenHandle);
            LED_setOff(sAppGreenHandle);
            LED_stopBlinking(sAppRedHandle);
            LED_setOff(sAppRedHandle);
        }
    }
    
    void AppTask::DispatchEvent(AppEvent * aEvent)
    {
        switch (aEvent->Type)
        {
        case AppEvent::kEventType_Pin23:
        	if (AppEvent::kAppEventPinType_Active == aEvent->PinEvent.Type)
        	{
        		if (BoltLockMgr().IsUnlocked())
        		{
        			BoltLockMgr().InitiateAction(0, BoltLockManager::LOCK_ACTION);
        		}
        	}
        	break;
        
        case AppEvent::kEventType_ButtonLeft:
            if (AppEvent::kAppEventButtonType_Clicked == aEvent->ButtonEvent.Type)
            {
                if (!BoltLockMgr().IsUnlocked())
                {
                    BoltLockMgr().InitiateAction(0, BoltLockManager::UNLOCK_ACTION);
                }
            }
            else if (AppEvent::kAppEventButtonType_LongClicked == aEvent->ButtonEvent.Type)
            {
                chip::Server::GetInstance().ScheduleFactoryReset();
            }
            break;
    
        case AppEvent::kEventType_ButtonRight:
            if (AppEvent::kAppEventButtonType_Clicked == aEvent->ButtonEvent.Type)
            {
                if (BoltLockMgr().IsUnlocked())
                {
                    BoltLockMgr().InitiateAction(0, BoltLockManager::LOCK_ACTION);
                }
            }
            else if (AppEvent::kAppEventButtonType_LongClicked == aEvent->ButtonEvent.Type)
            {
                // Enable BLE advertisements
                if (!ConnectivityMgr().IsBLEAdvertisingEnabled())
                {
                    if (Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() == CHIP_NO_ERROR)
                    {
                        PLAT_LOG("Enabled BLE Advertisements");
                    }
                    else
                    {
                        PLAT_LOG("OpenBasicCommissioningWindow() failed");
                    }
                }
                else
                {
                    // Disable BLE advertisements
                    ConnectivityMgr().SetBLEAdvertisingEnabled(false);
                    PLAT_LOG("Disabled BLE Advertisements");
                }
            }
            break;
    
        case AppEvent::kEventType_AppEvent:
            if (NULL != aEvent->Handler)
            {
                aEvent->Handler(aEvent);
            }
            break;
    
        case AppEvent::kEventType_None:
        default:
            break;
        }
    }

  • This is AppEvent.h the other was AppTask.cpp.

    /*
     *
     *    Copyright (c) 2018 Nest Labs, Inc.
     *    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.
     */
    
    #ifndef APP_EVENT_H
    #define APP_EVENT_H
    
    struct AppEvent;
    typedef void (*EventHandler)(AppEvent *);
    
    struct AppEvent
    {
        enum AppEventType
        {
            kEventType_None = 0,
            kEventType_ButtonLeft,
            kEventType_ButtonRight,
            kEventType_AppEvent,
            kEventType_Pin23,
        };
    
        enum AppEventButtonType
        {
            kAppEventButtonType_None = 0,
            kAppEventButtonType_Clicked,
            kAppEventButtonType_LongClicked,
        };
    
        enum AppEventPinType
        {
    	kAppEventPinType_None = 0,
    	kAppEventPinType_Active,    
        };
    
        enum AppEventType Type;
    	
        union
        {
            struct
            {
                enum AppEventButtonType Type;
            } ButtonEvent;
            
            struct
            {
    	    enum AppEventPinType Type;
            } PinEvent;
    
            struct
            {
                void * Context;
            } BoltLockEvent;
        };
    
        EventHandler Handler;
    };
    
    #endif // APP_EVENT_H

  • I also have a LAUNCHCC3235MOD as well.

  • What branch of connectedhomeip are you using?  I noticed that some AppTask.cpp code is different from the mainline, and there are certainly more changes than only adding GPIO.  You also did not provide SysConfig changes.  Please make sure to completely remove your previous output folder (rm -rf build) before building again.  You should also be referring to the gpiointerrupt example for GPIO TI Driver usage.  There is no context for the Pin_23_open API.

    Regards,
    Ryan

  • /**
     * These arguments were used when this file was generated. They will be automatically applied on subsequent loads
     * via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments.
     * @cliArgs --board "/ti/boards/LP_CC2652R7" --rtos "freertos" --product "simplelink_cc13xx_cc26xx_sdk@7.10.01.24"
     * @versions {"tool":"1.16.2+3028"}
     */
    
    /**
     * Import the modules used in this configuration.
     */
    const ble         = scripting.addModule("/ti/ble5stack/ble");
    const CCFG        = scripting.addModule("/ti/devices/CCFG");
    const custom      = scripting.addModule("/ti/devices/radioconfig/custom");
    const rfdesign    = scripting.addModule("/ti/devices/radioconfig/rfdesign");
    const dmm         = scripting.addModule("/ti/dmm/dmm");
    const AESCCM      = scripting.addModule("/ti/drivers/AESCCM");
    const AESCCM1     = AESCCM.addInstance();
    const AESCTRDRBG  = scripting.addModule("/ti/drivers/AESCTRDRBG");
    const AESCTRDRBG1 = AESCTRDRBG.addInstance();
    const AESECB      = scripting.addModule("/ti/drivers/AESECB");
    const AESECB1     = AESECB.addInstance();
    const AESECB2     = AESECB.addInstance();
    const ECDH        = scripting.addModule("/ti/drivers/ECDH");
    const ECDH1       = ECDH.addInstance();
    const GPIO        = scripting.addModule("/ti/drivers/GPIO", {}, false);
    const GPIO1       = GPIO.addInstance();
    const NVS         = scripting.addModule("/ti/drivers/NVS");
    const NVS1        = NVS.addInstance();
    const NVS2        = NVS.addInstance();
    const RF          = scripting.addModule("/ti/drivers/RF");
    const SHA2        = scripting.addModule("/ti/drivers/SHA2");
    const SHA21       = SHA2.addInstance();
    const TRNG        = scripting.addModule("/ti/drivers/TRNG");
    const TRNG1       = TRNG.addInstance();
    const TRNG2       = TRNG.addInstance();
    const TRNG3       = TRNG.addInstance();
    const UART2       = scripting.addModule("/ti/drivers/UART2");
    const UART21      = UART2.addInstance();
    const Button      = scripting.addModule("/ti/drivers/apps/Button");
    const Button1     = Button.addInstance();
    const Button2     = Button.addInstance();
    const LED         = scripting.addModule("/ti/drivers/apps/LED");
    const LED1        = LED.addInstance();
    const LED2        = LED.addInstance();
    
    /**
     * Write custom configuration values to the imported modules.
     */
    ble.maxConnNum                               = 1;
    ble.numOfAdvSets                             = 1;
    ble.lockProject                              = true;
    ble.maxPDUSize                               = 255;
    ble.radioConfig.codeExportConfig.$name       = "ti_devices_radioconfig_code_export_param2";
    ble.connUpdateParamsPeripheral.$name         = "ti_ble5stack_general_ble_conn_update_params0";
    ble.connUpdateParamsPeripheral.reqMinConnInt = 30;
    ble.connUpdateParamsPeripheral.reqMaxConnInt = 50;
    ble.advSet1.$name                            = "ti_ble5stack_broadcaster_advertisement_set0";
    ble.advSet1.advParam1.$name                  = "ti_ble5stack_broadcaster_advertisement_params0";
    ble.advSet1.advData1.$name                   = "ti_ble5stack_broadcaster_advertisement_data0";
    ble.advSet1.scanRes1.$name                   = "ti_ble5stack_broadcaster_advertisement_data1";
    
    CCFG.enableCodeGeneration = false;
    
    custom.ieee                                                  = ["ieee154"];
    custom.radioConfigieee154.$name                              = "ti_devices_radioconfig_settings_ieee_15_40";
    custom.radioConfigieee154.codeExportConfig.$name             = "ti_devices_radioconfig_code_export_param1";
    custom.radioConfigieee154.codeExportConfig.useConst          = true;
    custom.radioConfigieee154.codeExportConfig.useMulti          = true;
    custom.radioConfigieee154.codeExportConfig.symGenMethod      = "Custom";
    custom.radioConfigieee154.codeExportConfig.cmdRadioSetup     = "RF_cmdIeeeRadioSetup";
    custom.radioConfigieee154.codeExportConfig.cmdList_ieee_15_4 = ["cmdIeeeCsma","cmdIeeeEdScan","cmdIeeeRx","cmdIeeeRxAck","cmdIeeeTx","cmdRadioSetup","cmdTxTest"];
    
    dmm.project                                        = "ti_thread_thermostat_remote_display";
    dmm.stackRoles                                     = ["blePeripheral","threadFTD"];
    dmm.lockStackRoles                                 = true;
    dmm.numApplicationStates                           = 10;
    dmm.applicationState0                              = "ANY";
    dmm.applicationState1                              = "DMMPOLICY_BLE_IDLE";
    dmm.applicationState2                              = "DMMPOLICY_BLE_ADV";
    dmm.applicationState3                              = "DMMPOLICY_BLE_CONNECTING";
    dmm.applicationState4                              = "DMMPOLICY_BLE_HIGH_BANDWIDTH";
    dmm.applicationState5                              = "DMMPOLICY_BLE_CONNECTED";
    dmm.applicationState6                              = "DMMPOLICY_BLE_OAD";
    dmm.applicationState7                              = "DMMPOLICY_THREAD_IDLE";
    dmm.applicationState8                              = "DMMPOLICY_THREAD_LINK_EST";
    dmm.applicationState9                              = "DMMPOLICY_THREAD_DATA";
    dmm.policyArray.create(4);
    dmm.policyArray[0].$name                           = "ti_dmm_policy_dmm_policy0";
    dmm.policyArray[0].blePeripheral.$name             = "ti_dmm_policy_stack_dmm_stack_ble0";
    dmm.policyArray[0].blePeripheral.applicationStates = ["applicationState6"];
    dmm.policyArray[0].threadFTD.$name                 = "ti_dmm_policy_stack_dmm_stack_thread0";
    dmm.policyArray[0].threadFTD.pause                 = "DMMPOLICY_PAUSED";
    dmm.policyArray[1].$name                           = "ti_dmm_policy_dmm_policy1";
    dmm.policyArray[1].blePeripheral.$name             = "ti_dmm_policy_stack_dmm_stack_ble1";
    dmm.policyArray[1].blePeripheral.applicationStates = ["applicationState3","applicationState4"];
    dmm.policyArray[1].blePeripheral.weight            = 25;
    dmm.policyArray[1].blePeripheral.appliedActivity   = ["DMMPOLICY_APPLIED_ACTIVITY_BLE_CONNECTION"];
    dmm.policyArray[1].threadFTD.$name                 = "ti_dmm_policy_stack_dmm_stack_thread1";
    dmm.policyArray[2].$name                           = "ti_dmm_policy_dmm_policy2";
    dmm.policyArray[2].blePeripheral.$name             = "ti_dmm_policy_stack_dmm_stack_ble2";
    dmm.policyArray[2].threadFTD.$name                 = "ti_dmm_policy_stack_dmm_stack_thread2";
    dmm.policyArray[2].threadFTD.weight                = 30;
    dmm.policyArray[2].threadFTD.applicationStates     = ["applicationState8"];
    dmm.policyArray[2].threadFTD.appliedActivity       = ["DMMPOLICY_APPLIED_ACTIVITY_ALL"];
    dmm.policyArray[3].$name                           = "ti_dmm_policy_dmm_policy3";
    dmm.policyArray[3].blePeripheral.$name             = "ti_dmm_policy_stack_dmm_stack_ble3";
    dmm.policyArray[3].threadFTD.$name                 = "ti_dmm_policy_stack_dmm_stack_thread3";
    dmm.policyArray[3].threadFTD.weight                = 1;
    
    AESCCM1.$name = "CONFIG_AESCCM0";
    
    AESCTRDRBG1.$name = "CONFIG_AESCTRDRBG_0";
    
    AESECB1.$name = "CONFIG_AESECB0";
    
    AESECB2.$name = "CONFIG_AESECB_1";
    
    ECDH1.$name = "CONFIG_ECDH0";
    
    GPIO1.pull             = "Pull Down";
    GPIO1.interruptTrigger = "Rising Edge";
    GPIO1.$name            = "CONFIG_GPIO_23";
    GPIO1.gpioPin.$assign  = "boosterpack.2";
    
    NVS1.$name                    = "CONFIG_NVSINTERNAL";
    NVS1.internalFlash.$name      = "ti_drivers_nvs_NVSCC26XX0";
    NVS1.internalFlash.regionBase = 0xAA000;
    NVS1.internalFlash.regionSize = 0x4000;
    
    NVS2.$name               = "CONFIG_NVSEXTERNAL";
    NVS2.nvsType             = "External";
    NVS2.$hardware           = system.deviceData.board.components.MX25R8035F;
    NVS2.externalFlash.$name = "ti_drivers_nvs_NVSSPI25X0";
    
    SHA21.$name = "CONFIG_SHA2_0";
    
    TRNG1.$name = "CONFIG_TRNG_0";
    
    TRNG2.$name = "CONFIG_TRNG_THREAD";
    
    TRNG3.$name = "CONFIG_TRNG_APP";
    
    UART21.$hardware = system.deviceData.board.components.XDS110UART;
    UART21.$name     = "CONFIG_UART2_DEBUG";
    
    Button1.$name                    = "CONFIG_BTN_LEFT";
    Button1.$hardware                = system.deviceData.board.components["BTN-1"];
    Button1.gpioPin.$name            = "CONFIG_GPIO_BTN1";
    Button1.gpioPin.pull             = "Pull Up";
    Button1.gpioPin.interruptTrigger = "Falling Edge";
    
    Button2.$name                    = "CONFIG_BTN_RIGHT";
    Button2.$hardware                = system.deviceData.board.components["BTN-2"];
    Button2.gpioPin.$name            = "CONFIG_GPIO_BTN2";
    Button2.gpioPin.pull             = "Pull Up";
    Button2.gpioPin.interruptTrigger = "Falling Edge";
    
    LED1.$name         = "CONFIG_LED_RED";
    LED1.$hardware     = system.deviceData.board.components.LED_RED;
    LED1.gpioPin.$name = "CONFIG_GPIO_RLED";
    
    LED2.$name         = "CONFIG_LED_GREEN";
    LED2.$hardware     = system.deviceData.board.components.LED_GREEN;
    LED2.gpioPin.$name = "CONFIG_GPIO_GLED";
    
    const NVSSPI25XDevice                        = scripting.addModule("/ti/drivers/nvs/NVSSPI25XDevice", {}, false);
    const NVSSPI25XDevice1                       = NVSSPI25XDevice.addInstance({}, false);
    NVSSPI25XDevice1.$name                       = "CONFIG_NVS_SPI_0";
    NVS2.externalFlash.spiFlashDevice            = NVSSPI25XDevice1;
    NVSSPI25XDevice1.chipSelectPinInstance.$name = "CONFIG_GPIO_0";
    
    const SPI                          = scripting.addModule("/ti/drivers/SPI", {}, false);
    const SPI1                         = SPI.addInstance({}, false);
    SPI1.$name                         = "CONFIG_SPI_0";
    NVSSPI25XDevice1.sharedSpiInstance = SPI1;
    
    /**
     * Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
     * version of the tool will not impact the pinmux you originally saw.  These lines can be completely deleted in order to
     * re-solve from scratch.
     */
    UART21.uart.$suggestSolution                 = "UART0";
    UART21.uart.txPin.$suggestSolution           = "boosterpack.4";
    UART21.uart.rxPin.$suggestSolution           = "boosterpack.3";
    Button1.button.$suggestSolution              = "boosterpack.13";
    Button2.button.$suggestSolution              = "boosterpack.12";
    LED1.ledPin.$suggestSolution                 = "boosterpack.39";
    LED2.ledPin.$suggestSolution                 = "boosterpack.40";
    NVSSPI25XDevice1.chipSelect.$suggestSolution = "boosterpack.38";
    SPI1.spi.$suggestSolution                    = "SSI0";
    SPI1.spi.sclkPin.$suggestSolution            = "boosterpack.7";
    SPI1.spi.pociPin.$suggestSolution            = "boosterpack.14";
    SPI1.spi.picoPin.$suggestSolution            = "boosterpack.15";
    SPI1.spi.dmaRxChannel.$suggestSolution       = "DMA_CH3";
    SPI1.spi.dmaTxChannel.$suggestSolution       = "DMA_CH4";

  • Sorry it has taken so long to get back at you, I ended up getting Covid and had to miss work. That is my syscfg file. I have previously took the gpiointerrupt and modified it with no problem. By branch of connectedhomeip what exactly do you mean? I am in examples/lock-app/cc13x2x7_26x2x7.

  • Hi Corey,

    By branch of connectedhomeip what exactly do you mean?

    If I may, Ryan is asking for the git branch you have based your work on. It could also be helpful to provide the last commit id of the TI code so we can be sure we refer to the same code.

    Best regards,

  • So, I went back and changed my args.gni (I had to change it because i wasn't getting my qr for the board) and I no longer had a flash issue. It compiled successfully.

  • Hi Corey,

    Thanks for the update, glad you figured it out!

    Would you mind sharing what changes to args.gni you used? This may help another E2E user resolve similar issues.

    By branch of connectedhomeip what exactly do you mean? I am in examples/lock-app/cc13x2x7_26x2x7

    You can figure out the commit id in the command line by navigating to the respective repo ("cd matter"), then run "git log".

    It would show you previous changes committed to the codebase, and each commit will have a unique ID (hash). This can help us identify what version of the codebase you are using, and also recommend to you which one to use.

    Thanks,
    Toby

  • Always check the args.gni file. It is located in ~/connectedhomeip/examples/lock-app/cc13x2x7_26x2x7. 
    Look for chip_progress_logging = true. 
    If it is not set to true, set it to true. 

  • I had to change that line to true, before I edited the code it worked. Afterwards I started over from scratch and put my 2 files and sysconfig files into the new program and it worked, until I changed that statement to true. But luckily i have still have the qr code. But I didn't need it. I am trying to create a pin that gets an input from a sensor and tell google home. For example if someone opens up a door. But, first i am trying to have a pin lock the "lock-app". But, so far, its not working out. It still compiles but the pin doesnt do anything.

  • It sounds like you are able to build/compile successfully, but the run-time behavior is not working as you expect.

    From my understanding, the behavior you expect is that, when the user performs a "lock" (by pressing a button on the launchpad), the state of the lock will also be updated at the Google Home side.

    You are also trying to update the syscfg file to use different pins for different functionality.

    So in summary, you have two things here:

    1. Trying to see updated state of device (lock-app) on your Google Home
    2. Trying to change pin functionality

    I recommend first making sure 1) works:

    This should be possible and enabled by default.
    Can you refer to this SLA: https://dev.ti.com/tirex/explore/node?node=A__AciOYyNq9gli.nsvJzBtQg__com.ti.SIMPLELINK_ACADEMY_CC13XX_CC26XX_SDK__AfkT0vQ__LATEST

    Specifically, see the section "Task 3 – Join a Matter Controller", where it instructs you to create a Matter Integration on the Google side.

  • I got it to compile and work, I can get it to communicate it with my google nest. I have been working on adding a pin to it, it still can compile but it doesn't do anything with the pin.

  • /*
     *
     *    Copyright (c) 2020 Project CHIP Authors
     *    Copyright (c) 2020 Texas Instruments Incorporated
     *    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.
     */
    
    #include "AppTask.h"
    #include "AppConfig.h"
    #include "AppEvent.h"
    
    #include "FreeRTOS.h"
    
    #include <credentials/DeviceAttestationCredsProvider.h>
    #include <examples/platform/cc13x2_26x2/CC13X2_26X2DeviceAttestationCreds.h>
    
    #include <DeviceInfoProviderImpl.h>
    #include <platform/CHIPDeviceLayer.h>
    
    #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
    #include <app/clusters/ota-requestor/BDXDownloader.h>
    #include <app/clusters/ota-requestor/DefaultOTARequestor.h>
    #include <app/clusters/ota-requestor/DefaultOTARequestorDriver.h>
    #include <app/clusters/ota-requestor/DefaultOTARequestorStorage.h>
    #include <platform/cc13xx_26xx/OTAImageProcessorImpl.h>
    #endif
    
    #include <lib/support/CHIPMem.h>
    #include <lib/support/CHIPPlatformMemory.h>
    
    #include <app-common/zap-generated/attributes/Accessors.h>
    
    #include <app/clusters/door-lock-server/door-lock-server.h>
    #include <app/clusters/identify-server/identify-server.h>
    #include <app/server/OnboardingCodesUtil.h>
    #include <app/server/Server.h>
    #include <app/util/attribute-storage.h>
    
    #include <ti/drivers/apps/Button.h>
    #include <ti/drivers/apps/LED.h>
    
    /* syscfg */
    #include <ti_drivers_config.h>
    
    #define APP_TASK_STACK_SIZE (4096)
    #define APP_TASK_PRIORITY 4
    #define APP_EVENT_QUEUE_SIZE 10
    
    using namespace ::chip;
    using namespace ::chip::app;
    using namespace ::chip::Credentials;
    using namespace ::chip::DeviceLayer;
    using namespace ::chip::app::Clusters::DoorLock;
    
    static TaskHandle_t sAppTaskHandle;
    static QueueHandle_t sAppEventQueue;
    
    static LED_Handle sAppRedHandle;
    static LED_Handle sAppGreenHandle;
    static Button_Handle sAppLeftHandle;
    static Button_Handle sAppRightHandle;
    static DeviceInfoProviderImpl sExampleDeviceInfoProvider;
    
    AppTask AppTask::sAppTask;
    
    #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
    static DefaultOTARequestor sRequestorCore;
    static DefaultOTARequestorStorage sRequestorStorage;
    static DefaultOTARequestorDriver sRequestorUser;
    static BDXDownloader sDownloader;
    static OTAImageProcessorImpl sImageProcessor;
    
    void InitializeOTARequestor(void)
    {
        // Initialize and interconnect the Requestor and Image Processor objects
        SetRequestorInstance(&sRequestorCore);
    
        sRequestorStorage.Init(Server::GetInstance().GetPersistentStorage());
        sRequestorCore.Init(Server::GetInstance(), sRequestorStorage, sRequestorUser, sDownloader);
        sImageProcessor.SetOTADownloader(&sDownloader);
        sDownloader.SetImageProcessorDelegate(&sImageProcessor);
        sRequestorUser.Init(&sRequestorCore, &sImageProcessor);
    }
    #endif
    
    ::Identify stIdentify = { 0, AppTask::IdentifyStartHandler, AppTask::IdentifyStopHandler,
                              Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator, AppTask::TriggerIdentifyEffectHandler };
    
    int AppTask::StartAppTask()
    {
        int ret = 0;
    
        sAppEventQueue = xQueueCreate(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent));
        if (sAppEventQueue == NULL)
        {
            PLAT_LOG("Failed to allocate app event queue");
            while (1)
                ;
        }
    
        // Start App task.
        if (xTaskCreate(AppTaskMain, "APP", APP_TASK_STACK_SIZE / sizeof(StackType_t), NULL, APP_TASK_PRIORITY, &sAppTaskHandle) !=
            pdPASS)
        {
            PLAT_LOG("Failed to create app task");
            while (1)
                ;
        }
        return ret;
    }
    void gpioInputFxn1(uint_least8_t index)
    {
    	LockMgr().InitiateAction(LockManager::LOCK_ACTION);
    }
    void uiLocking(void)
    {
        PLAT_LOG("Lock initiated");
        LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX);
        LED_startBlinking(sAppGreenHandle, 50 /* ms */, LED_BLINK_FOREVER);
        LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX);
        LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER);
    }
    
    void uiLocked(void)
    {
        PLAT_LOG("Lock completed");
        LED_stopBlinking(sAppGreenHandle);
        LED_setOff(sAppGreenHandle);
        LED_stopBlinking(sAppRedHandle);
        LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX);
    }
    
    void uiUnlocking(void)
    {
        PLAT_LOG("Unlock initiated");
        LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX);
        LED_startBlinking(sAppGreenHandle, 50 /* ms */, LED_BLINK_FOREVER);
        LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX);
        LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER);
    }
    
    void uiUnlocked(void)
    {
        PLAT_LOG("Unlock completed");
        LED_stopBlinking(sAppGreenHandle);
        LED_setOff(sAppGreenHandle);
        LED_stopBlinking(sAppRedHandle);
        LED_setOff(sAppRedHandle);
    }
    
    int AppTask::Init()
    {	
        LED_Params ledParams;
        Button_Params buttonParams;
    
        cc13xx_26xxLogInit();
    
        // Init Chip memory management before the stack
        Platform::MemoryInit();
    
        CHIP_ERROR ret = PlatformMgr().InitChipStack();
        if (ret != CHIP_NO_ERROR)
        {
            PLAT_LOG("PlatformMgr().InitChipStack() failed");
            while (1)
                ;
        }
    
        ret = ThreadStackMgr().InitThreadStack();
        if (ret != CHIP_NO_ERROR)
        {
            PLAT_LOG("ThreadStackMgr().InitThreadStack() failed");
            while (1)
                ;
        }
    #if CHIP_DEVICE_CONFIG_THREAD_FTD
        ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router);
    #else
        ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice);
    #endif
        if (ret != CHIP_NO_ERROR)
        {
            PLAT_LOG("ConnectivityMgr().SetThreadDeviceType() failed");
            while (1)
                ;
        }
    
        ret = PlatformMgr().StartEventLoopTask();
        if (ret != CHIP_NO_ERROR)
        {
            PLAT_LOG("PlatformMgr().StartEventLoopTask() failed");
            while (1)
                ;
        }
    
        ret = ThreadStackMgrImpl().StartThreadTask();
        if (ret != CHIP_NO_ERROR)
        {
            PLAT_LOG("ThreadStackMgr().StartThreadTask() failed");
            while (1)
                ;
        }
        
        GPIO_init();
    	while(1) {
    		extern void GPIO_enableInt(uint_least8_t index);
    		extern void GPIO_callbacks(uint_least8_t index);
    		//extern void GPIO_CallbackFxn(uint_least8_t index); 
    		GPIO_setConfig(CONFIG_GPIO_23, GPIO_CFG_IN_INT_RISING | GPIO_CFG_PULL_DOWN_INTERNAL);
    		//GPIO_getCallback(CONFIG_GPIO_23);
    		GPIO_setCallback(CONFIG_GPIO_23, gpioInputFxn1);
    		GPIO_enableInt(CONFIG_GPIO_23);
    	}
    
        // Init ZCL Data Model and start server
        PLAT_LOG("Initialize Server");
        static CommonCaseDeviceServerInitParams initParams;
        (void) initParams.InitializeStaticResourcesBeforeServerInit();
    
        // Initialize info provider
        sExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate);
        SetDeviceInfoProvider(&sExampleDeviceInfoProvider);
    
        Server::GetInstance().Init(initParams);
    
        // Initialize device attestation config
    #ifdef CC13X2_26X2_ATTESTATION_CREDENTIALS
        SetDeviceAttestationCredentialsProvider(CC13X2_26X2::GetCC13X2_26X2DacProvider());
    #else
        SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
    #endif
    
        // Initialize LEDs
        PLAT_LOG("Initialize LEDs");
        LED_init();
    
        LED_Params_init(&ledParams); // default PWM LED
        sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams);
        LED_setOff(sAppRedHandle);
    
        LED_Params_init(&ledParams); // default PWM LED
        sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams);
        LED_setOff(sAppGreenHandle);
    
        // Initialize buttons
        PLAT_LOG("Initialize buttons");
        Button_init();
    
        Button_Params_init(&buttonParams);
        buttonParams.buttonEventMask   = Button_EV_CLICKED | Button_EV_LONGCLICKED;
        buttonParams.longPressDuration = 1000U; // ms
        sAppLeftHandle                 = Button_open(CONFIG_BTN_LEFT, &buttonParams);
        Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler);
    
        Button_Params_init(&buttonParams);
        buttonParams.buttonEventMask   = Button_EV_CLICKED | Button_EV_LONGCLICKED;
        buttonParams.longPressDuration = 1000U; // ms
        sAppRightHandle                = Button_open(CONFIG_BTN_RIGHT, &buttonParams);
        Button_setCallback(sAppRightHandle, ButtonRightEventHandler);
    
        PlatformMgr().LockChipStack();
        {
            uint8_t numberOfCredentialsPerUser      = 0;
            uint16_t numberOfUsers                  = 0;
            uint8_t numberOfWeekdaySchedulesPerUser = 0;
            uint8_t numberOfYeardaySchedulesPerUser = 0;
            uint8_t numberOfHolidaySchedules        = 0;
            chip::app::DataModel::Nullable<chip::app::Clusters::DoorLock::DlLockState> state;
            EndpointId endpointId{ 1 };
    
            if (!DoorLockServer::Instance().GetNumberOfCredentialsSupportedPerUser(endpointId, numberOfCredentialsPerUser))
            {
                numberOfCredentialsPerUser = 5;
            }
    
            if (!DoorLockServer::Instance().GetNumberOfUserSupported(endpointId, numberOfUsers))
            {
                numberOfUsers = 10;
            }
    
            if (!DoorLockServer::Instance().GetNumberOfWeekDaySchedulesPerUserSupported(endpointId, numberOfWeekdaySchedulesPerUser))
            {
                numberOfWeekdaySchedulesPerUser = 10;
            }
    
            if (!DoorLockServer::Instance().GetNumberOfYearDaySchedulesPerUserSupported(endpointId, numberOfYeardaySchedulesPerUser))
            {
                numberOfYeardaySchedulesPerUser = 10;
            }
    
            if (!DoorLockServer::Instance().GetNumberOfHolidaySchedulesSupported(endpointId, numberOfHolidaySchedules))
            {
                numberOfHolidaySchedules = 10;
            }
    
            Attributes::LockState::Get(endpointId, state);
            ret = LockMgr().Init(state,
                                 CC13X2_26X2DoorLock::LockInitParams::ParamBuilder()
                                     .SetNumberOfUsers(numberOfUsers)
                                     .SetNumberOfCredentialsPerUser(numberOfCredentialsPerUser)
                                     .SetNumberOfWeekdaySchedulesPerUser(numberOfWeekdaySchedulesPerUser)
                                     .SetNumberOfYeardaySchedulesPerUser(numberOfYeardaySchedulesPerUser)
                                     .SetNumberOfHolidaySchedules(numberOfHolidaySchedules)
                                     .GetLockParam());
    
            if (state.Value() == DlLockState::kLocked)
            {
                uiLocked();
            }
            else
            {
                uiUnlocked();
            }
        }
    
        PlatformMgr().UnlockChipStack();
    
        if (ret != CHIP_NO_ERROR)
        {
            PLAT_LOG("LockMgr().Init() failed");
            while (1)
                ;
        }
    
        LockMgr().SetCallbacks(ActionInitiated, ActionCompleted);
    
        ConfigurationMgr().LogDeviceConfig();
    
    #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
        InitializeOTARequestor();
    #endif
        // QR code will be used with CHIP Tool
        PrintOnboardingCodes(RendezvousInformationFlags(RendezvousInformationFlag::kBLE));
    
        return 0;
    }
    
    void AppTask::AppTaskMain(void * pvParameter)
    {
        AppEvent event;
    
        sAppTask.Init();
    
        LockMgr().ReadConfigValues();
    
        while (1)
        {
            /* Task pend until we have stuff to do */
            if (xQueueReceive(sAppEventQueue, &event, portMAX_DELAY) == pdTRUE)
            {
                sAppTask.DispatchEvent(&event);
            }
        }   
    }
    
    void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events)
    {
        AppEvent event;
        event.Type = AppEvent::kEventType_ButtonLeft;
    
        if (events & Button_EV_CLICKED)
        {
            event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked;
        }
        else if (events & Button_EV_LONGCLICKED)
        {
            event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked;
        }
        // button callbacks are in ISR context
        if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS)
        {
            /* Failed to post the message */
        }
    }
    
    void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask events)
    {
        AppEvent event;
        event.Type = AppEvent::kEventType_ButtonRight;
    
        if (events & Button_EV_CLICKED)
        {
            event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked;
        }
        else if (events & Button_EV_LONGCLICKED)
        {
            event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked;
        }
        // button callbacks are in ISR context
        if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS)
        {
            /* Failed to post the message */
        }
    }
    
    void AppTask::ActionInitiated(LockManager::Action_t aAction)
    {
        if (aAction == LockManager::LOCK_ACTION)
        {
            uiLocking();
        }
        else if (aAction == LockManager::UNLOCK_ACTION)
        {
            uiUnlocking();
        }
    }
    
    void AppTask::ActionCompleted(LockManager::Action_t aAction)
    {
        if (aAction == LockManager::LOCK_ACTION)
        {
            uiLocked();
        }
        else if (aAction == LockManager::UNLOCK_ACTION)
        {
            uiUnlocked();
        }
    }
    
    void AppTask::PostEvent(const AppEvent * aEvent)
    {
        if (sAppEventQueue != NULL)
        {
            BaseType_t status;
            if (xPortIsInsideInterrupt())
            {
                BaseType_t higherPrioTaskWoken = pdFALSE;
                status                         = xQueueSendFromISR(sAppEventQueue, aEvent, &higherPrioTaskWoken);
    
    #ifdef portYIELD_FROM_ISR
                portYIELD_FROM_ISR(higherPrioTaskWoken);
    #elif portEND_SWITCHING_ISR // portYIELD_FROM_ISR or portEND_SWITCHING_ISR
                portEND_SWITCHING_ISR(higherPrioTaskWoken);
    #else                       // portYIELD_FROM_ISR or portEND_SWITCHING_ISR
    #error "Must have portYIELD_FROM_ISR or portEND_SWITCHING_ISR"
    #endif // portYIELD_FROM_ISR or portEND_SWITCHING_ISR
            }
            else
            {
                status = xQueueSend(sAppEventQueue, aEvent, 1);
            }
    
            if (status != pdTRUE)
            {
                PLAT_LOG("Failed to post event to app task event queue");
            }
        }
        else
        {
            PLAT_LOG("Event Queue is NULL should never happen");
        }
    }
    
    void AppTask::DispatchEvent(AppEvent * aEvent)
    {
        switch (aEvent->Type)
        {
        case AppEvent::kEventType_ButtonLeft:
            if (AppEvent::kAppEventButtonType_Clicked == aEvent->ButtonEvent.Type)
            {
                LockMgr().InitiateAction(LockManager::UNLOCK_ACTION);
            }
            else if (AppEvent::kAppEventButtonType_LongClicked == aEvent->ButtonEvent.Type)
            {
                chip::Server::GetInstance().ScheduleFactoryReset();
            }
            break;
    
        case AppEvent::kEventType_ButtonRight:
            if (AppEvent::kAppEventButtonType_Clicked == aEvent->ButtonEvent.Type)
            {
                LockMgr().InitiateAction(LockManager::LOCK_ACTION);
            }
            else if (AppEvent::kAppEventButtonType_LongClicked == aEvent->ButtonEvent.Type)
            {
                // Enable BLE advertisements
                if (!ConnectivityMgr().IsBLEAdvertisingEnabled())
                {
                    if (Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() == CHIP_NO_ERROR)
                    {
                        PLAT_LOG("Enabled BLE Advertisements");
                    }
                    else
                    {
                        PLAT_LOG("OpenBasicCommissioningWindow() failed");
                    }
                }
                else
                {
                    // Disable BLE advertisements
                    ConnectivityMgr().SetBLEAdvertisingEnabled(false);
                    PLAT_LOG("Disabled BLE Advertisements");
                }
            }
            break;
    
        case AppEvent::kEventType_IdentifyStart:
            LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX);
            LED_startBlinking(sAppGreenHandle, 500, LED_BLINK_FOREVER);
            PLAT_LOG("Identify started");
            break;
    
        case AppEvent::kEventType_IdentifyStop:
            LED_stopBlinking(sAppGreenHandle);
    
            LED_setOff(sAppGreenHandle);
            PLAT_LOG("Identify stopped");
            break;
    
        case AppEvent::kEventType_AppEvent:
            if (NULL != aEvent->Handler)
            {
                aEvent->Handler(aEvent);
            }
            break;
    
        case AppEvent::kEventType_None:
        default:
            break;
        }
    }
    
    void AppTask::IdentifyStartHandler(::Identify *)
    {
        AppEvent event;
        event.Type = AppEvent::kEventType_IdentifyStart;
        sAppTask.PostEvent(&event);
    }
    
    void AppTask::IdentifyStopHandler(::Identify *)
    {
        AppEvent event;
        event.Type = AppEvent::kEventType_IdentifyStop;
        sAppTask.PostEvent(&event);
    }
    
    void AppTask::TriggerIdentifyEffectHandler(::Identify * identify)
    {
        switch (identify->mCurrentEffectIdentifier)
        {
        case Clusters::Identify::EffectIdentifierEnum::kBlink:
            PLAT_LOG("Starting blink identifier effect");
            IdentifyStartHandler(identify);
            break;
        case Clusters::Identify::EffectIdentifierEnum::kBreathe:
            PLAT_LOG("Breathe identifier effect not implemented");
            break;
        case Clusters::Identify::EffectIdentifierEnum::kOkay:
            PLAT_LOG("Okay identifier effect not implemented");
            break;
        case Clusters::Identify::EffectIdentifierEnum::kChannelChange:
            PLAT_LOG("Channel Change identifier effect not implemented");
            break;
        case Clusters::Identify::EffectIdentifierEnum::kFinishEffect:
            PLAT_LOG("Finish identifier effect not implemented");
            break;
        case Clusters::Identify::EffectIdentifierEnum::kStopEffect:
            PLAT_LOG("Stop identifier effect");
            IdentifyStopHandler(identify);
            break;
        default:
            PLAT_LOG("No identifier effect");
        }
    }

  • That is what I currently have. I tried to use their GPIO interrupt example and how I programmed the board to take in one input and light up an led. I don't know if I need to put the GPIO pin into an event like the buttons. But, Yea, this is my first time programming in this language. I know Java, HTML, CSS, PHP, Javascript and Flutter/dart. But, like I said I was able to get the pin to change a pin without all of the matter stuff. I just don't know where to go from here.

  • I took a look at your code.

    From what I can see, you are trying to use CONFIG_GPIO_23 rising edge to directly perform LOCK_ACTION.
    This is not recommended.

    Due to the architecture* of the example (AppTask and LockManager), I would recommend the below.
    (* some functions were designed to be executed in an interrupt, and some to be executed in a Task).

    Follow the flow of how the Button callback is handled.
    For example, the CONFIG_BTN_RIGHT edge will trigger callback ButtonRightEventHandler.
    In ButtonRightEventHandler, it posts an event (xQueueSendFromISR), and then the application task will handle it in AppTaskMain-->xQueueReceive-->DispatchEvent.

    So, if you want to trigger a lock action, then you should post to the queue (xQueueSendFromISR).
    Easiest way to do a sanity check is:

    void gpioInputFxn1(uint_least8_t index)
    {
        ButtonRightEventHandler((Button_Handle)0, Button_EV_CLICKED);
    }

    This code should theoretically start the same flow as if you had clicked the BTN_RIGHT (to lock).

  • Omg, I didn't even think about doing it that way. I tried multiple different ways, but not that way. Thanks

  • It says that it "was not declared in this scope". Specifically the "ButtonRightEventHandler"

  • Hi Corey,

    I am not observing the same error when attempting Toby's suggestion.  Please post the full error log, as well as the entire modified AppTask.cpp and chip.syscfg so that we may attempt to recreate the issue and advise accordingly.

    Regards,
    Ryan

  • /*
     *
     *    Copyright (c) 2020 Project CHIP Authors
     *    Copyright (c) 2020 Texas Instruments Incorporated
     *    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.
     */
    
    #include "AppTask.h"
    #include "AppConfig.h"
    #include "AppEvent.h"
    
    #include "FreeRTOS.h"
    
    #include <credentials/DeviceAttestationCredsProvider.h>
    #include <examples/platform/cc13x2_26x2/CC13X2_26X2DeviceAttestationCreds.h>
    
    #include <DeviceInfoProviderImpl.h>
    #include <platform/CHIPDeviceLayer.h>
    
    #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
    #include <app/clusters/ota-requestor/BDXDownloader.h>
    #include <app/clusters/ota-requestor/DefaultOTARequestor.h>
    #include <app/clusters/ota-requestor/DefaultOTARequestorDriver.h>
    #include <app/clusters/ota-requestor/DefaultOTARequestorStorage.h>
    #include <platform/cc13xx_26xx/OTAImageProcessorImpl.h>
    #endif
    
    #include <lib/support/CHIPMem.h>
    #include <lib/support/CHIPPlatformMemory.h>
    
    #include <app-common/zap-generated/attributes/Accessors.h>
    
    #include <app/clusters/door-lock-server/door-lock-server.h>
    #include <app/clusters/identify-server/identify-server.h>
    #include <app/server/OnboardingCodesUtil.h>
    #include <app/server/Server.h>
    #include <app/util/attribute-storage.h>
    
    #include <ti/drivers/apps/Button.h>
    #include <ti/drivers/apps/LED.h>
    
    /* syscfg */
    #include <ti_drivers_config.h>
    
    #define APP_TASK_STACK_SIZE (4096)
    #define APP_TASK_PRIORITY 4
    #define APP_EVENT_QUEUE_SIZE 10
    
    using namespace ::chip;
    using namespace ::chip::app;
    using namespace ::chip::Credentials;
    using namespace ::chip::DeviceLayer;
    using namespace ::chip::app::Clusters::DoorLock;
    
    static TaskHandle_t sAppTaskHandle;
    static QueueHandle_t sAppEventQueue;
    
    static LED_Handle sAppRedHandle;
    static LED_Handle sAppGreenHandle;
    static Button_Handle sAppLeftHandle;
    static Button_Handle sAppRightHandle;
    static DeviceInfoProviderImpl sExampleDeviceInfoProvider;
    //void gpioInputFxn1(uint_least8_t index);
    
    //extern void GPIO_enableInt(uint_least8_t index);
    //extern void GPIO_callbacks(uint_least8_t index);
    //extern void GPIO_CallbackFxn(uint_least8_t index); 
    AppTask AppTask::sAppTask;
    
    #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
    static DefaultOTARequestor sRequestorCore;
    static DefaultOTARequestorStorage sRequestorStorage;
    static DefaultOTARequestorDriver sRequestorUser;
    static BDXDownloader sDownloader;
    static OTAImageProcessorImpl sImageProcessor;
    
    void InitializeOTARequestor(void)
    {
        // Initialize and interconnect the Requestor and Image Processor objects
        SetRequestorInstance(&sRequestorCore);
    
        sRequestorStorage.Init(Server::GetInstance().GetPersistentStorage());
        sRequestorCore.Init(Server::GetInstance(), sRequestorStorage, sRequestorUser, sDownloader);
        sImageProcessor.SetOTADownloader(&sDownloader);
        sDownloader.SetImageProcessorDelegate(&sImageProcessor);
        sRequestorUser.Init(&sRequestorCore, &sImageProcessor);
    }
    #endif
    
    ::Identify stIdentify = { 0, AppTask::IdentifyStartHandler, AppTask::IdentifyStopHandler,
                              Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator, AppTask::TriggerIdentifyEffectHandler };
    
    int AppTask::StartAppTask()
    {
        int ret = 0;
    
        sAppEventQueue = xQueueCreate(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent));
        if (sAppEventQueue == NULL)
        {
            PLAT_LOG("Failed to allocate app event queue");
            while (1)
                ;
        }
    
        // Start App task.
        if (xTaskCreate(AppTaskMain, "APP", APP_TASK_STACK_SIZE / sizeof(StackType_t), NULL, APP_TASK_PRIORITY, &sAppTaskHandle) !=
            pdPASS)
        {
            PLAT_LOG("Failed to create app task");
            while (1)
                ;
        }
        return ret;
    }
    void gpioInputFxn1(uint_least8_t index)
    {
    	ButtonRightEventHandler((Button_Handle)0, Button_EV_CLICKED);
    }
    void uiLocking(void)
    {
        PLAT_LOG("Lock initiated");
        LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX);
        LED_startBlinking(sAppGreenHandle, 50 /* ms */, LED_BLINK_FOREVER);
        LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX);
        LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER);
    }
    
    void uiLocked(void)
    {
        PLAT_LOG("Lock completed");
        LED_stopBlinking(sAppGreenHandle);
        LED_setOff(sAppGreenHandle);
        LED_stopBlinking(sAppRedHandle);
        LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX);
    }
    
    void uiUnlocking(void)
    {
        PLAT_LOG("Unlock initiated");
        LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX);
        LED_startBlinking(sAppGreenHandle, 50 /* ms */, LED_BLINK_FOREVER);
        LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX);
        LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER);
    }
    
    void uiUnlocked(void)
    {
        PLAT_LOG("Unlock completed");
        LED_stopBlinking(sAppGreenHandle);
        LED_setOff(sAppGreenHandle);
        LED_stopBlinking(sAppRedHandle);
        LED_setOff(sAppRedHandle);
    }
    
    int AppTask::Init()
    {	
        LED_Params ledParams;
        Button_Params buttonParams;
    
        cc13xx_26xxLogInit();
    
        // Init Chip memory management before the stack
        Platform::MemoryInit();
    
        CHIP_ERROR ret = PlatformMgr().InitChipStack();
        if (ret != CHIP_NO_ERROR)
        {
            PLAT_LOG("PlatformMgr().InitChipStack() failed");
            while (1)
                ;
        }
    
        ret = ThreadStackMgr().InitThreadStack();
        if (ret != CHIP_NO_ERROR)
        {
            PLAT_LOG("ThreadStackMgr().InitThreadStack() failed");
            while (1)
                ;
        }
    #if CHIP_DEVICE_CONFIG_THREAD_FTD
        ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router);
    #else
        ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice);
    #endif
        if (ret != CHIP_NO_ERROR)
        {
            PLAT_LOG("ConnectivityMgr().SetThreadDeviceType() failed");
            while (1)
                ;
        }
    
        ret = PlatformMgr().StartEventLoopTask();
        if (ret != CHIP_NO_ERROR)
        {
            PLAT_LOG("PlatformMgr().StartEventLoopTask() failed");
            while (1)
                ;
        }
    
        ret = ThreadStackMgrImpl().StartThreadTask();
        if (ret != CHIP_NO_ERROR)
        {
            PLAT_LOG("ThreadStackMgr().StartThreadTask() failed");
            while (1)
                ;
        }
    
        // Init ZCL Data Model and start server
        PLAT_LOG("Initialize Server");
        static CommonCaseDeviceServerInitParams initParams;
        (void) initParams.InitializeStaticResourcesBeforeServerInit();
    
        // Initialize info provider
        sExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate);
        SetDeviceInfoProvider(&sExampleDeviceInfoProvider);
    
        Server::GetInstance().Init(initParams);
    
        // Initialize device attestation config
    #ifdef CC13X2_26X2_ATTESTATION_CREDENTIALS
        SetDeviceAttestationCredentialsProvider(CC13X2_26X2::GetCC13X2_26X2DacProvider());
    #else
        SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
    #endif
    
        // Initialize LEDs
        PLAT_LOG("Initialize LEDs");
        LED_init();
    
        LED_Params_init(&ledParams); // default PWM LED
        sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams);
        LED_setOff(sAppRedHandle);
    
        LED_Params_init(&ledParams); // default PWM LED
        sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams);
        LED_setOff(sAppGreenHandle);
    
        // Initialize buttons
        PLAT_LOG("Initialize buttons");
        Button_init();
    
        Button_Params_init(&buttonParams);
        buttonParams.buttonEventMask   = Button_EV_CLICKED | Button_EV_LONGCLICKED;
        buttonParams.longPressDuration = 1000U; // ms
        sAppLeftHandle                 = Button_open(CONFIG_BTN_LEFT, &buttonParams);
        Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler);
    
        Button_Params_init(&buttonParams);
        buttonParams.buttonEventMask   = Button_EV_CLICKED | Button_EV_LONGCLICKED;
        buttonParams.longPressDuration = 1000U; // ms
        sAppRightHandle                = Button_open(CONFIG_BTN_RIGHT, &buttonParams);
        Button_setCallback(sAppRightHandle, ButtonRightEventHandler);
        
        PlatformMgr().LockChipStack();
        {
            uint8_t numberOfCredentialsPerUser      = 0;
            uint16_t numberOfUsers                  = 0;
            uint8_t numberOfWeekdaySchedulesPerUser = 0;
            uint8_t numberOfYeardaySchedulesPerUser = 0;
            uint8_t numberOfHolidaySchedules        = 0;
            chip::app::DataModel::Nullable<chip::app::Clusters::DoorLock::DlLockState> state;
            EndpointId endpointId{ 1 };
    
            if (!DoorLockServer::Instance().GetNumberOfCredentialsSupportedPerUser(endpointId, numberOfCredentialsPerUser))
            {
                numberOfCredentialsPerUser = 5;
            }
    
            if (!DoorLockServer::Instance().GetNumberOfUserSupported(endpointId, numberOfUsers))
            {
                numberOfUsers = 10;
            }
    
            if (!DoorLockServer::Instance().GetNumberOfWeekDaySchedulesPerUserSupported(endpointId, numberOfWeekdaySchedulesPerUser))
            {
                numberOfWeekdaySchedulesPerUser = 10;
            }
    
            if (!DoorLockServer::Instance().GetNumberOfYearDaySchedulesPerUserSupported(endpointId, numberOfYeardaySchedulesPerUser))
            {
                numberOfYeardaySchedulesPerUser = 10;
            }
    
            if (!DoorLockServer::Instance().GetNumberOfHolidaySchedulesSupported(endpointId, numberOfHolidaySchedules))
            {
                numberOfHolidaySchedules = 10;
            }
    
            Attributes::LockState::Get(endpointId, state);
            ret = LockMgr().Init(state,
                                 CC13X2_26X2DoorLock::LockInitParams::ParamBuilder()
                                     .SetNumberOfUsers(numberOfUsers)
                                     .SetNumberOfCredentialsPerUser(numberOfCredentialsPerUser)
                                     .SetNumberOfWeekdaySchedulesPerUser(numberOfWeekdaySchedulesPerUser)
                                     .SetNumberOfYeardaySchedulesPerUser(numberOfYeardaySchedulesPerUser)
                                     .SetNumberOfHolidaySchedules(numberOfHolidaySchedules)
                                     .GetLockParam());
    
            if (state.Value() == DlLockState::kLocked)
            {
                uiLocked();
            }
            else
            {
                uiUnlocked();
            }
        }
    
        PlatformMgr().UnlockChipStack();
    
        if (ret != CHIP_NO_ERROR)
        {
            PLAT_LOG("LockMgr().Init() failed");
            while (1)
                ;
        }
    
        LockMgr().SetCallbacks(ActionInitiated, ActionCompleted);
    
        ConfigurationMgr().LogDeviceConfig();
    
    #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
        InitializeOTARequestor();
    #endif
        // QR code will be used with CHIP Tool
        PrintOnboardingCodes(RendezvousInformationFlags(RendezvousInformationFlag::kBLE));
    
        return 0;
    }
    
    void AppTask::AppTaskMain(void * pvParameter)
    {
        AppEvent event;
    
        sAppTask.Init();
    
        LockMgr().ReadConfigValues();
        
        GPIO_init();
           
        GPIO_setConfig(CONFIG_GPIO_23, GPIO_CFG_IN_INT_RISING | GPIO_CFG_PULL_DOWN_INTERNAL);
    
        while (1)
        {
        	   GPIO_setCallback(CONFIG_GPIO_23, gpioInputFxn1);
        
     	   GPIO_enableInt(CONFIG_GPIO_23);
            /* Task pend until we have stuff to do */
            if (xQueueReceive(sAppEventQueue, &event, portMAX_DELAY) == pdTRUE)
            {
               sAppTask.DispatchEvent(&event);
            }
        }   
    }
    
    void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events)
    {
        AppEvent event;
        event.Type = AppEvent::kEventType_ButtonLeft;
    
        if (events & Button_EV_CLICKED)
        {
            event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked;
        }
        else if (events & Button_EV_LONGCLICKED)
        {
            event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked;
        }
        // button callbacks are in ISR context
        if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS)
        {
            /* Failed to post the message */
        }
    }
    
    void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask events)
    {
        AppEvent event;
        event.Type = AppEvent::kEventType_ButtonRight;
    
        if (events & Button_EV_CLICKED)
        {
            event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked;
        }
        else if (events & Button_EV_LONGCLICKED)
        {
            event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked;
        }
        // button callbacks are in ISR context
        if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS)
        {
            /* Failed to post the message */
        }
    }
    
    void AppTask::ActionInitiated(LockManager::Action_t aAction)
    {
        if (aAction == LockManager::LOCK_ACTION)
        {
            uiLocking();
        }
        else if (aAction == LockManager::UNLOCK_ACTION)
        {
            uiUnlocking();
        }
    }
    
    void AppTask::ActionCompleted(LockManager::Action_t aAction)
    {
        if (aAction == LockManager::LOCK_ACTION)
        {
            uiLocked();
        }
        else if (aAction == LockManager::UNLOCK_ACTION)
        {
            uiUnlocked();
        }
    }
    
    void AppTask::PostEvent(const AppEvent * aEvent)
    {
        if (sAppEventQueue != NULL)
        {
            BaseType_t status;
            if (xPortIsInsideInterrupt())
            {
                BaseType_t higherPrioTaskWoken = pdFALSE;
                status                         = xQueueSendFromISR(sAppEventQueue, aEvent, &higherPrioTaskWoken);
    
    #ifdef portYIELD_FROM_ISR
                portYIELD_FROM_ISR(higherPrioTaskWoken);
    #elif portEND_SWITCHING_ISR // portYIELD_FROM_ISR or portEND_SWITCHING_ISR
                portEND_SWITCHING_ISR(higherPrioTaskWoken);
    #else                       // portYIELD_FROM_ISR or portEND_SWITCHING_ISR
    #error "Must have portYIELD_FROM_ISR or portEND_SWITCHING_ISR"
    #endif // portYIELD_FROM_ISR or portEND_SWITCHING_ISR
            }
            else
            {
                status = xQueueSend(sAppEventQueue, aEvent, 1);
            }
    
            if (status != pdTRUE)
            {
                PLAT_LOG("Failed to post event to app task event queue");
            }
        }
        else
        {
            PLAT_LOG("Event Queue is NULL should never happen");
        }
    }
    
    void AppTask::DispatchEvent(AppEvent * aEvent)
    {
    /*GPIO_init();
    extern void GPIO_enableInt(uint_least8_t index);
    extern void GPIO_callbacks(uint_least8_t index);
    //extern void GPIO_CallbackFxn(uint_least8_t index); 
    GPIO_setConfig(CONFIG_GPIO_23, GPIO_CFG_IN_INT_RISING | GPIO_CFG_PULL_DOWN_INTERNAL);
    //GPIO_getCallback(CONFIG_GPIO_23);*/
    
    
    //GPIO_setCallback(CONFIG_GPIO_23, gpioInputFxn1);
    
    //GPIO_enableInt(CONFIG_GPIO_23);
        switch (aEvent->Type)
        {   	
        case AppEvent::kEventType_ButtonLeft:
            if (AppEvent::kAppEventButtonType_Clicked == aEvent->ButtonEvent.Type)
            {
                LockMgr().InitiateAction(LockManager::UNLOCK_ACTION);
            }
            else if (AppEvent::kAppEventButtonType_LongClicked == aEvent->ButtonEvent.Type)
            {
                chip::Server::GetInstance().ScheduleFactoryReset();
            }
            break;
    
        case AppEvent::kEventType_ButtonRight:
            if (AppEvent::kAppEventButtonType_Clicked == aEvent->ButtonEvent.Type)
            {
                LockMgr().InitiateAction(LockManager::LOCK_ACTION);
            }
            else if (AppEvent::kAppEventButtonType_LongClicked == aEvent->ButtonEvent.Type)
            {
                // Enable BLE advertisements
                if (!ConnectivityMgr().IsBLEAdvertisingEnabled())
                {
                    if (Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() == CHIP_NO_ERROR)
                    {
                        PLAT_LOG("Enabled BLE Advertisements");
                    }
                    else
                    {
                        PLAT_LOG("OpenBasicCommissioningWindow() failed");
                    }
                }
                else
                {
                    // Disable BLE advertisements
                    ConnectivityMgr().SetBLEAdvertisingEnabled(false);
                    PLAT_LOG("Disabled BLE Advertisements");
                }
            }
            break;
    
        case AppEvent::kEventType_IdentifyStart:
            LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX);
            LED_startBlinking(sAppGreenHandle, 500, LED_BLINK_FOREVER);
            PLAT_LOG("Identify started");
            break;
    
        case AppEvent::kEventType_IdentifyStop:
            LED_stopBlinking(sAppGreenHandle);
    
            LED_setOff(sAppGreenHandle);
            PLAT_LOG("Identify stopped");
            break;
    
        case AppEvent::kEventType_AppEvent:
            if (NULL != aEvent->Handler)
            {
                aEvent->Handler(aEvent);
            }
            break;
    
        case AppEvent::kEventType_None:
        default:
            break;
        }
    }
    
    void AppTask::IdentifyStartHandler(::Identify *)
    {
        AppEvent event;
        event.Type = AppEvent::kEventType_IdentifyStart;
        sAppTask.PostEvent(&event);
    }
    
    void AppTask::IdentifyStopHandler(::Identify *)
    {
        AppEvent event;
        event.Type = AppEvent::kEventType_IdentifyStop;
        sAppTask.PostEvent(&event);
    }
    
    void AppTask::TriggerIdentifyEffectHandler(::Identify * identify)
    {
        switch (identify->mCurrentEffectIdentifier)
        {
        case Clusters::Identify::EffectIdentifierEnum::kBlink:
            PLAT_LOG("Starting blink identifier effect");
            IdentifyStartHandler(identify);
            break;
        case Clusters::Identify::EffectIdentifierEnum::kBreathe:
            PLAT_LOG("Breathe identifier effect not implemented");
            break;
        case Clusters::Identify::EffectIdentifierEnum::kOkay:
            PLAT_LOG("Okay identifier effect not implemented");
            break;
        case Clusters::Identify::EffectIdentifierEnum::kChannelChange:
            PLAT_LOG("Channel Change identifier effect not implemented");
            break;
        case Clusters::Identify::EffectIdentifierEnum::kFinishEffect:
            PLAT_LOG("Finish identifier effect not implemented");
            break;
        case Clusters::Identify::EffectIdentifierEnum::kStopEffect:
            PLAT_LOG("Stop identifier effect");
            IdentifyStopHandler(identify);
            break;
        default:
            PLAT_LOG("No identifier effect");
        }
    }

  • Thanks Corey.  Since it is not advised to call a pushbutton callback from another GPIO callback context, you could instead copy/paste the contents of ButtonRightEventHandler into the gpioInputFxn1 to accomplish the same purpose:

    void gpioInputFxn1(uint_least8_t index)
    {
    //	ButtonRightEventHandler((Button_Handle)0, Button_EV_CLICKED);
    
        AppEvent event;
        event.Type = AppEvent::kEventType_ButtonRight;
        event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked;
        // button callbacks are in ISR context
        if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS)
        {
            /* Failed to post the message */
        }
    }

    I've confirmed that this change builds successfully.

    Regards,
    Ryan