Skip to content

Commit 15ee09c

Browse files
committed
Update Cordio BT Driver to support without BT Device Wake and Host Wake pins defined.
1 parent 0f5e3bf commit 15ee09c

File tree

1 file changed

+26
-17
lines changed

1 file changed

+26
-17
lines changed

features/FEATURE_BLE/targets/TARGET_Cypress/TARGET_CYW43XXX/CyH4TransportDriver.cpp

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,14 @@ void CyH4TransportDriver::initialize()
9393
);
9494

9595
#if (defined(MBED_TICKLESS) && DEVICE_SLEEP && DEVICE_LPTICKER)
96-
//Register IRQ for Host WAKE
97-
host_wake_pin = new InterruptIn(bt_host_wake_name);
98-
if (host_wake_irq_event == WAKE_EVENT_ACTIVE_LOW) {
99-
host_wake_pin->fall(callback(this, &CyH4TransportDriver::bt_host_wake_irq_handler));
100-
} else {
101-
host_wake_pin->rise(callback(this, &CyH4TransportDriver::bt_host_wake_irq_handler));
96+
if (bt_host_wake_name != NC) {
97+
//Register IRQ for Host WAKE
98+
host_wake_pin = new InterruptIn(bt_host_wake_name);
99+
if (host_wake_irq_event == WAKE_EVENT_ACTIVE_LOW) {
100+
host_wake_pin->fall(callback(this, &CyH4TransportDriver::bt_host_wake_irq_handler));
101+
} else {
102+
host_wake_pin->rise(callback(this, &CyH4TransportDriver::bt_host_wake_irq_handler));
103+
}
102104
}
103105

104106
#endif
@@ -137,7 +139,9 @@ uint16_t CyH4TransportDriver::write(uint8_t type, uint16_t len, uint8_t *pData)
137139
#if (defined(MBED_TICKLESS) && DEVICE_SLEEP && DEVICE_LPTICKER)
138140
void CyH4TransportDriver::on_host_stack_inactivity()
139141
{
140-
uart.attach(NULL, SerialBase::RxIrq);
142+
if (enabled_powersave) {
143+
uart.attach(NULL, SerialBase::RxIrq);
144+
}
141145
}
142146
#endif
143147

@@ -158,27 +162,32 @@ void CyH4TransportDriver::on_controller_irq()
158162
void CyH4TransportDriver::assert_bt_dev_wake()
159163
{
160164
#if (defined(MBED_TICKLESS) && DEVICE_SLEEP && DEVICE_LPTICKER)
161-
if (dev_wake_irq_event == WAKE_EVENT_ACTIVE_LOW) {
162-
bt_device_wake = WAKE_EVENT_ACTIVE_LOW;
163-
} else {
164-
bt_device_wake = WAKE_EVENT_ACTIVE_HIGH;
165+
if (enabled_powersave) {
166+
if (dev_wake_irq_event == WAKE_EVENT_ACTIVE_LOW) {
167+
bt_device_wake = WAKE_EVENT_ACTIVE_LOW;
168+
} else {
169+
bt_device_wake = WAKE_EVENT_ACTIVE_HIGH;
170+
}
165171
}
166172
#endif
167173
}
168174

169175
void CyH4TransportDriver::deassert_bt_dev_wake()
170176
{
171177
#if (defined(MBED_TICKLESS) && DEVICE_SLEEP && DEVICE_LPTICKER)
172-
wait_us(5000); /* remove and replace when uart tx transmit complete api is available */
173-
//De-assert bt_device_wake
174-
if (dev_wake_irq_event == WAKE_EVENT_ACTIVE_LOW) {
175-
bt_device_wake = WAKE_EVENT_ACTIVE_HIGH;
176-
} else {
177-
bt_device_wake = WAKE_EVENT_ACTIVE_LOW;
178+
if (enabled_powersave) {
179+
wait_us(5000); /* remove and replace when uart tx transmit complete api is available */
180+
//De-assert bt_device_wake
181+
if (dev_wake_irq_event == WAKE_EVENT_ACTIVE_LOW) {
182+
bt_device_wake = WAKE_EVENT_ACTIVE_HIGH;
183+
} else {
184+
bt_device_wake = WAKE_EVENT_ACTIVE_LOW;
185+
}
178186
}
179187
#endif
180188
}
181189

190+
182191
void CyH4TransportDriver::update_uart_baud_rate(int baud)
183192
{
184193
uart.baud(baud);

0 commit comments

Comments
 (0)