fork

Dependencies:   BLE_API mbed-dev-bin nRF51822

Dependents:   microbit

Fork of microbit-dal by Lancaster University

Files at this revision

API Documentation at this revision

Comitter:
jaafreitas
Date:
Wed Oct 04 18:52:09 2017 +0000
Parent:
16:d7a25f36907e
Commit message:
Fixed the analogRead bug where values greater than 255 were returned to bluetooth io pin service.; Config to allow open bluetooth connectivity.;

Changed in this revision

inc/core/MicroBitConfig.h Show annotated file Show diff for this revision Revisions of this file
source/bluetooth/MicroBitIOPinService.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/inc/core/MicroBitConfig.h	Fri Apr 08 16:45:44 2016 +0000
+++ b/inc/core/MicroBitConfig.h	Wed Oct 04 18:52:09 2017 +0000
@@ -100,7 +100,7 @@
 // For standard S110 builds, this should be word aligned and in the range 0x300 - 0x700.
 // Any unused memory will be automatically reclaimed as HEAP memory if both MICROBIT_HEAP_REUSE_SD and MICROBIT_HEAP_ALLOCATOR are enabled.
 #ifndef MICROBIT_SD_GATT_TABLE_SIZE
-#define MICROBIT_SD_GATT_TABLE_SIZE             0x300
+#define MICROBIT_SD_GATT_TABLE_SIZE             0x700
 #endif
 
 //
@@ -172,7 +172,7 @@
 // Enable/Disable BLE pairing mode mode at power up.
 // Set '1' to enable.
 #ifndef MICROBIT_BLE_PAIRING_MODE
-#define MICROBIT_BLE_PAIRING_MODE               1
+#define MICROBIT_BLE_PAIRING_MODE               0
 #endif
 
 // Enable/Disable the use of private resolvable addresses.
@@ -186,7 +186,7 @@
 // Open BLE links are not secure, but commonly used during the development of BLE services
 // Set '1' to disable all secuity
 #ifndef MICROBIT_BLE_OPEN
-#define MICROBIT_BLE_OPEN                       0
+#define MICROBIT_BLE_OPEN                       1
 #endif
 
 // Configure for open BLE operation if so configured
@@ -205,7 +205,7 @@
 // SECURITY_MODE_ENCRYPTION_WITH_MITM:      Bonding, encrytion and whitelisting with passkey authentication.
 //
 #ifndef MICROBIT_BLE_SECURITY_LEVEL
-#define MICROBIT_BLE_SECURITY_LEVEL             SECURITY_MODE_ENCRYPTION_WITH_MITM
+#define MICROBIT_BLE_SECURITY_LEVEL             SECURITY_MODE_ENCRYPTION_OPEN_LINK
 #endif
 
 // Enable/Disable the use of BLE whitelisting.
@@ -226,7 +226,7 @@
 // Based on trials undertaken by the BBC, the radio is normally set to its lowest power level
 // to best protect children's privacy.
 #ifndef MICROBIT_BLE_DEFAULT_TX_POWER
-#define MICROBIT_BLE_DEFAULT_TX_POWER           0
+#define MICROBIT_BLE_DEFAULT_TX_POWER           6
 #endif
 
 // Enable/Disable BLE Service: MicroBitDFU
@@ -352,7 +352,7 @@
 // if this isn't available, it can be defined manually as a configuration option.
 //
 #ifndef MICROBIT_DAL_VERSION
-#define MICROBIT_DAL_VERSION                    "unknown"
+#define MICROBIT_DAL_VERSION                    "0.1.0-node"
 #endif
 
 
@@ -370,4 +370,4 @@
 extern RawSerial* SERIAL_DEBUG;
 #endif
 
-#endif
+#endif
\ No newline at end of file
--- a/source/bluetooth/MicroBitIOPinService.cpp	Fri Apr 08 16:45:44 2016 +0000
+++ b/source/bluetooth/MicroBitIOPinService.cpp	Wed Oct 04 18:52:09 2017 +0000
@@ -186,7 +186,7 @@
                		io.pin[data->pin].setDigitalValue(data->value);
                     //MicroBitIOPins[data->pin]->setDigitalValue(data->value);
                 else
-               		io.pin[data->pin].setAnalogValue(data->value*4);
+               		io.pin[data->pin].setAnalogValue(data->value * 4);
                     //MicroBitIOPins[data->pin]->setAnalogValue(data->value*4);
             }
 
@@ -219,7 +219,7 @@
                		value = io.pin[i].getDigitalValue();
                     //value = MicroBitIOPins[i]->getDigitalValue();
                 else
-               		value = io.pin[i].getAnalogValue();
+               		value = io.pin[i].getAnalogValue() / 4;
                     //value = MicroBitIOPins[i]->getAnalogValue();
 
                 ioPinServiceIOData[i] = value;
@@ -265,7 +265,7 @@
                	value = io.pin[i].getDigitalValue();
                 //value = MicroBitIOPins[i]->getDigitalValue();
             else
-               	value = io.pin[i].getAnalogValue();
+               	value = io.pin[i].getAnalogValue() / 4;
                 //value = MicroBitIOPins[i]->getAnalogValue();
 
             // If the data has changed, send an update.