AKM Development Platform. This is the D7.014 version.

Dependencies:   AK09970 AK099XX AK7401 AK7451 AK8963X AK9750 AK9752 AkmSensor BLE_API I2CNano MCP342x SerialNano SpiNano TCA9554A mbed nRF51822

Fork of AKDP by Masahiko Fukasawa

Revision:
2:11a5873f8ec0
Parent:
1:0914af311974
Child:
4:749a21fd9c2d
--- a/main.cpp	Thu May 05 00:20:26 2016 +0000
+++ b/main.cpp	Thu May 05 21:11:40 2016 +0000
@@ -6,6 +6,7 @@
 #include "SerialNano.h"
 #include "akmsensormanager.h"
 #include "debug.h"
+#include "tca9554a.h"
 
 #define BLE_UUID_TXRX_SERVICE            0x0000 /**< The UUID of the Nordic UART Service. */
 #define BLE_UUID_TX_CHARACTERISTIC       0x0002 /**< The UUID of the TX Characteristic. */
@@ -19,7 +20,11 @@
 
 BLE                 ble;
 UARTService*        uartService;
-SerialNano          serial(P0_28, P0_29);
+#ifndef REV_D
+SerialNano          serial(P0_28, P0_29); // Rev.C pin configuration
+#else
+SerialNano          serial(P0_4, P0_5);  // Rev.D pin configuration
+#endif
 AkmSensorManager*   manager;
 
 static char commandStr[TXRX_LEN];
@@ -140,7 +145,7 @@
     ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED);
     ble.gap().setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
     ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::SHORTENED_LOCAL_NAME,
-                                    (const uint8_t *)"AKDP RevC 001", sizeof("AKDP RevC 001") - 1);
+                                    (const uint8_t *)"AKDP RevD 001", sizeof("AKDP RevD 001") - 1);
     ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_128BIT_SERVICE_IDS,
                                     (const uint8_t *)UARTServiceUUID_reversed, sizeof(UARTServiceUUID_reversed));
     ble.gap().onConnection(connectionCallback);
@@ -163,6 +168,26 @@
         MSG("#Error: sensor is NULL\n");
     }
     
+#ifdef REV_D
+    /* Rev.D */
+    {
+        const int TIME_FOR_OE_MS = 100;
+        const TCA9554A::Port PORT_OE_LVS1 = TCA9554A::PORT_7;
+        const TCA9554A::Port PORT_OE_LVS2 = TCA9554A::PORT_6;
+        I2C i2c(I2C_SDA0, I2C_SCL0);
+        TCA9554A tca9554a(&i2c, TCA9554A::SLAVE_ADDRESS_38H);
+        // Initializes TCA9554A (I2C GPIO Expander)
+        tca9554a.configurePort(PORT_OE_LVS1, TCA9554A::DIR_OUTPUT);
+        tca9554a.configurePort(PORT_OE_LVS2, TCA9554A::DIR_OUTPUT);
+        // Makes sure that the OE is low first.
+        tca9554a.setPortLevel(PORT_OE_LVS1, TCA9554A::LOW);
+        tca9554a.setPortLevel(PORT_OE_LVS2, TCA9554A::LOW);
+        wait_ms(TIME_FOR_OE_MS);
+        // Sets the OE pins high.
+        tca9554a.setPortLevel(PORT_OE_LVS1, TCA9554A::HIGH);
+        tca9554a.setPortLevel(PORT_OE_LVS2, TCA9554A::HIGH);
+    }
+#endif    
     // main loop
     while(1)
     {