Skip to content

Commit 6511d46

Browse files
committed
PortentaH7: implement low power on BLE
Conflicts: connectivity/drivers/ble/FEATURE_BLE/TARGET_CYW4343X/CyH4TransportDriver.cpp -> new version in COMPONENT_CYW43XXX connectivity/drivers/ble/FEATURE_BLE/TARGET_CYW4343X/CyH4TransportDriver.h -> new version in COMPONENT_CYW43XXX connectivity/drivers/ble/FEATURE_BLE/TARGET_CYW4343X/TARGET_PORTENTA_H7/cy_bt_cordio_cfg.cpp -> moved into connectivity/drivers/ble/FEATURE_BLE/COMPONENT_CYW43XXX/TARGET_PORTENTA_H7 features/FEATURE_BLE/targets/TARGET_STM/TARGET_CYW4343X/HCIDriver.cpp -> new verision in connectivity/drivers/ble/FEATURE_BLE/COMPONENT_CYW43XXX
1 parent 5421040 commit 6511d46

File tree

2 files changed

+107
-0
lines changed
  • connectivity/drivers/ble/FEATURE_BLE/COMPONENT_CYW43XXX/TARGET_PORTENTA_H7
  • targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_PORTENTA_H7

2 files changed

+107
-0
lines changed
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/*******************************************************************************
2+
* \file cy_bt_cordio_cfg.cpp
3+
* \version 1.0
4+
*
5+
*
6+
* Low Power Assist BT Pin configuration implementation.
7+
*
8+
********************************************************************************
9+
* \copyright
10+
* Copyright 2019 Cypress Semiconductor Corporation
11+
* SPDX-License-Identifier: Apache-2.0
12+
*
13+
* Licensed under the Apache License, Version 2.0 (the "License");
14+
* you may not use this file except in compliance with the License.
15+
* You may obtain a copy of the License at
16+
*
17+
* http://www.apache.org/licenses/LICENSE-2.0
18+
*
19+
* Unless required by applicable law or agreed to in writing, software
20+
* distributed under the License is distributed on an "AS IS" BASIS,
21+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22+
* See the License for the specific language governing permissions and
23+
* limitations under the License.
24+
*******************************************************************************/
25+
26+
#include <stdio.h>
27+
#include "CordioBLE.h"
28+
#include "CordioHCIDriver.h"
29+
#include "hci_api.h"
30+
#include "hci_cmd.h"
31+
#include "hci_core.h"
32+
#include "bstream.h"
33+
#include "assert.h"
34+
#include <stdbool.h>
35+
#include "hci_mbed_os_adaptation.h"
36+
#include "CyH4TransportDriver.h"
37+
38+
#define cyhal_gpio_to_rtos(x) (x)
39+
#define CYCFG_BT_LP_ENABLED (1)
40+
#define CYCFG_BT_HOST_WAKE_IRQ_EVENT WAKE_EVENT_ACTIVE_LOW
41+
#define CYCFG_BT_DEV_WAKE_POLARITY WAKE_EVENT_ACTIVE_LOW
42+
43+
/*******************************************************************************
44+
* Function Name: ble_cordio_get_h4_transport_driver
45+
********************************************************************************
46+
*
47+
* Strong implementation of function which calls CyH4TransportDriver constructor and return it
48+
*
49+
* \param none
50+
*
51+
* \return
52+
* Returns the transport driver object
53+
*******************************************************************************/
54+
ble::vendor::cypress_ble::CyH4TransportDriver& ble_cordio_get_h4_transport_driver()
55+
{
56+
#if (defined(MBED_TICKLESS) && DEVICE_SLEEP && DEVICE_LPTICKER)
57+
58+
#if (defined(CYCFG_BT_LP_ENABLED))
59+
if (CYCFG_BT_LP_ENABLED) {
60+
static ble::vendor::cypress_ble::CyH4TransportDriver s_transport_driver(
61+
/* TX */ cyhal_gpio_to_rtos(CYBSP_BT_UART_TX),
62+
/* RX */ cyhal_gpio_to_rtos(CYBSP_BT_UART_RX),
63+
/* cts */ cyhal_gpio_to_rtos(CYBSP_BT_UART_CTS),
64+
/* rts */ cyhal_gpio_to_rtos(CYBSP_BT_UART_RTS), DEF_BT_BAUD_RATE,
65+
cyhal_gpio_to_rtos(CYBSP_BT_HOST_WAKE),
66+
cyhal_gpio_to_rtos(CYBSP_BT_DEVICE_WAKE),
67+
CYCFG_BT_HOST_WAKE_IRQ_EVENT,
68+
CYCFG_BT_DEV_WAKE_POLARITY
69+
);
70+
return s_transport_driver;
71+
} else { /* CYCFG_BT_LP_ENABLED */
72+
static ble::vendor::cypress_ble::CyH4TransportDriver s_transport_driver(
73+
/* TX */ cyhal_gpio_to_rtos(CYBSP_BT_UART_TX),
74+
/* RX */ cyhal_gpio_to_rtos(CYBSP_BT_UART_RX),
75+
/* cts */ cyhal_gpio_to_rtos(CYBSP_BT_UART_CTS),
76+
/* rts */ cyhal_gpio_to_rtos(CYBSP_BT_UART_RTS), DEF_BT_BAUD_RATE);
77+
return s_transport_driver;
78+
}
79+
#else /* (defined(CYCFG_BT_LP_ENABLED)) */
80+
static ble::vendor::cypress_ble::CyH4TransportDriver s_transport_driver(
81+
/* TX */ cyhal_gpio_to_rtos(CYBSP_BT_UART_TX),
82+
/* RX */ cyhal_gpio_to_rtos(CYBSP_BT_UART_RX),
83+
/* cts */ cyhal_gpio_to_rtos(CYBSP_BT_UART_CTS),
84+
/* rts */ cyhal_gpio_to_rtos(CYBSP_BT_UART_RTS), DEF_BT_BAUD_RATE,
85+
cyhal_gpio_to_rtos(CYBSP_BT_HOST_WAKE), cyhal_gpio_to_rtos(CYBSP_BT_DEVICE_WAKE)
86+
);
87+
return s_transport_driver;
88+
#endif /* (defined(CYCFG_BT_LP_ENABLED)) */
89+
90+
#else /* (defined(MBED_TICKLESS) && DEVICE_SLEEP && DEVICE_LPTICKER) */
91+
static ble::vendor::cypress_ble::CyH4TransportDriver s_transport_driver(
92+
/* TX */ cyhal_gpio_to_rtos(CYBSP_BT_UART_TX),
93+
/* RX */ cyhal_gpio_to_rtos(CYBSP_BT_UART_RX),
94+
/* cts */ cyhal_gpio_to_rtos(CYBSP_BT_UART_CTS),
95+
/* rts */ cyhal_gpio_to_rtos(CYBSP_BT_UART_RTS), DEF_BT_BAUD_RATE);
96+
return s_transport_driver;
97+
#endif /* (defined(MBED_TICKLESS) && DEVICE_SLEEP && DEVICE_LPTICKER) */
98+
}

targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_PORTENTA_H7/PinNames.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,15 @@ typedef enum {
333333
LED2 = LED_GREEN,
334334
LED3 = LED_BLUE,
335335

336+
CYBSP_BT_UART_RX = PF_6,
337+
CYBSP_BT_UART_TX = PA_15,
338+
CYBSP_BT_UART_RTS = PF_8,
339+
CYBSP_BT_UART_CTS = PF_9,
340+
341+
CYBSP_BT_POWER = PJ_12,
342+
CYBSP_BT_HOST_WAKE = PJ_13,
343+
CYBSP_BT_DEVICE_WAKE = PJ_14,
344+
336345
USER_BUTTON = PC_13,
337346
// Standardized button names
338347
BUTTON1 = USER_BUTTON,

0 commit comments

Comments
 (0)