From 2a2a48d1a75156ae275533e67883924a07948a69 Mon Sep 17 00:00:00 2001 From: Adam Greenwood-Byrne Date: Mon, 10 Aug 2020 16:00:28 +0100 Subject: [PATCH] Fixed some typos --- part7-bluetooth/bt.c | 40 ++++++++++++++++++++-------------------- part7-bluetooth/kernel.c | 4 ++-- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/part7-bluetooth/bt.c b/part7-bluetooth/bt.c index d51291d..f7d2996 100644 --- a/part7-bluetooth/bt.c +++ b/part7-bluetooth/bt.c @@ -255,7 +255,7 @@ void stopAdvertising() { } void startActiveScanning() { - float BleScanInterval = 60; + float BleScanInterval = 60; // every 60ms float BleScanWindow = 60; float BleScanDivisor = 0.625; @@ -269,25 +269,6 @@ void startActiveScanning() { wait_msec(0x100000); } -void connect() -{ - float BleScanInterval = 60; - float BleScanWindow = 60; - float BleScanDivisor = 0.625; - - float connMinFreq = 30; // every 100ms - float connMaxFreq = 50; // every 100ms - float BleGranularity = 1.25; - - unsigned int p = BleScanInterval / BleScanDivisor; - unsigned int q = BleScanWindow / BleScanDivisor; - - unsigned int min_interval = connMinFreq / BleGranularity; - unsigned int max_interval = connMaxFreq / BleGranularity; - - createLEconnection(lo(p), hi(p), lo(q), hi(q), 0, 0, lo(min_interval), hi(min_interval), lo(max_interval), hi(max_interval)); -} - void startActiveAdvertising() { float advertMinFreq = 100; // every 100ms float advertMaxFreq = 100; // every 100ms @@ -300,3 +281,22 @@ void startActiveAdvertising() { setLEadvertdata(); setLEadvertenable(1); } + +void connect() +{ + float BleScanInterval = 60; // every 60ms + float BleScanWindow = 60; + float BleScanDivisor = 0.625; + + float connMinFreq = 30; // every 30ms + float connMaxFreq = 50; // every 50ms + float BleGranularity = 1.25; + + unsigned int p = BleScanInterval / BleScanDivisor; + unsigned int q = BleScanWindow / BleScanDivisor; + + unsigned int min_interval = connMinFreq / BleGranularity; + unsigned int max_interval = connMaxFreq / BleGranularity; + + createLEconnection(lo(p), hi(p), lo(q), hi(q), 0, 0, lo(min_interval), hi(min_interval), lo(max_interval), hi(max_interval)); +} diff --git a/part7-bluetooth/kernel.c b/part7-bluetooth/kernel.c index 8f54302..555b099 100644 --- a/part7-bluetooth/kernel.c +++ b/part7-bluetooth/kernel.c @@ -146,8 +146,8 @@ void main() for (int c=5;c>=0;c--) uart_byte(local_addr[c]); uart_writeText("\n"); - // Start scanning for devices around us /* + // Start scanning for devices around us uart_writeText("startActiveScanning()\n"); setLEeventmask(0xff); startActiveScanning(); @@ -156,8 +156,8 @@ void main() uart_writeText("connect()\n"); connect(); - // Get the Eddystone beacon going /* + // Get the Eddystone beacon going uart_writeText("startActiveAdvertising()\n"); startActiveAdvertising(); */