Patched version of nrf51822 FOTA compatible driver, with GPTIO disabled, as it clashed with the mbed definitions...

Fork of nRF51822 by Nordic Semiconductor

Revision:
52:120bd37b9d0d
Parent:
25:a1c356620131
Child:
56:a1071b629aa3
diff -r 63ba3bcf5cd6 -r 120bd37b9d0d nRF51822n.cpp
--- a/nRF51822n.cpp	Wed Jul 23 12:01:30 2014 +0100
+++ b/nRF51822n.cpp	Thu Jul 24 15:46:29 2014 +0100
@@ -53,6 +53,41 @@
 {
 }
 
+const char *nRF51822n::getVersion(void)
+{
+    static char versionString[10];
+    static bool versionFetched = false;
+
+    if (!versionFetched) {
+        ble_version_t version;
+        if (sd_ble_version_get(&version) == NRF_SUCCESS) {
+            snprintf(versionString, sizeof(versionString), "%u.%u", version.version_number, version.subversion_number);
+            versionFetched = true;
+        } else {
+            strncpy(versionString, "unknown", sizeof(versionString));
+        }
+    }
+
+    return versionString;
+}
+
+/* (Valid values are -40, -20, -16, -12, -8, -4, 0, 4) */
+ble_error_t nRF51822n::setTxPower(int8_t txPower)
+{
+    unsigned rc;
+    if ((rc = sd_ble_gap_tx_power_set(txPower)) != NRF_SUCCESS) {
+        switch (rc) {
+            case NRF_ERROR_BUSY:
+                return BLE_STACK_BUSY;
+            case NRF_ERROR_INVALID_PARAM:
+            default:
+                return BLE_ERROR_PARAM_OUT_OF_RANGE;
+        }
+    }
+
+    return BLE_ERROR_NONE;
+}
+
 /**************************************************************************/
 /*!
     @brief  Initialises anything required to start using BLE