Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Wi-Fi] Enabled both the buttons for 917SoC 2.0 boards #141

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions matter/si91x/siwx917/BRD4338A/autogen/RTE_Components.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// This file is autogenerated by Simplicity Configuration Tools.
// The contents of this file will be replaced in their entirety upon regeneration.
//
// Source template file: RTE_Components.h.jinja


#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H

/* standard device header from emlib */
#define CMSIS_device_header "em_device.h"

/* components are auto-generated here */

#define RTE_RTOS_FreeRTOS_CORE

#define RTE_RTOS_FreeRTOS_CONFIG_RTOS2

#define RTE_RTOS_FreeRTOS_COROUTINE

#define RTE_RTOS_FreeRTOS_EVENTGROUPS

#define RTE_RTOS_FreeRTOS_TIMERS


#endif /* RTE_COMPONENTS_H */

/* This file is autogenerated by Simplicity Configuration Tools. */
/* The contents of this file will be replaced in their entirety upon regeneration. */
/* */
/* Source template file: RTE_Components.h.jinja */

39 changes: 39 additions & 0 deletions matter/si91x/siwx917/BRD4338A/autogen/sl_component_catalog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#ifndef SL_COMPONENT_CATALOG_H
#define SL_COMPONENT_CATALOG_H

// APIs present in project
#define SL_CATALOG_MATTER_ACCESS_CONTROL_PRESENT
#define SL_CATALOG_MATTER_ADMINISTRATOR_COMMISSIONING_PRESENT
#define SL_CATALOG_MATTER_BASIC_PRESENT
#define SL_CATALOG_MATTER_COLOR_CONTROL_PRESENT
#define SL_CATALOG_MATTER_DESCRIPTOR_PRESENT
#define SL_CATALOG_MATTER_DIAGNOSTIC_LOGS_PRESENT
#define SL_CATALOG_MATTER_ETHERNET_NETWORK_DIAGNOSTICS_PRESENT
#define SL_CATALOG_MATTER_FIXED_LABEL_PRESENT
#define SL_CATALOG_MATTER_GENERAL_COMMISSIONING_PRESENT
#define SL_CATALOG_MATTER_GENERAL_DIAGNOSTICS_PRESENT
#define SL_CATALOG_MATTER_GROUP_KEY_MGMT_PRESENT
#define SL_CATALOG_MATTER_GROUPS_PRESENT
#define SL_CATALOG_MATTER_IDENTIFY_PRESENT
#define SL_CATALOG_MATTER_LEVEL_CONTROL_PRESENT
#define SL_CATALOG_MATTER_LOCALIZATION_CONFIGURATION_PRESENT
#define SL_CATALOG_MATTER_NETWORK_COMMISSIONING_PRESENT
#define SL_CATALOG_MATTER_OCCUPANCY_SENSOR_PRESENT
#define SL_CATALOG_MATTER_ON_OFF_PRESENT
#define SL_CATALOG_MATTER_OPERATIONAL_CREDENTIALS_PRESENT
#define SL_CATALOG_MATTER_OTA_REQUESTOR_PRESENT
#define SL_CATALOG_MATTER_SOFTWARE_DIAGNOSTICS_PRESENT
#define SL_CATALOG_MATTER_SWITCH_PRESENT
#define SL_CATALOG_MATTER_THREAD_NETWORK_DIAGNOSTICS_PRESENT
#define SL_CATALOG_MATTER_TIME_FORMAT_LOCALIZATION_PRESENT
#define SL_CATALOG_MATTER_USER_LABEL_PRESENT
#define SL_CATALOG_MATTER_BLE_PRESENT
#define SL_CATALOG_MATTER_WIFI_NETWORK_DIAGNOSTICS_PRESENT
#define SL_CATALOG_CMSIS_OS_COMMON_PRESENT
#define SL_CATALOG_DEVICE_INIT_NVIC_PRESENT
#define SL_CATALOG_EMLIB_CORE_PRESENT
#define SL_CATALOG_EMLIB_CORE_DEBUG_CONFIG_PRESENT
#define SL_CATALOG_FREERTOS_KERNEL_PRESENT
#define SL_CATALOG_KERNEL_PRESENT

#endif // SL_COMPONENT_CATALOG_H
43 changes: 43 additions & 0 deletions matter/si91x/siwx917/BRD4338A/autogen/sl_event_handler.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include "sl_event_handler.h"

#include "rsi_chip.h"
#include "rsi_nvic_priorities_config.h"
#include "sl_device_init_nvic.h"
#include "sli_siwx917_soc.h"
#include "rsi_board.h"
#include "rsi_wisemcu_hardware_setup.h"
#include "cmsis_os2.h"

void sl_platform_init(void)
{
SystemCoreClockUpdate();
sl_si91x_device_init_nvic();
sl_device_init_nvic();
sli_si91x_platform_init();
RSI_Board_Init();
sl_si91x_hardware_setup();
osKernelInitialize();
}

void sl_kernel_start(void)
{
osKernelStart();
}

void sl_driver_init(void)
{
}

void sl_service_init(void)
{
DEBUGINIT();
}

void sl_stack_init(void)
{
}

void sl_internal_app_init(void)
{
}

11 changes: 11 additions & 0 deletions matter/si91x/siwx917/BRD4338A/autogen/sl_event_handler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef SL_EVENT_HANDLER_H
#define SL_EVENT_HANDLER_H

void sl_platform_init(void);
void sl_kernel_start(void);
void sl_driver_init(void);
void sl_service_init(void);
void sl_stack_init(void);
void sl_internal_app_init(void);

#endif // SL_EVENT_HANDLER_H
46 changes: 46 additions & 0 deletions matter/si91x/siwx917/BRD4338A/config/emlib_core_debug_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/***************************************************************************//**
* @file
* @brief emlib_core Configuration
*******************************************************************************
* # License
* <b>Copyright 2019 Silicon Laboratories Inc. www.silabs.com</b>
*******************************************************************************
*
* SPDX-License-Identifier: Zlib
*
* The licensor of this software is Silicon Laboratories Inc.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*
******************************************************************************/

#ifndef EM_CORE_DEBUG_CONFIG_H
#define EM_CORE_DEBUG_CONFIG_H

// <<< Use Configuration Wizard in Context Menu >>>

// <h> Core Configuration

// <q SL_EMLIB_CORE_ENABLE_INTERRUPT_DISABLED_TIMING> Enables measuring of interrupt disable time for debugging purposes.
// <i> Default: 0
// <i> If Enabled, either cycle_counter or systemview component must be added to project.
#define SL_EMLIB_CORE_ENABLE_INTERRUPT_DISABLED_TIMING 0

// </h>

// <<< end of configuration section >>>
#endif // EM_CORE_CONFIG_H
101 changes: 101 additions & 0 deletions matter/si91x/siwx917/BRD4338A/support/hal/rsi_hal_mcu_m4.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/*
*
* Copyright (c) 2022 Project CHIP Authors
*
* 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 "rsi_board.h"
#include "rsi_chip.h"
#include "rsi_m4.h"
#ifdef COMMON_FLASH_EN
#include "rsi_power_save.h"
#endif

#define BTN_RELEASED 0
#define BTN_PRESSED 1

#define PIN_INT 7
#ifndef M4_GPIO_PORT
#define M4_GPIO_PORT 0
#endif
#ifndef M4_GPIO_PIN
#define M4_GPIO_PIN (11U)
#endif

uint8_t gpio0 = 1;
uint8_t btn0 = 1;

void sl_button_on_change(uint8_t btn, uint8_t btnAction);

uint32_t NVIC_GetIRQEnable(IRQn_Type IRQn) {
return ((NVIC->ICER[((uint32_t)(IRQn) >> 5)] & (1 << ((uint32_t)(IRQn)&0x1F)))
? 1
: 0);
}

void rsi_assertion(uint16_t assertion_val, const char *string) {
uint16_t i;
if (assertion_val == 0) {
for (i = 0; i < strlen(string); i++) {
#ifdef DEBUG_UART
#ifdef DEBUG_ASSERTION
Board_UARTPutChar(string[i]);
#endif
#endif
}

return;
} else {
for (i = 0; i < strlen(string); i++) {
#ifdef DEBUG_UART
#ifdef DEBUG_ASSERTION
Board_UARTPutChar(string[i]);
#endif
#endif
}

while (1)
;
}
}

void IRQ059_Handler(void) {
// TODO: Replace with rsi_delay once that is fixed
for (int i = 0; i < 10000; i++)
__asm__("nop;");

RSI_EGPIO_IntClr(EGPIO, PIN_INT, INTERRUPT_STATUS_CLR);
RSI_EGPIO_GetPin(EGPIO, M4_GPIO_PORT, M4_GPIO_PIN)
? sl_button_on_change(1, BTN_RELEASED)
: sl_button_on_change(1, BTN_PRESSED);
}

void IRQ021_Handler(void) {
// TODO: Replace with rsi_delay once that is fixed
for (int i = 0; i < 10000; i++)
__asm__("nop;");
/* clear NPSS GPIO interrupt*/
RSI_NPSSGPIO_ClrIntr(NPSS_GPIO_2_INTR);
// if the btn is not pressed setting the state to 1
if (RSI_NPSSGPIO_GetPin(NPSS_GPIO_2) && (!btn0)) {
btn0 = 1;
sl_button_on_change(0, BTN_RELEASED);
}
// geting the state of the gpio 2 pin and checking if the btn is already
// pressed or not
if (!RSI_NPSSGPIO_GetPin(NPSS_GPIO_2) && btn0) {
btn0 = 0;
sl_button_on_change(0, BTN_PRESSED);
}
}
Loading