summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLevi Oliver <levio@google.com>2016-06-14 15:29:38 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-08-09 19:40:40 -0700
commitf5f92bb83e3c89df3f0bf6b4844e070fba8a8159 (patch)
treec8f150349693f14d7e024c8f440e7479d7036e35
parent5a6725e6fadab4230a9d8d5cfcea0ee8f6da476d (diff)
downloadchrome-ec-f5f92bb83e3c89df3f0bf6b4844e070fba8a8159.tar.gz
btle_ll: Set advertising channel frequency
Remove repeated deadline resets. Deadline reset now in the STANDBY state. Set radio frequency to match selected channel. TEST=ble_hci_adv 0 BUG=None BRANCH=None Change-Id: Ic7ff0dba862c0216301d138413a89e4ef4a812fe Signed-off-by: Levi Oliver <levio@google.com> Reviewed-on: https://chromium-review.googlesource.com/367094 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--common/btle_ll.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/common/btle_ll.c b/common/btle_ll.c
index 9ee052dac0..d1c888038f 100644
--- a/common/btle_ll.c
+++ b/common/btle_ll.c
@@ -399,9 +399,20 @@ uint8_t ll_set_advertising_params(uint8_t *params)
static uint32_t tx_end, rsp_end, tx_rsp_end;
struct ble_pdu ll_rcv_packet;
+/**
+ * Advertises packet that has already been generated on given channel.
+ *
+ * This function also processes any incoming scan requests.
+ *
+ * @param chan The channel on which to advertise.
+ * @returns EC_SUCCESS on packet reception, otherwise error.
+ */
int ble_ll_adv(int chan)
{
int rv;
+ /* Change channel */
+ NRF51_RADIO_FREQUENCY = NRF51_RADIO_FREQUENCY_VAL(chan2freq(chan));
+ NRF51_RADIO_DATAWHITEIV = chan;
ble_tx(&ll_adv_pdu);
@@ -514,12 +525,12 @@ void bluetooth_ll_task(void)
usleep(ll_adv_interval_us + ll_pseudo_rand(10000));
if (get_time().val > deadline.val) {
- deadline.val = 0;
ll_state = STANDBY;
break;
}
break;
case STANDBY:
+ deadline.val = 0;
CPRINTS("Standby %d events", ll_adv_events);
ll_adv_events = 0;
task_wait_event(-1);
@@ -539,7 +550,6 @@ void bluetooth_ll_task(void)
break;
case UNINITIALIZED:
ll_adv_events = 0;
- deadline.val = 0;
task_wait_event(-1);
break;
default: