This is workaround to use I2C/SPI and serial together on BLE Nano.

Dependents:   SimpleSample

Revision:
0:f3f4407ec133
Child:
1:312356f93678
diff -r 000000000000 -r f3f4407ec133 SerialNano.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SerialNano.h	Fri Aug 14 00:19:19 2015 +0000
@@ -0,0 +1,48 @@
+#ifndef SERIALNANO_H
+#define SERIALNANO_H
+
+#include "Serial.h"
+
+#if DEVICE_SERIAL
+
+namespace mbed{
+/**
+ * This is workaround to use I2C and serial together on BLE Nano.
+ *
+ * @code
+ * #include "mbed.h"
+ * #include "SerialNano.h"
+ * 
+ * #define PIN_SERIAL_TX   P0_28
+ * #define PIN_SERIAL_RX   P0_29
+ *
+ * #define I2C_SPEED_100KHZ  100000
+ *
+ * int main() {
+ *     // Initialize serial. This must be done before I2C initialization.
+ *     SerialNano serial(PIN_SERIAL_TX, PIN_SERIAL_RX);
+ *     serial.baud(115200);
+ *
+ *     // Initialize I2C
+ *     I2C connection(I2C_SDA0, I2C_SCL0);
+ *     connection.frequency(I2C_SPEED_100KHZ);
+ *
+ *     while (true) {
+ *         // some i2c work
+ *         // ...
+ *         serial.printf("I2C data\n");
+ *         wait_ms(500);
+ *     }
+ * }
+ * @endcode
+ */
+class SerialNano : public Serial {
+    public:
+    SerialNano(PinName tx, PinName rx);
+};
+
+} // namespace mbed
+
+#endif // DEVICE_SERIAL
+
+#endif // SERIALNANO_H