From fb6ca54096373a69c33ed578f06fdf0550bb1430 Mon Sep 17 00:00:00 2001 From: NikhitaR-IFX Date: Fri, 22 Aug 2025 12:51:01 +0530 Subject: [PATCH 1/7] psoc6: Extend modbluetooth from extmod. Signed-off-by: NikhitaR-IFX --- lib/mtb-psoc6-libs | 2 +- ports/psoc6/Makefile | 5 +- ports/psoc6/modbluetooth.c | 142 ++++++++++++++++++++++++++++--------- ports/psoc6/modbluetooth.h | 4 ++ ports/psoc6/mpconfigport.h | 4 ++ 5 files changed, 120 insertions(+), 37 deletions(-) diff --git a/lib/mtb-psoc6-libs b/lib/mtb-psoc6-libs index 4cd47fb603e4e..aa55b2e92117f 160000 --- a/lib/mtb-psoc6-libs +++ b/lib/mtb-psoc6-libs @@ -1 +1 @@ -Subproject commit 4cd47fb603e4e0000534fbbc7a854aff7ae2e977 +Subproject commit aa55b2e92117f7a2c41a35745849e6d91b842070 diff --git a/ports/psoc6/Makefile b/ports/psoc6/Makefile index 213f8c39f4860..72e6c791cfdb6 100644 --- a/ports/psoc6/Makefile +++ b/ports/psoc6/Makefile @@ -175,7 +175,7 @@ endif ifeq ($(MICROPY_PSOC6_BLUETOOTH),1) CFLAGS += -DMICROPY_PSOC6_BLUETOOTH=1 - MOD_SRC_C += modbluetooth.c + MOD_SRC_C += modbluetooth.c endif ifeq ($(MICROPY_PY_NETWORK_IFX_WCM),1) @@ -187,7 +187,8 @@ SRC_C = help.c \ main.c \ mphalport.c \ frozen_content.c \ - pins_$(BOARD).c + pins_$(BOARD).c \ + SRC_ASM += shared/runtime/gchelper_thumb1.s diff --git a/ports/psoc6/modbluetooth.c b/ports/psoc6/modbluetooth.c index ae6fbeb81af00..3a5f8ee5b7b34 100644 --- a/ports/psoc6/modbluetooth.c +++ b/ports/psoc6/modbluetooth.c @@ -10,55 +10,129 @@ #include "py/runtime.h" -#include "ble/cycfg_bt_settings.h" +#include "cycfg_bt_settings.h" #include "modbluetooth.h" -#if MICROPY_PSOC6_BLUETOOTH +#include "wiced_bt_stack.h" +#include "cybsp.h" +#include "cy_retarget_io.h" +#include +#include +#include +#include +#include "cybt_platform_trace.h" +#include "wiced_memory.h" +#include "cyhal.h" +#include "stdio.h" +#include "cycfg_gatt_db.h" +#include "cycfg_gap.h" +#include "wiced_bt_dev.h" +#include "cybsp_bt_config.h" + +#include "extmod/modbluetooth.h" + +// ****************************************************************************** +#if MICROPY_PY_BLUETOOTH +wiced_result_t app_bt_management_callback(wiced_bt_management_evt_t event, + wiced_bt_management_evt_data_t *p_event_data) { + + return WICED_BT_SUCCESS; -// ---------------------------------------------------------------------------- -// Bluetooth object: General -// ---------------------------------------------------------------------------- +} + +// extern const cybt_platform_config_t cybsp_bt_platform_cfg; +int mp_bluetooth_init(void) { + // Initialize the Bluetooth hardware and stack. + mp_printf(&mp_plat_print, "mp_bluetooth_init invoked \n"); -static const mp_obj_type_t mp_type_bluetooth_ble; + return 0; // Return 0 on success. + +} -static mp_obj_t bluetooth_ble_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - mp_printf(&mp_plat_print, "To be implemented\n"); - return mp_const_none; +int mp_bluetooth_deinit() { + return 0; } +// Returns true when the Bluetooth stack is active. +bool mp_bluetooth_is_active(void) { + return false; +} + +// Gets the current address of this device in big-endian format. +void mp_bluetooth_get_current_address(uint8_t *addr_type, uint8_t *addr) { + +} + +// Sets the addressing mode to use. +void mp_bluetooth_set_address_mode(uint8_t addr_mode) { + +} + +// Get or set the GAP device name that will be used by service 0x1800, characteristic 0x2a00. +size_t mp_bluetooth_gap_get_device_name(const uint8_t **buf) { + return 0; +} -// ---------------------------------------------------------------------------- -// Bluetooth object: Definition -// ---------------------------------------------------------------------------- +int mp_bluetooth_gap_set_device_name(const uint8_t *buf, size_t len) { + return 0; +} -static const mp_rom_map_elem_t bluetooth_ble_locals_dict_table[] = { - // General -}; -static MP_DEFINE_CONST_DICT(bluetooth_ble_locals_dict, bluetooth_ble_locals_dict_table); +// Start advertisement. Will re-start advertisement when already enabled. +// Returns errno on failure. +int mp_bluetooth_gap_advertise_start(bool connectable, int32_t interval_us, const uint8_t *adv_data, size_t adv_data_len, const uint8_t *sr_data, size_t sr_data_len) { + return 0; +} -static MP_DEFINE_CONST_OBJ_TYPE( - mp_type_bluetooth_ble, - MP_QSTR_BLE, - MP_TYPE_FLAG_NONE, - make_new, bluetooth_ble_make_new, - locals_dict, &bluetooth_ble_locals_dict - ); +// Stop advertisement. No-op when already stopped. +void mp_bluetooth_gap_advertise_stop(void) { + return; +} +// Start adding services. Must be called before mp_bluetooth_register_service. +int mp_bluetooth_gatts_register_service_begin(bool append) { + return 0; +} +// Add a service with the given list of characteristics to the queue to be registered. +// The value_handles won't be valid until after mp_bluetooth_register_service_end is called. +int mp_bluetooth_gatts_register_service(mp_obj_bluetooth_uuid_t *service_uuid, mp_obj_bluetooth_uuid_t **characteristic_uuids, uint16_t *characteristic_flags, mp_obj_bluetooth_uuid_t **descriptor_uuids, uint16_t *descriptor_flags, uint8_t *num_descriptors, uint16_t *handles, size_t num_characteristics) { + return 0; +} +// Register any queued services. +int mp_bluetooth_gatts_register_service_end(void) { + return 0; +} -static const mp_rom_map_elem_t mp_module_bluetooth_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_bluetooth) }, - { MP_ROM_QSTR(MP_QSTR_BLE), MP_ROM_PTR(&mp_type_bluetooth_ble) }, -}; +// Read the value from the local gatts db (likely this has been written by a central). +int mp_bluetooth_gatts_read(uint16_t value_handle, const uint8_t **value, size_t *value_len) { + return 0; +} +// Write a value to the local gatts db (ready to be queried by a central). Optionally send notifications/indications. +int mp_bluetooth_gatts_write(uint16_t value_handle, const uint8_t *value, size_t value_len, bool send_update) { + return 0; +} +// Send a notification/indication to the central, optionally with custom payload (otherwise the DB value is used). +int mp_bluetooth_gatts_notify_indicate(uint16_t conn_handle, uint16_t value_handle, int gatts_op, const uint8_t *value, size_t value_len) { + return 0; +} -static MP_DEFINE_CONST_DICT(mp_module_bluetooth_globals, mp_module_bluetooth_globals_table); +// Resize and enable/disable append-mode on a value. +// Append-mode means that remote writes will append and local reads will clear after reading. +int mp_bluetooth_gatts_set_buffer(uint16_t value_handle, size_t len, bool append) { + return 0; +} -const mp_obj_module_t mp_module_bluetooth = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&mp_module_bluetooth_globals, -}; +// Disconnect from a central or peripheral. +int mp_bluetooth_gap_disconnect(uint16_t conn_handle) { + return 0; +} -MP_REGISTER_EXTENSIBLE_MODULE(MP_QSTR_bluetooth, mp_module_bluetooth); +// Set/get the MTU that we will respond to a MTU exchange with. +int mp_bluetooth_get_preferred_mtu(void) { + return 0; +} -MP_REGISTER_ROOT_POINTER(mp_obj_t bluetooth); +int mp_bluetooth_set_preferred_mtu(uint16_t mtu) { + return 0; +} #endif diff --git a/ports/psoc6/modbluetooth.h b/ports/psoc6/modbluetooth.h index 9a32ae74c944c..7a26a1ca57d2e 100644 --- a/ports/psoc6/modbluetooth.h +++ b/ports/psoc6/modbluetooth.h @@ -7,6 +7,10 @@ #include "py/objlist.h" #include "py/ringbuf.h" +#define bluetooth_assert_raise_val(msg, ret) if (ret != CY_RSLT_SUCCESS) { \ + mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT(msg), ret); \ +} + // Port specific configuration. #ifndef MICROPY_PY_BLUETOOTH_RINGBUF_SIZE #define MICROPY_PY_BLUETOOTH_RINGBUF_SIZE (128) diff --git a/ports/psoc6/mpconfigport.h b/ports/psoc6/mpconfigport.h index ad6c4ba2dcac0..f01cea5171336 100644 --- a/ports/psoc6/mpconfigport.h +++ b/ports/psoc6/mpconfigport.h @@ -193,6 +193,10 @@ extern const struct _mp_obj_type_t mp_network_ifx_wcm_type; #endif +// BLE defines +#define MICROPY_PY_BLUETOOTH (1) + + // Miscellaneous settings #define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p) | 1)) From 5006e96d7ad78e5ce0f04a0438b05aff0f7397e9 Mon Sep 17 00:00:00 2001 From: NikhitaR-IFX Date: Fri, 22 Aug 2025 13:09:32 +0530 Subject: [PATCH 2/7] psoc6/mpconfigport: Enable macro board specific. Signed-off-by: NikhitaR-IFX --- ports/psoc6/mpconfigport.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/psoc6/mpconfigport.h b/ports/psoc6/mpconfigport.h index f01cea5171336..deacb8ae136e8 100644 --- a/ports/psoc6/mpconfigport.h +++ b/ports/psoc6/mpconfigport.h @@ -194,7 +194,9 @@ extern const struct _mp_obj_type_t mp_network_ifx_wcm_type; #endif // BLE defines +#if MICROPY_PSOC6_BLUETOOTH #define MICROPY_PY_BLUETOOTH (1) +#endif // Miscellaneous settings From ffe7e480487df66cd100cb490f696928459cc4d6 Mon Sep 17 00:00:00 2001 From: NikhitaR-IFX Date: Mon, 25 Aug 2025 17:00:14 +0530 Subject: [PATCH 3/7] psoc6: Fix extmod extension for ble. Signed-off-by: NikhitaR-IFX --- extmod/extmod.mk | 2 + ports/psoc6/Makefile | 12 +- ports/psoc6/ble/cycfg_bt.timestamp | 25 - ports/psoc6/ble/cycfg_bt_settings.c | 243 ---------- ports/psoc6/ble/cycfg_bt_settings.h | 38 -- ports/psoc6/ble/cycfg_gap.c | 58 --- ports/psoc6/ble/cycfg_gap.h | 142 ------ ports/psoc6/ble/cycfg_gatt_db.c | 148 ------ ports/psoc6/ble/cycfg_gatt_db.h | 96 ---- ports/psoc6/ble/design.cybt | 434 ++++++++++++++++++ .../boards/CY8CKIT-062S2-AI/mpconfigboard.mk | 3 +- .../CY8CPROTO-062-4343W/mpconfigboard.mk | 3 +- .../boards/CY8CPROTO-063-BLE/mpconfigboard.mk | 3 +- ports/psoc6/mpconfigport.h | 5 - 14 files changed, 451 insertions(+), 761 deletions(-) delete mode 100644 ports/psoc6/ble/cycfg_bt.timestamp delete mode 100644 ports/psoc6/ble/cycfg_bt_settings.c delete mode 100644 ports/psoc6/ble/cycfg_bt_settings.h delete mode 100644 ports/psoc6/ble/cycfg_gap.c delete mode 100644 ports/psoc6/ble/cycfg_gap.h delete mode 100644 ports/psoc6/ble/cycfg_gatt_db.c delete mode 100644 ports/psoc6/ble/cycfg_gatt_db.h create mode 100644 ports/psoc6/ble/design.cybt diff --git a/extmod/extmod.mk b/extmod/extmod.mk index 37151ad120e68..bd3dbd657e16a 100644 --- a/extmod/extmod.mk +++ b/extmod/extmod.mk @@ -545,9 +545,11 @@ endif ifneq ($(MICROPY_BLUETOOTH_NIMBLE),1) ifneq ($(MICROPY_BLUETOOTH_BTSTACK),1) +ifneq ($(MICROPY_BLUETOOTH_PORT_BTSTACK),1) $(error Must enable one of MICROPY_BLUETOOTH_NIMBLE or MICROPY_BLUETOOTH_BTSTACK) endif endif +endif ifeq ($(MICROPY_BLUETOOTH_NIMBLE),1) include $(TOP)/extmod/nimble/nimble.mk diff --git a/ports/psoc6/Makefile b/ports/psoc6/Makefile index 72e6c791cfdb6..5e87b799d8632 100644 --- a/ports/psoc6/Makefile +++ b/ports/psoc6/Makefile @@ -173,8 +173,8 @@ ifeq ($(MICROPY_PY_SD_CARD),1) MOD_SRC_C += machine_sdcard.c endif -ifeq ($(MICROPY_PSOC6_BLUETOOTH),1) - CFLAGS += -DMICROPY_PSOC6_BLUETOOTH=1 +ifeq ($(MICROPY_PY_BLUETOOTH),1) + CFLAGS += -DMICROPY_PY_BLUETOOTH=1 MOD_SRC_C += modbluetooth.c endif @@ -228,9 +228,15 @@ $(BUILD)/firmware.hex: $(BUILD)/firmware.elf MPY_CROSS_FLAGS += -march=armv7m +ifeq ($(MICROPY_PY_BLUETOOTH),1) +.PHONY: ble +ble: + $(Q) cp ble/design.cybt $(MTB_LIBS_DIR) +endif + build: mtb_get_build_flags $(GENERATED_PINS) $(BUILD)/firmware.hex -all: build +all: ble build clean: mtb_clean diff --git a/ports/psoc6/ble/cycfg_bt.timestamp b/ports/psoc6/ble/cycfg_bt.timestamp deleted file mode 100644 index ac448c4f8ae38..0000000000000 --- a/ports/psoc6/ble/cycfg_bt.timestamp +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * File Name: cycfg_bt.timestamp - * - * Description: - * Sentinel file for determining if generated source is up to date. - * This file was automatically generated and should not be modified. - * Bluetooth Configurator 3.30.0.3160 - * - ******************************************************************************* - * Copyright 2025 Cypress Semiconductor Corporation (an Infineon company) or - * an affiliate of Cypress Semiconductor Corporation. - * SPDX-License-Identifier: Apache-2.0 - * - * 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. - ******************************************************************************/ diff --git a/ports/psoc6/ble/cycfg_bt_settings.c b/ports/psoc6/ble/cycfg_bt_settings.c deleted file mode 100644 index 6828d0c171337..0000000000000 --- a/ports/psoc6/ble/cycfg_bt_settings.c +++ /dev/null @@ -1,243 +0,0 @@ -/***************************************************************************//** -* File Name: cycfg_bt_settings.c -* -* Description: -* Runtime Bluetooth stack configuration parameters. -* This file should not be modified. It was automatically generated by -* Bluetooth Configurator 3.30.0.3160 -* -******************************************************************************** -* Copyright 2025 Cypress Semiconductor Corporation (an Infineon company) or -* an affiliate of Cypress Semiconductor Corporation. -* SPDX-License-Identifier: Apache-2.0 -* -* 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 "cycfg_bt_settings.h" -#include "cycfg_gap.h" - -#include "wiced_bt_dev.h" -#include "wiced_bt_gatt.h" -#include "wiced_bt_cfg.h" - -#if !defined(WICED_BTSTACK_VERSION_MAJOR) - #define WICED_BTSTACK_VERSION_MAJOR (2) -#endif - -/***************************************************************************** - * wiced_bt core stack configuration - ****************************************************************************/ -#if (WICED_BTSTACK_VERSION_MAJOR >= 3) -/* LE scan settings */ -const wiced_bt_cfg_ble_scan_settings_t cy_bt_cfg_scan_settings = -{ - .scan_mode = CY_BT_SCAN_MODE, /* LE scan mode (BTM_BLE_SCAN_MODE_PASSIVE, BTM_BLE_SCAN_MODE_ACTIVE, or BTM_BLE_SCAN_MODE_NONE) */ - - /* Advertisement scan configuration */ - .high_duty_scan_interval = CY_BT_HIGH_DUTY_SCAN_INTERVAL, /* High duty scan interval (in slots (1 slot = 0.625 ms)) */ - .high_duty_scan_window = CY_BT_HIGH_DUTY_SCAN_WINDOW, /* High duty scan window (in slots (1 slot = 0.625 ms)) */ - .high_duty_scan_duration = CY_BT_HIGH_DUTY_SCAN_DURATION, /* High duty scan duration in seconds (0 for infinite) */ - - .low_duty_scan_interval = CY_BT_LOW_DUTY_SCAN_INTERVAL, /* Low duty scan interval (in slots (1 slot = 0.625 ms)) */ - .low_duty_scan_window = CY_BT_LOW_DUTY_SCAN_WINDOW, /* Low duty scan window (in slots (1 slot = 0.625 ms)) */ - .low_duty_scan_duration = CY_BT_LOW_DUTY_SCAN_DURATION, /* Low duty scan duration in seconds (0 for infinite) */ - - /* Connection scan configuration */ - .high_duty_conn_scan_interval = CY_BT_HIGH_DUTY_CONN_SCAN_INTERVAL, /* High duty cycle connection scan interval (in slots (1 slot = 0.625 ms)) */ - .high_duty_conn_scan_window = CY_BT_HIGH_DUTY_CONN_SCAN_WINDOW, /* High duty cycle connection scan window (in slots (1 slot = 0.625 ms)) */ - .high_duty_conn_duration = CY_BT_HIGH_DUTY_CONN_SCAN_DURATION, /* High duty cycle connection duration in seconds (0 for infinite) */ - - .low_duty_conn_scan_interval = CY_BT_LOW_DUTY_CONN_SCAN_INTERVAL, /* Low duty cycle connection scan interval (in slots (1 slot = 0.625 ms)) */ - .low_duty_conn_scan_window = CY_BT_LOW_DUTY_CONN_SCAN_WINDOW, /* Low duty cycle connection scan window (in slots (1 slot = 0.625 ms)) */ - .low_duty_conn_duration = CY_BT_LOW_DUTY_CONN_SCAN_DURATION, /* Low duty cycle connection duration in seconds (0 for infinite) */ - - /* Connection configuration */ - .conn_min_interval = CY_BT_CONN_MIN_INTERVAL, /* Minimum connection interval (in slots (1 slot = 1.25 ms)) */ - .conn_max_interval = CY_BT_CONN_MAX_INTERVAL, /* Maximum connection interval (in slots (1 slot = 1.25 ms)) */ - .conn_latency = CY_BT_CONN_LATENCY, /* Connection latency */ - .conn_supervision_timeout = CY_BT_CONN_SUPERVISION_TIMEOUT, /* Connection link supervision timeout (in 10 ms) */ -}; - -/* LE advertisement settings */ -const wiced_bt_cfg_ble_advert_settings_t cy_bt_cfg_adv_settings = -{ - .channel_map = CY_BT_CHANNEL_MAP, /* Advertising channel map (mask of BTM_BLE_ADVERT_CHNL_37, BTM_BLE_ADVERT_CHNL_38, BTM_BLE_ADVERT_CHNL_39) */ - - .high_duty_min_interval = CY_BT_HIGH_DUTY_ADV_MIN_INTERVAL, /* High duty undirected connectable minimum advertising interval (in slots (1 slot = 0.625 ms)) */ - .high_duty_max_interval = CY_BT_HIGH_DUTY_ADV_MAX_INTERVAL, /* High duty undirected connectable maximum advertising interval (in slots (1 slot = 0.625 ms)) */ - .high_duty_duration = CY_BT_HIGH_DUTY_ADV_DURATION, /* High duty undirected connectable advertising duration in seconds (0 for infinite) */ - - .low_duty_min_interval = CY_BT_LOW_DUTY_ADV_MIN_INTERVAL, /* Low duty undirected connectable minimum advertising interval (in slots (1 slot = 0.625 ms)) */ - .low_duty_max_interval = CY_BT_LOW_DUTY_ADV_MAX_INTERVAL, /* Low duty undirected connectable maximum advertising interval (in slots (1 slot = 0.625 ms)) */ - .low_duty_duration = CY_BT_LOW_DUTY_ADV_DURATION, /* Low duty undirected connectable advertising duration in seconds (0 for infinite) */ - - .high_duty_directed_min_interval = CY_BT_HIGH_DUTY_DIRECTED_ADV_MIN_INTERVAL, /* High duty directed connectable minimum advertising interval (in slots (1 slot = 0.625 ms)) */ - .high_duty_directed_max_interval = CY_BT_HIGH_DUTY_DIRECTED_ADV_MAX_INTERVAL, /* High duty directed connectable maximum advertising interval (in slots (1 slot = 0.625 ms)) */ - - .low_duty_directed_min_interval = CY_BT_LOW_DUTY_DIRECTED_ADV_MIN_INTERVAL, /* Low duty directed connectable minimum advertising interval (in slots (1 slot = 0.625 ms)) */ - .low_duty_directed_max_interval = CY_BT_LOW_DUTY_DIRECTED_ADV_MAX_INTERVAL, /* Low duty directed connectable maximum advertising interval (in slots (1 slot = 0.625 ms)) */ - .low_duty_directed_duration = CY_BT_LOW_DUTY_DIRECTED_ADV_DURATION, /* Low duty directed connectable advertising duration in seconds (0 for infinite) */ - - .high_duty_nonconn_min_interval = CY_BT_HIGH_DUTY_NONCONN_ADV_MIN_INTERVAL, /* High duty non-connectable minimum advertising interval (in slots (1 slot = 0.625 ms)) */ - .high_duty_nonconn_max_interval = CY_BT_HIGH_DUTY_NONCONN_ADV_MAX_INTERVAL, /* High duty non-connectable maximum advertising interval (in slots (1 slot = 0.625 ms)) */ - .high_duty_nonconn_duration = CY_BT_HIGH_DUTY_NONCONN_ADV_DURATION, /* High duty non-connectable advertising duration in seconds (0 for infinite) */ - - .low_duty_nonconn_min_interval = CY_BT_LOW_DUTY_NONCONN_ADV_MIN_INTERVAL, /* Low duty non-connectable minimum advertising interval (in slots (1 slot = 0.625 ms)) */ - .low_duty_nonconn_max_interval = CY_BT_LOW_DUTY_NONCONN_ADV_MAX_INTERVAL, /* Low duty non-connectable maximum advertising interval (in slots (1 slot = 0.625 ms)) */ - .low_duty_nonconn_duration = CY_BT_LOW_DUTY_NONCONN_ADV_DURATION /* Low duty non-connectable advertising duration in seconds (0 for infinite) */ -}; - -/* LE configuration settings */ -const wiced_bt_cfg_ble_t cy_bt_cfg_ble = -{ - .ble_max_simultaneous_links = (CY_BT_CLIENT_MAX_LINKS + CY_BT_SERVER_MAX_LINKS), /* Max number for simultaneous connections for a layer, profile, protocol */ - .ble_max_rx_pdu_size = CY_BT_RX_PDU_SIZE, /* Maximum size allowed for any received L2CAP PDU - * Minimum value - 65 (to support SM) - * Maximum GATT MTU over legacy bearers shall be set to <= this value - * Maximum MPS for EATT channels shall be set to <= this value */ - .appearance = CY_BT_APPEARANCE, /* GATT appearance (see gatt_appearance_e) */ - .rpa_refresh_timeout = CY_BT_RPA_TIMEOUT, /* Interval of random address refreshing - secs */ - .host_addr_resolution_db_size = 5, /* LE Address Resolution DB settings - effective only for pre 4.2 controller */ - .p_ble_scan_cfg = &cy_bt_cfg_scan_settings, /* LE scan settings */ - .p_ble_advert_cfg = &cy_bt_cfg_adv_settings, /* LE advertisement settings */ - .default_ble_power_level = CY_BT_TX_POWER, /* Default LE power level, Refer lm_TxPwrTable table for the power range */ -}; - -/* GATT settings */ -const wiced_bt_cfg_gatt_t cy_bt_cfg_gatt = -{ - .max_db_service_modules = 0, /* Maximum number of service modules in the DB */ - .max_eatt_bearers = 0, /* Maximum number of allowed gatt bearers */ -}; - -/* Bluetooth stack configuration */ -const wiced_bt_cfg_settings_t wiced_bt_cfg_settings = -{ - .device_name = (uint8_t *)app_gap_device_name, /* Local device name (NULL terminated) */ - .security_required = CY_BT_SECURITY_LEVEL, /* BTM_SEC_BEST_EFFORT is recommended choice for most applications, - * to connect to the widest range of devices. Allows stack to choose - * the highest level of security possible between the two devices */ - .p_ble_cfg = &cy_bt_cfg_ble, /* LE related configuration */ - .p_gatt_cfg = &cy_bt_cfg_gatt, /* GATT settings */ -}; -#else -/* Bluetooth stack configuration */ -const wiced_bt_cfg_settings_t wiced_bt_cfg_settings = -{ - .device_name = (uint8_t *)app_gap_device_name, /* Local device name (NULL terminated) */ - .device_class = {0x00, 0x00, 0x00}, /* Local device class */ - .security_requirement_mask = BTM_SEC_NONE, /* Security requirements mask (BTM_SEC_NONE, or combination of BTM_SEC_IN_AUTHENTICATE, BTM_SEC_OUT_AUTHENTICATE, BTM_SEC_ENCRYPT (see #wiced_bt_sec_level_e)) */ - - .max_simultaneous_links = (CY_BT_CLIENT_MAX_LINKS + CY_BT_SERVER_MAX_LINKS), /* Maximum number simultaneous links to different devices */ - - /* LE scan settings */ - .ble_scan_cfg = - { - .scan_mode = CY_BT_SCAN_MODE, /* LE scan mode (BTM_BLE_SCAN_MODE_PASSIVE, BTM_BLE_SCAN_MODE_ACTIVE, or BTM_BLE_SCAN_MODE_NONE) */ - - /* Advertisement scan configuration */ - .high_duty_scan_interval = CY_BT_HIGH_DUTY_SCAN_INTERVAL, /* High duty scan interval (in slots (1 slot = 0.625 ms)) */ - .high_duty_scan_window = CY_BT_HIGH_DUTY_SCAN_WINDOW, /* High duty scan window (in slots (1 slot = 0.625 ms)) */ - .high_duty_scan_duration = CY_BT_HIGH_DUTY_SCAN_DURATION, /* High duty scan duration in seconds (0 for infinite) */ - - .low_duty_scan_interval = CY_BT_LOW_DUTY_SCAN_INTERVAL, /* Low duty scan interval (in slots (1 slot = 0.625 ms)) */ - .low_duty_scan_window = CY_BT_LOW_DUTY_SCAN_WINDOW, /* Low duty scan window (in slots (1 slot = 0.625 ms)) */ - .low_duty_scan_duration = CY_BT_LOW_DUTY_SCAN_DURATION, /* Low duty scan duration in seconds (0 for infinite) */ - - /* Connection scan configuration */ - .high_duty_conn_scan_interval = CY_BT_HIGH_DUTY_CONN_SCAN_INTERVAL, /* High duty cycle connection scan interval (in slots (1 slot = 0.625 ms)) */ - .high_duty_conn_scan_window = CY_BT_HIGH_DUTY_CONN_SCAN_WINDOW, /* High duty cycle connection scan window (in slots (1 slot = 0.625 ms)) */ - .high_duty_conn_duration = CY_BT_HIGH_DUTY_CONN_SCAN_DURATION, /* High duty cycle connection duration in seconds (0 for infinite) */ - - .low_duty_conn_scan_interval = CY_BT_LOW_DUTY_CONN_SCAN_INTERVAL, /* Low duty cycle connection scan interval (in slots (1 slot = 0.625 ms)) */ - .low_duty_conn_scan_window = CY_BT_LOW_DUTY_CONN_SCAN_WINDOW, /* Low duty cycle connection scan window (in slots (1 slot = 0.625 ms)) */ - .low_duty_conn_duration = CY_BT_LOW_DUTY_CONN_SCAN_DURATION, /* Low duty cycle connection duration in seconds (0 for infinite) */ - - /* Connection configuration */ - .conn_min_interval = CY_BT_CONN_MIN_INTERVAL, /* Minimum connection interval (in slots (1 slot = 1.25 ms)) */ - .conn_max_interval = CY_BT_CONN_MAX_INTERVAL, /* Maximum connection interval (in slots (1 slot = 1.25 ms)) */ - .conn_latency = CY_BT_CONN_LATENCY, /* Connection latency */ - .conn_supervision_timeout = CY_BT_CONN_SUPERVISION_TIMEOUT, /* Connection link supervision timeout (in 10 ms) */ - }, - - /* LE advertisement settings */ - .ble_advert_cfg = - { - .channel_map = CY_BT_CHANNEL_MAP, /* Advertising channel map (mask of BTM_BLE_ADVERT_CHNL_37, BTM_BLE_ADVERT_CHNL_38, BTM_BLE_ADVERT_CHNL_39) */ - - .high_duty_min_interval = CY_BT_HIGH_DUTY_ADV_MIN_INTERVAL, /* High duty undirected connectable minimum advertising interval (in slots (1 slot = 0.625 ms)) */ - .high_duty_max_interval = CY_BT_HIGH_DUTY_ADV_MAX_INTERVAL, /* High duty undirected connectable maximum advertising interval (in slots (1 slot = 0.625 ms)) */ - .high_duty_duration = CY_BT_HIGH_DUTY_ADV_DURATION, /* High duty undirected connectable advertising duration in seconds (0 for infinite) */ - - .low_duty_min_interval = CY_BT_LOW_DUTY_ADV_MIN_INTERVAL, /* Low duty undirected connectable minimum advertising interval (in slots (1 slot = 0.625 ms)) */ - .low_duty_max_interval = CY_BT_LOW_DUTY_ADV_MAX_INTERVAL, /* Low duty undirected connectable maximum advertising interval (in slots (1 slot = 0.625 ms)) */ - .low_duty_duration = CY_BT_LOW_DUTY_ADV_DURATION, /* Low duty undirected connectable advertising duration in seconds (0 for infinite) */ - - .high_duty_directed_min_interval = CY_BT_HIGH_DUTY_DIRECTED_ADV_MIN_INTERVAL, /* High duty directed connectable minimum advertising interval (in slots (1 slot = 0.625 ms)) */ - .high_duty_directed_max_interval = CY_BT_HIGH_DUTY_DIRECTED_ADV_MAX_INTERVAL, /* High duty directed connectable maximum advertising interval (in slots (1 slot = 0.625 ms)) */ - - .low_duty_directed_min_interval = CY_BT_LOW_DUTY_DIRECTED_ADV_MIN_INTERVAL, /* Low duty directed connectable minimum advertising interval (in slots (1 slot = 0.625 ms)) */ - .low_duty_directed_max_interval = CY_BT_LOW_DUTY_DIRECTED_ADV_MAX_INTERVAL, /* Low duty directed connectable maximum advertising interval (in slots (1 slot = 0.625 ms)) */ - .low_duty_directed_duration = CY_BT_LOW_DUTY_DIRECTED_ADV_DURATION, /* Low duty directed connectable advertising duration in seconds (0 for infinite) */ - - .high_duty_nonconn_min_interval = CY_BT_HIGH_DUTY_NONCONN_ADV_MIN_INTERVAL, /* High duty non-connectable minimum advertising interval (in slots (1 slot = 0.625 ms)) */ - .high_duty_nonconn_max_interval = CY_BT_HIGH_DUTY_NONCONN_ADV_MAX_INTERVAL, /* High duty non-connectable maximum advertising interval (in slots (1 slot = 0.625 ms)) */ - .high_duty_nonconn_duration = CY_BT_HIGH_DUTY_NONCONN_ADV_DURATION, /* High duty non-connectable advertising duration in seconds (0 for infinite) */ - - .low_duty_nonconn_min_interval = CY_BT_LOW_DUTY_NONCONN_ADV_MIN_INTERVAL, /* Low duty non-connectable minimum advertising interval (in slots (1 slot = 0.625 ms)) */ - .low_duty_nonconn_max_interval = CY_BT_LOW_DUTY_NONCONN_ADV_MAX_INTERVAL, /* Low duty non-connectable maximum advertising interval (in slots (1 slot = 0.625 ms)) */ - .low_duty_nonconn_duration = CY_BT_LOW_DUTY_NONCONN_ADV_DURATION /* Low duty non-connectable advertising duration in seconds (0 for infinite) */ - }, - - /* GATT configuration */ - .gatt_cfg = - { - .appearance = CY_BT_APPEARANCE, /* GATT appearance (see gatt_appearance_e) */ - .client_max_links = CY_BT_CLIENT_MAX_LINKS, /* Client config: maximum number of servers that local client can connect to */ - .server_max_links = CY_BT_SERVER_MAX_LINKS, /* Server config: maximum number of remote clients connections allowed by the local */ - .max_attr_len = CY_BT_MAX_ATTR_LEN, /* Maximum attribute length; gki_cfg must have a corresponding buffer pool that can hold this length */ - .max_mtu_size = CY_BT_MTU_SIZE /* Maximum MTU size for GATT connections, should be between 23 and (max_attr_len + 5) */ - }, - - /* RFCOMM configuration */ - .rfcomm_cfg = - { - .max_links = 0, /* Maximum number of simultaneous connected remote devices */ - .max_ports = 0 /* Maximum number of simultaneous RFCOMM ports */ - }, - - /* Application-managed L2CAP protocol configuration */ - .l2cap_application = - { - .max_links = 0, /* Maximum number of application-managed l2cap links (BR/EDR and LE) */ - - /* BR/EDR l2cap configuration */ - .max_psm = 0, /* Maximum number of application-managed BR/EDR PSMs */ - .max_channels = 0, /* Maximum number of application-managed BR/EDR channels */ - - /* LE L2cap connection-oriented channels configuration */ - .max_le_psm = CY_BT_L2CAP_MAX_LE_PSM, /* Maximum number of application-managed LE PSMs */ - .max_le_channels = CY_BT_L2CAP_MAX_LE_CHANNELS, /* Maximum number of application-managed LE channels */ - /* LE L2cap fixed channel configuration */ - .max_le_l2cap_fixed_channels = 0, /* Maximum number of application-managed fixed channels supported (in addition to mandatory channels 4, 5 and 6) */ - .max_rx_mtu = CY_BT_L2CAP_MTU_SIZE /* Maximum RX MTU allowed */ - }, - - .addr_resolution_db_size = 5, /* LE Address Resolution DB settings - effective only for pre 4.2 controller */ - .rpa_refresh_timeout = CY_BT_RPA_TIMEOUT, /* Interval of random address refreshing - secs */ - .stack_scratch_size = WICED_BT_CFG_DEFAULT_STACK_SCRATCH_SIZE, /* Memory area reserved for the stack transient memory requirements */ - .ble_white_list_size = CY_BT_FILTER_ACCEPT_LIST_SIZE, /* Maximum number of filter accept list devices allowed. Cannot be more than 128 */ - .default_ble_power_level = CY_BT_TX_POWER /* Default LE power level */ -}; -#endif diff --git a/ports/psoc6/ble/cycfg_bt_settings.h b/ports/psoc6/ble/cycfg_bt_settings.h deleted file mode 100644 index 7e8dae2057ce5..0000000000000 --- a/ports/psoc6/ble/cycfg_bt_settings.h +++ /dev/null @@ -1,38 +0,0 @@ -/***************************************************************************//** -* File Name: cycfg_bt_settings.h -* -* Description: -* Bluetooth Configurator configuration. -* This file should not be modified. It was automatically generated by -* Bluetooth Configurator 3.30.0.3160 -* -******************************************************************************** -* Copyright 2025 Cypress Semiconductor Corporation (an Infineon company) or -* an affiliate of Cypress Semiconductor Corporation. -* SPDX-License-Identifier: Apache-2.0 -* -* 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. -*******************************************************************************/ - -#if !defined(CYCFG_BT_SETTINGS_H) -#define CYCFG_BT_SETTINGS_H - -#include "wiced_bt_cfg.h" -#include "wiced_bt_ble.h" -#include "wiced_bt_constants.h" - -extern const wiced_bt_cfg_settings_t wiced_bt_cfg_settings; - -#endif /* CYCFG_BT_SETTINGS_H */ - -/* [] END OF FILE */ diff --git a/ports/psoc6/ble/cycfg_gap.c b/ports/psoc6/ble/cycfg_gap.c deleted file mode 100644 index 67f07c40087a4..0000000000000 --- a/ports/psoc6/ble/cycfg_gap.c +++ /dev/null @@ -1,58 +0,0 @@ -/***************************************************************************//** -* File Name: cycfg_gap.c -* -* Description: -* BLE device's GAP configuration. -* This file should not be modified. It was automatically generated by -* Bluetooth Configurator 3.30.0.3160 -* -******************************************************************************** -* Copyright 2025 Cypress Semiconductor Corporation (an Infineon company) or -* an affiliate of Cypress Semiconductor Corporation. -* SPDX-License-Identifier: Apache-2.0 -* -* 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 "cycfg_gap.h" - -/* Device address */ -wiced_bt_device_address_t cy_bt_device_address = {0x43, 0x01, 0x2C, 0x00, 0x1F, 0xAC}; - -const uint8_t cy_bt_adv_packet_elem_0[1] = { 0x06 }; -const uint8_t cy_bt_adv_packet_elem_1[14] = { 0x46, 0x69, 0x6E, 0x64, 0x20, 0x4D, 0x65, 0x20, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74 }; -wiced_bt_ble_advert_elem_t cy_bt_adv_packet_data[] = -{ - /* Flags */ - { - .advert_type = BTM_BLE_ADVERT_TYPE_FLAG, - .len = 1, - .p_data = (uint8_t *)cy_bt_adv_packet_elem_0, - }, - /* Complete local name */ - { - .advert_type = BTM_BLE_ADVERT_TYPE_NAME_COMPLETE, - .len = 14, - .p_data = (uint8_t *)cy_bt_adv_packet_elem_1, - }, -}; -const uint8_t cy_bt_scan_resp_packet_elem_0[2] = { 0x02, 0x18 }; -wiced_bt_ble_advert_elem_t cy_bt_scan_resp_packet_data[] = -{ - /* Complete list of 16-bit UUIDs available */ - { - .advert_type = BTM_BLE_ADVERT_TYPE_16SRV_COMPLETE, - .len = 2, - .p_data = (uint8_t *)cy_bt_scan_resp_packet_elem_0, - }, -}; diff --git a/ports/psoc6/ble/cycfg_gap.h b/ports/psoc6/ble/cycfg_gap.h deleted file mode 100644 index fc24af6c74c2a..0000000000000 --- a/ports/psoc6/ble/cycfg_gap.h +++ /dev/null @@ -1,142 +0,0 @@ -/***************************************************************************//** -* File Name: cycfg_gap.h -* -* Description: -* Definitions for GAP configuration. -* This file should not be modified. It was automatically generated by -* Bluetooth Configurator 3.30.0.3160 -* -******************************************************************************** -* Copyright 2025 Cypress Semiconductor Corporation (an Infineon company) or -* an affiliate of Cypress Semiconductor Corporation. -* SPDX-License-Identifier: Apache-2.0 -* -* 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. -*******************************************************************************/ - -#if !defined(CYCFG_GAP_H) -#define CYCFG_GAP_H - -#include "stdint.h" -#include "wiced_bt_ble.h" -#include "cycfg_gatt_db.h" - -/* Silicon generated 'Company assigned' part of device address */ -#define CY_BT_SILICON_DEVICE_ADDRESS_EN 0 - -/* Appearance */ -#define CY_BT_APPEARANCE 0 - -/* TX Power Level */ -#define CY_BT_TX_POWER 0 - -/* Interval of random address refreshing */ -#define CY_BT_RPA_TIMEOUT 900 - -/* Maximum attribute length */ -#define CY_BT_MAX_ATTR_LEN 512 -/* Maximum attribute MTU size */ -#define CY_BT_MTU_SIZE 23 - -/* RX PDU size */ -#define CY_BT_RX_PDU_SIZE 512 - -/* Maximum connections */ -#define CY_BT_SERVER_MAX_LINKS 1 -#define CY_BT_CLIENT_MAX_LINKS 0 - -/* LE Filter accept list size */ -#define CY_BT_FILTER_ACCEPT_LIST_SIZE 0 -/* This define is obsolete and kept for backward compatibility only. */ -#define CY_BT_WHITE_LIST_SIZE CY_BT_FILTER_ACCEPT_LIST_SIZE - -/* L2CAP configuration */ -#define CY_BT_L2CAP_MAX_LE_PSM 0 -#define CY_BT_L2CAP_MAX_LE_CHANNELS 0 -#define CY_BT_L2CAP_MAX_LE_FIXED_CHANNELS 0 -#define CY_BT_L2CAP_MAX_BR_ERTM_CHANNELS 0 -#define CY_BT_L2CAP_MAX_BR_ERTM_TX_WIN 0 -#define CY_BT_L2CAP_MTU_SIZE 512 - -/* Security level */ -#define CY_BT_SECURITY_LEVEL BTM_SEC_BEST_EFFORT - -/* Scan configuration */ -#define CY_BT_SCAN_MODE BTM_BLE_SCAN_MODE_PASSIVE - -#define CY_BT_HIGH_DUTY_SCAN_INTERVAL WICED_BT_CFG_DEFAULT_HIGH_DUTY_SCAN_INTERVAL -#define CY_BT_HIGH_DUTY_SCAN_WINDOW WICED_BT_CFG_DEFAULT_HIGH_DUTY_SCAN_WINDOW -#define CY_BT_HIGH_DUTY_SCAN_DURATION 5 - -#define CY_BT_LOW_DUTY_SCAN_INTERVAL WICED_BT_CFG_DEFAULT_LOW_DUTY_SCAN_INTERVAL -#define CY_BT_LOW_DUTY_SCAN_WINDOW WICED_BT_CFG_DEFAULT_LOW_DUTY_SCAN_WINDOW -#define CY_BT_LOW_DUTY_SCAN_DURATION 60 - -#define CY_BT_HIGH_DUTY_CONN_SCAN_INTERVAL WICED_BT_CFG_DEFAULT_HIGH_DUTY_CONN_SCAN_INTERVAL -#define CY_BT_HIGH_DUTY_CONN_SCAN_WINDOW WICED_BT_CFG_DEFAULT_HIGH_DUTY_CONN_SCAN_WINDOW -#define CY_BT_HIGH_DUTY_CONN_SCAN_DURATION 30 - -#define CY_BT_LOW_DUTY_CONN_SCAN_INTERVAL WICED_BT_CFG_DEFAULT_LOW_DUTY_CONN_SCAN_INTERVAL -#define CY_BT_LOW_DUTY_CONN_SCAN_WINDOW WICED_BT_CFG_DEFAULT_LOW_DUTY_CONN_SCAN_WINDOW -#define CY_BT_LOW_DUTY_CONN_SCAN_DURATION 30 - -/* Connection configuration */ -#define CY_BT_CONN_MIN_INTERVAL WICED_BT_CFG_DEFAULT_CONN_MIN_INTERVAL -#define CY_BT_CONN_MAX_INTERVAL WICED_BT_CFG_DEFAULT_CONN_MAX_INTERVAL -#define CY_BT_CONN_LATENCY WICED_BT_CFG_DEFAULT_CONN_LATENCY -#define CY_BT_CONN_SUPERVISION_TIMEOUT WICED_BT_CFG_DEFAULT_CONN_SUPERVISION_TIMEOUT - -/* Advertisement settings */ -#define CY_BT_CHANNEL_MAP (BTM_BLE_ADVERT_CHNL_37 | BTM_BLE_ADVERT_CHNL_38 | BTM_BLE_ADVERT_CHNL_39) - -#define CY_BT_HIGH_DUTY_ADV_MIN_INTERVAL 48 -#define CY_BT_HIGH_DUTY_ADV_MAX_INTERVAL 48 -#define CY_BT_HIGH_DUTY_ADV_DURATION 60 - -#define CY_BT_LOW_DUTY_ADV_MIN_INTERVAL 2048 -#define CY_BT_LOW_DUTY_ADV_MAX_INTERVAL 2048 -#define CY_BT_LOW_DUTY_ADV_DURATION 60 - -#define CY_BT_HIGH_DUTY_DIRECTED_ADV_MIN_INTERVAL 400 -#define CY_BT_HIGH_DUTY_DIRECTED_ADV_MAX_INTERVAL 800 - -#define CY_BT_LOW_DUTY_DIRECTED_ADV_MIN_INTERVAL 48 -#define CY_BT_LOW_DUTY_DIRECTED_ADV_MAX_INTERVAL 48 -#define CY_BT_LOW_DUTY_DIRECTED_ADV_DURATION 30 - -#define CY_BT_HIGH_DUTY_NONCONN_ADV_MIN_INTERVAL 160 -#define CY_BT_HIGH_DUTY_NONCONN_ADV_MAX_INTERVAL 160 -#define CY_BT_HIGH_DUTY_NONCONN_ADV_DURATION 30 - -#define CY_BT_LOW_DUTY_NONCONN_ADV_MIN_INTERVAL 2048 -#define CY_BT_LOW_DUTY_NONCONN_ADV_MAX_INTERVAL 2048 -#define CY_BT_LOW_DUTY_NONCONN_ADV_DURATION 30 - - -/* Advertisement and scan response packets defines */ -#define CY_BT_ADV_PACKET_ELEM_COUNT 2 -/* CY_BT_ADV_PACKET_DATA_SIZE is obsolete. Use CY_BT_ADV_PACKET_ELEM_COUNT instead */ -#define CY_BT_ADV_PACKET_DATA_SIZE CY_BT_ADV_PACKET_ELEM_COUNT -#define CY_BT_SCAN_RESP_PACKET_ELEM_COUNT 1 -/* CY_BT_SCAN_RESP_PACKET_DATA_SIZE is obsolete. Use CY_BT_SCAN_RESP_PACKET_ELEM_COUNT instead */ -#define CY_BT_SCAN_RESP_PACKET_DATA_SIZE CY_BT_SCAN_RESP_PACKET_ELEM_COUNT - -/* cy_bt_device_name is obsolete. Use app_gap_device_name instead. */ -#define cy_bt_device_name app_gap_device_name - -/* External definitions */ -extern wiced_bt_device_address_t cy_bt_device_address; -extern wiced_bt_ble_advert_elem_t cy_bt_adv_packet_data[]; -extern wiced_bt_ble_advert_elem_t cy_bt_scan_resp_packet_data[]; - -#endif /* CYCFG_GAP_H */ diff --git a/ports/psoc6/ble/cycfg_gatt_db.c b/ports/psoc6/ble/cycfg_gatt_db.c deleted file mode 100644 index 888454725624c..0000000000000 --- a/ports/psoc6/ble/cycfg_gatt_db.c +++ /dev/null @@ -1,148 +0,0 @@ -/****************************************************************************** -* File Name: cycfg_gatt_db.c -* -* Description: -* BLE device's GATT database and device configuration. -* This file should not be modified. It was automatically generated by -* Bluetooth Configurator 3.30.0.3160 -* -******************************************************************************* -* Copyright 2025 Cypress Semiconductor Corporation (an Infineon company) or -* an affiliate of Cypress Semiconductor Corporation. -* SPDX-License-Identifier: Apache-2.0 -* -* 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 "cycfg_gatt_db.h" -#include "wiced_bt_uuid.h" -#include "wiced_bt_gatt.h" - -/****************************************************************************** -* GATT server definitions -******************************************************************************/ - -const uint8_t gatt_database[] = -{ - /* Primary Service: Generic Access */ - PRIMARY_SERVICE_UUID16( - HDLS_GAP, - __UUID_SERVICE_GENERIC_ACCESS), - /* Characteristic: Device Name */ - CHARACTERISTIC_UUID16( - HDLC_GAP_DEVICE_NAME, - HDLC_GAP_DEVICE_NAME_VALUE, - __UUID_CHARACTERISTIC_DEVICE_NAME, - GATTDB_CHAR_PROP_READ, - GATTDB_PERM_READABLE), - /* Characteristic: Appearance */ - CHARACTERISTIC_UUID16( - HDLC_GAP_APPEARANCE, - HDLC_GAP_APPEARANCE_VALUE, - __UUID_CHARACTERISTIC_APPEARANCE, - GATTDB_CHAR_PROP_READ, - GATTDB_PERM_READABLE), - - /* Primary Service: Generic Attribute */ - PRIMARY_SERVICE_UUID16( - HDLS_GATT, - __UUID_SERVICE_GENERIC_ATTRIBUTE), - /* Characteristic: Service Changed */ - CHARACTERISTIC_UUID16( - HDLC_GATT_SERVICE_CHANGED, - HDLC_GATT_SERVICE_CHANGED_VALUE, - __UUID_CHARACTERISTIC_SERVICE_CHANGED, - GATTDB_CHAR_PROP_INDICATE, - GATTDB_PERM_NONE), - /* Descriptor: Client Characteristic Configuration */ - CHAR_DESCRIPTOR_UUID16_WRITABLE( - HDLD_GATT_SERVICE_CHANGED_CLIENT_CHAR_CONFIG, - __UUID_DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION, - GATTDB_PERM_READABLE | GATTDB_PERM_WRITE_REQ), - - /* Primary Service: Immediate Alert */ - PRIMARY_SERVICE_UUID16( - HDLS_IAS, - __UUID_SERVICE_IMMEDIATE_ALERT), - /* Characteristic: Alert Level */ - CHARACTERISTIC_UUID16_WRITABLE( - HDLC_IAS_ALERT_LEVEL, - HDLC_IAS_ALERT_LEVEL_VALUE, - __UUID_CHARACTERISTIC_ALERT_LEVEL, - GATTDB_CHAR_PROP_WRITE_NO_RESPONSE, - GATTDB_PERM_WRITE_CMD), -}; - -/* Length of the GATT database */ -const uint16_t gatt_database_len = sizeof(gatt_database); - -/****************************************************************************** -* GATT Initial Value Arrays -******************************************************************************/ - -uint8_t app_gap_device_name[] = {'F', 'i', 'n', 'd', ' ', 'M', 'e', ' ', 'T', 'a', 'r', 'g', - 'e', 't', '\0', }; -uint8_t app_gap_appearance[] = {0x00, 0x00, }; -uint8_t app_gatt_service_changed[] = {0x00, 0x00, 0x00, 0x00, }; -uint8_t app_gatt_service_changed_client_char_config[] = {0x00, 0x00, }; -uint8_t app_ias_alert_level[] = {0x00, }; - -/****************************************************************************** -* GATT Lookup Table -******************************************************************************/ - -gatt_db_lookup_table_t app_gatt_db_ext_attr_tbl[] = -{ - { - HDLC_GAP_DEVICE_NAME_VALUE, /* attribute handle */ - MAX_LEN_GAP_DEVICE_NAME, /* maxlen */ - 14, /* curlen */ - app_gap_device_name, /* attribute data */ - }, - { - HDLC_GAP_APPEARANCE_VALUE, /* attribute handle */ - MAX_LEN_GAP_APPEARANCE, /* maxlen */ - 2, /* curlen */ - app_gap_appearance, /* attribute data */ - }, - { - HDLC_GATT_SERVICE_CHANGED_VALUE, /* attribute handle */ - MAX_LEN_GATT_SERVICE_CHANGED, /* maxlen */ - 4, /* curlen */ - app_gatt_service_changed, /* attribute data */ - }, - { - HDLD_GATT_SERVICE_CHANGED_CLIENT_CHAR_CONFIG, /* attribute handle */ - MAX_LEN_GATT_SERVICE_CHANGED_CLIENT_CHAR_CONFIG,/* maxlen */ - 2, /* curlen */ - app_gatt_service_changed_client_char_config, /* attribute data */ - }, - { - HDLC_IAS_ALERT_LEVEL_VALUE, /* attribute handle */ - MAX_LEN_IAS_ALERT_LEVEL, /* maxlen */ - 1, /* curlen */ - app_ias_alert_level, /* attribute data */ - }, -}; - -/* Number of Lookup Table entries */ -const uint16_t app_gatt_db_ext_attr_tbl_size = - (sizeof(app_gatt_db_ext_attr_tbl) / sizeof(gatt_db_lookup_table_t)); - -/* Number of GATT initial value arrays entries */ -const uint16_t app_gap_device_name_len = 14; -const uint16_t app_gap_appearance_len = (sizeof(app_gap_appearance)); -const uint16_t app_gatt_service_changed_len = (sizeof(app_gatt_service_changed)); -const uint16_t app_gatt_service_changed_client_char_config_len = - (sizeof(app_gatt_service_changed_client_char_config)); -const uint16_t app_ias_alert_level_len = (sizeof(app_ias_alert_level)); diff --git a/ports/psoc6/ble/cycfg_gatt_db.h b/ports/psoc6/ble/cycfg_gatt_db.h deleted file mode 100644 index 62e30c24d3c77..0000000000000 --- a/ports/psoc6/ble/cycfg_gatt_db.h +++ /dev/null @@ -1,96 +0,0 @@ -/***************************************************************************//** -* File Name: cycfg_gatt_db.h -* -* Description: -* Definitions for constants used in the device's GATT database and function -* prototypes. -* This file should not be modified. It was automatically generated by -* Bluetooth Configurator 3.30.0.3160 -* -******************************************************************************** -* Copyright 2025 Cypress Semiconductor Corporation (an Infineon company) or -* an affiliate of Cypress Semiconductor Corporation. -* SPDX-License-Identifier: Apache-2.0 -* -* 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. -*******************************************************************************/ - -#if !defined(CYCFG_GATT_DB_H) -#define CYCFG_GATT_DB_H - -#include "stdint.h" - -#define __UUID_SERVICE_GENERIC_ACCESS 0x1800 -#define __UUID_CHARACTERISTIC_DEVICE_NAME 0x2A00 -#define __UUID_CHARACTERISTIC_APPEARANCE 0x2A01 -#define __UUID_SERVICE_GENERIC_ATTRIBUTE 0x1801 -#define __UUID_CHARACTERISTIC_SERVICE_CHANGED 0x2A05 -#define __UUID_DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION 0x2902 -#define __UUID_SERVICE_IMMEDIATE_ALERT 0x1802 -#define __UUID_CHARACTERISTIC_ALERT_LEVEL 0x2A06 - -/* Service Generic Access */ -#define HDLS_GAP 0x0001 -/* Characteristic Device Name */ -#define HDLC_GAP_DEVICE_NAME 0x0002 -#define HDLC_GAP_DEVICE_NAME_VALUE 0x0003 -#define MAX_LEN_GAP_DEVICE_NAME 0x000E -/* Characteristic Appearance */ -#define HDLC_GAP_APPEARANCE 0x0004 -#define HDLC_GAP_APPEARANCE_VALUE 0x0005 -#define MAX_LEN_GAP_APPEARANCE 0x0002 - -/* Service Generic Attribute */ -#define HDLS_GATT 0x0006 -/* Characteristic Service Changed */ -#define HDLC_GATT_SERVICE_CHANGED 0x0007 -#define HDLC_GATT_SERVICE_CHANGED_VALUE 0x0008 -#define MAX_LEN_GATT_SERVICE_CHANGED 0x0004 -/* Descriptor Client Characteristic Configuration */ -#define HDLD_GATT_SERVICE_CHANGED_CLIENT_CHAR_CONFIG 0x0009 -#define MAX_LEN_GATT_SERVICE_CHANGED_CLIENT_CHAR_CONFIG 0x0002 - -/* Service Immediate Alert */ -#define HDLS_IAS 0x000A -/* Characteristic Alert Level */ -#define HDLC_IAS_ALERT_LEVEL 0x000B -#define HDLC_IAS_ALERT_LEVEL_VALUE 0x000C -#define MAX_LEN_IAS_ALERT_LEVEL 0x0001 - - -/* External Lookup Table Entry */ -typedef struct -{ - uint16_t handle; - uint16_t max_len; - uint16_t cur_len; - uint8_t *p_data; -} gatt_db_lookup_table_t; - -/* External definitions */ -extern const uint8_t gatt_database[]; -extern const uint16_t gatt_database_len; -extern gatt_db_lookup_table_t app_gatt_db_ext_attr_tbl[]; -extern const uint16_t app_gatt_db_ext_attr_tbl_size; -extern uint8_t app_gap_device_name[]; -extern const uint16_t app_gap_device_name_len; -extern uint8_t app_gap_appearance[]; -extern const uint16_t app_gap_appearance_len; -extern uint8_t app_gatt_service_changed[]; -extern const uint16_t app_gatt_service_changed_len; -extern uint8_t app_gatt_service_changed_client_char_config[]; -extern const uint16_t app_gatt_service_changed_client_char_config_len; -extern uint8_t app_ias_alert_level[]; -extern const uint16_t app_ias_alert_level_len; - -#endif /* CYCFG_GATT_DB_H */ diff --git a/ports/psoc6/ble/design.cybt b/ports/psoc6/ble/design.cybt new file mode 100644 index 0000000000000..e3a86fb150dbc --- /dev/null +++ b/ports/psoc6/ble/design.cybt @@ -0,0 +1,434 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ports/psoc6/boards/CY8CKIT-062S2-AI/mpconfigboard.mk b/ports/psoc6/boards/CY8CKIT-062S2-AI/mpconfigboard.mk index bbfce918eadb0..4d9e2a3d2e914 100644 --- a/ports/psoc6/boards/CY8CKIT-062S2-AI/mpconfigboard.mk +++ b/ports/psoc6/boards/CY8CKIT-062S2-AI/mpconfigboard.mk @@ -6,7 +6,8 @@ MICROPY_PY_SSL = 1 MICROPY_PSOC6_SSL_MBEDTLS = 1 MICROPY_PY_EXT_FLASH = 1 MICROPY_PY_SD_CARD = 1 -MICROPY_PSOC6_BLUETOOTH = 0 +MICROPY_PY_BLUETOOTH = 0 +MICROPY_BLUETOOTH_PORT_BTSTACK = 0 BOARD_VERSION=release-v4.3.0 # Variables to support make-pins diff --git a/ports/psoc6/boards/CY8CPROTO-062-4343W/mpconfigboard.mk b/ports/psoc6/boards/CY8CPROTO-062-4343W/mpconfigboard.mk index aaf6d4b1527e7..2068c7593c8ca 100644 --- a/ports/psoc6/boards/CY8CPROTO-062-4343W/mpconfigboard.mk +++ b/ports/psoc6/boards/CY8CPROTO-062-4343W/mpconfigboard.mk @@ -7,7 +7,8 @@ MICROPY_PSOC6_SSL_MBEDTLS = 1 MICROPY_PY_EXT_FLASH = 1 MICROPY_PY_SD_CARD = 1 MICROPY_VFS_FAT=1 -MICROPY_PSOC6_BLUETOOTH = 0 +MICROPY_PY_BLUETOOTH = 0 +MICROPY_BLUETOOTH_PORT_BTSTACK = 0 BOARD_VERSION=release-v4.0.0 # Variables to support make-pins diff --git a/ports/psoc6/boards/CY8CPROTO-063-BLE/mpconfigboard.mk b/ports/psoc6/boards/CY8CPROTO-063-BLE/mpconfigboard.mk index c940f8369f88f..081364855d9f5 100644 --- a/ports/psoc6/boards/CY8CPROTO-063-BLE/mpconfigboard.mk +++ b/ports/psoc6/boards/CY8CPROTO-063-BLE/mpconfigboard.mk @@ -1,7 +1,8 @@ FROZEN_MANIFEST ?= boards/manifest.py MICROPY_PY_SSL = 0 MICROPY_PSOC6_SSL_MBEDTLS = 0 -MICROPY_PSOC6_BLUETOOTH = 1 +MICROPY_PY_BLUETOOTH = 1 +MICROPY_BLUETOOTH_PORT_BTSTACK = 1 BOARD_VERSION=release-v4.2.0 # Variables to support make-pins diff --git a/ports/psoc6/mpconfigport.h b/ports/psoc6/mpconfigport.h index deacb8ae136e8..4122034d96294 100644 --- a/ports/psoc6/mpconfigport.h +++ b/ports/psoc6/mpconfigport.h @@ -193,11 +193,6 @@ extern const struct _mp_obj_type_t mp_network_ifx_wcm_type; #endif -// BLE defines -#if MICROPY_PSOC6_BLUETOOTH -#define MICROPY_PY_BLUETOOTH (1) -#endif - // Miscellaneous settings #define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p) | 1)) From a1ddd86f6294e480e794b7a2f57177cd79388063 Mon Sep 17 00:00:00 2001 From: NikhitaR-IFX Date: Mon, 25 Aug 2025 17:28:19 +0530 Subject: [PATCH 4/7] lib/mtb-psoc6-libs: Updated clean target to remove ble sources. Signed-off-by: NikhitaR-IFX --- lib/mtb-psoc6-libs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mtb-psoc6-libs b/lib/mtb-psoc6-libs index aa55b2e92117f..f010b93abf689 160000 --- a/lib/mtb-psoc6-libs +++ b/lib/mtb-psoc6-libs @@ -1 +1 @@ -Subproject commit aa55b2e92117f7a2c41a35745849e6d91b842070 +Subproject commit f010b93abf6898dbe581557f374ce34e295ba3bb From 9c68507d51f7db6b6fc16a074c0b4dee6134736e Mon Sep 17 00:00:00 2001 From: NikhitaR-IFX Date: Mon, 25 Aug 2025 18:36:19 +0530 Subject: [PATCH 5/7] tests/ports/psoc6: Update ble exp file. Signed-off-by: NikhitaR-IFX --- tests/ports/psoc6/board_only_hw/single/ble_import.py.exp | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/ports/psoc6/board_only_hw/single/ble_import.py.exp b/tests/ports/psoc6/board_only_hw/single/ble_import.py.exp index 1230ea53d44ec..e69de29bb2d1d 100644 --- a/tests/ports/psoc6/board_only_hw/single/ble_import.py.exp +++ b/tests/ports/psoc6/board_only_hw/single/ble_import.py.exp @@ -1 +0,0 @@ -To be implemented From 4f24b6f886119e4a68af39b8c166fd2077ae460f Mon Sep 17 00:00:00 2001 From: NikhitaR-IFX Date: Tue, 26 Aug 2025 12:02:46 +0530 Subject: [PATCH 6/7] psoc6: Remove ble related target and design file. Signed-off-by: NikhitaR-IFX --- lib/mtb-psoc6-libs | 2 +- ports/psoc6/Makefile | 7 +- ports/psoc6/ble/design.cybt | 434 ------------------------------------ 3 files changed, 2 insertions(+), 441 deletions(-) delete mode 100644 ports/psoc6/ble/design.cybt diff --git a/lib/mtb-psoc6-libs b/lib/mtb-psoc6-libs index f010b93abf689..9ce16a85d9e0b 160000 --- a/lib/mtb-psoc6-libs +++ b/lib/mtb-psoc6-libs @@ -1 +1 @@ -Subproject commit f010b93abf6898dbe581557f374ce34e295ba3bb +Subproject commit 9ce16a85d9e0b8cd14a6c85d92b034c299bc6551 diff --git a/ports/psoc6/Makefile b/ports/psoc6/Makefile index 5e87b799d8632..9f23cc5719310 100644 --- a/ports/psoc6/Makefile +++ b/ports/psoc6/Makefile @@ -228,15 +228,10 @@ $(BUILD)/firmware.hex: $(BUILD)/firmware.elf MPY_CROSS_FLAGS += -march=armv7m -ifeq ($(MICROPY_PY_BLUETOOTH),1) -.PHONY: ble -ble: - $(Q) cp ble/design.cybt $(MTB_LIBS_DIR) -endif build: mtb_get_build_flags $(GENERATED_PINS) $(BUILD)/firmware.hex -all: ble build +all: build clean: mtb_clean diff --git a/ports/psoc6/ble/design.cybt b/ports/psoc6/ble/design.cybt deleted file mode 100644 index e3a86fb150dbc..0000000000000 --- a/ports/psoc6/ble/design.cybt +++ /dev/null @@ -1,434 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 110dd505c86bf9a99f18ed3b7bb76e1ace5bfa96 Mon Sep 17 00:00:00 2001 From: NikhitaR-IFX Date: Tue, 26 Aug 2025 13:24:42 +0530 Subject: [PATCH 7/7] lib/mtb-psoc6-libs: Update to latest changes. Signed-off-by: NikhitaR-IFX --- lib/mtb-psoc6-libs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mtb-psoc6-libs b/lib/mtb-psoc6-libs index 9ce16a85d9e0b..180a5436a2444 160000 --- a/lib/mtb-psoc6-libs +++ b/lib/mtb-psoc6-libs @@ -1 +1 @@ -Subproject commit 9ce16a85d9e0b8cd14a6c85d92b034c299bc6551 +Subproject commit 180a5436a24445eff4240a7ae1819a5f511264dd