試作テストバージョン

Dependencies:   BLE_API TB6612FNG mbed

Fork of BLE_RCBController2 by Junichi Katsu

Files at this revision

API Documentation at this revision

Comitter:
jksoft
Date:
Fri Aug 29 04:40:46 2014 +0000
Parent:
3:9a2487262bb2
Commit message:
test

Changed in this revision

TB6612FNG.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
nRF51822/btle/btle.cpp Show annotated file Show diff for this revision Revisions of this file
nRF51822/projectconfig.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TB6612FNG.lib	Fri Aug 29 04:40:46 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/jksoft/code/TB6612FNG/#95d5e9ee8c15
--- a/main.cpp	Wed Aug 20 13:37:04 2014 +0000
+++ b/main.cpp	Fri Aug 29 04:40:46 2014 +0000
@@ -1,15 +1,19 @@
 #include "mbed.h"
 #include "BLEDevice.h"
 #include "RCBController.h"
+#include "TB6612.h"
 
 #define DBG 1
 
 BLEDevice  ble;
 Serial  pc(USBTX, USBRX);
 /* LEDs for indication: */
-DigitalOut  ConnectStateLed(LED1);
-PwmOut  ControllerStateLed(LED2);
+DigitalOut  ConnectStateLed(P0_18);
+DigitalOut  outlow(P0_20);
+//PwmOut  ControllerStateLed(LED2);
 
+TB6612 left(P0_29,P0_24,P0_23);
+TB6612 right(P0_28,P0_30,P0_0);
 
 /* RCBController Service */
 static const uint16_t RCBController_service_uuid = 0xFFF0;
@@ -54,7 +58,9 @@
 		pc.printf("DATA:%02X %02X %d %d %d %d %d %d %d %02X\n\r",controller.data[0],controller.data[1],controller.data[2],controller.data[3],controller.data[4],
 															   controller.data[5],controller.data[6],controller.data[7],controller.data[8],controller.data[9]);
 #endif
-		ControllerStateLed = (float)controller.status.LeftAnalogLR / 255.0;		
+			left = ((float)((int)controller.status.LeftAnalogUD -128) / 128.0);
+			right = ((float)((int)controller.status.RightAnalogUD -128) / 128.0);
+		//ControllerStateLed = (float)controller.status.LeftAnalogLR / 255.0;		
 	}
 		 
 }
@@ -66,9 +72,14 @@
 /**************************************************************************/
 int main(void)
 {
+	pc.baud(921600);
+	
+	
+	ConnectStateLed = 1;
 #if DBG
 		pc.printf("Start\n\r");
 #endif
+	outlow = 0;
 	
     ble.init(); 
     ble.onConnection(onConnected);
@@ -79,7 +90,7 @@
     ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED);
     ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
     ble.accumulateAdvertisingPayload(GapAdvertisingData::SHORTENED_LOCAL_NAME,
-                                    (const uint8_t *)"mbed HRM1017", sizeof("mbed HRM1017") - 1);
+                                    (const uint8_t *)"mbed WallbotBLE", sizeof("mbed WallbotBLE") - 1);
     ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS,
                                     (const uint8_t *)RCBController_service_uuid, sizeof(RCBController_service_uuid));
 
@@ -87,6 +98,7 @@
     ble.startAdvertising();
 
     ble.addService(RCBControllerService);
+    
 
     while (true) {
         ble.waitForEvent();
--- a/nRF51822/btle/btle.cpp	Wed Aug 20 13:37:04 2014 +0000
+++ b/nRF51822/btle/btle.cpp	Fri Aug 29 04:40:46 2014 +0000
@@ -63,8 +63,8 @@
 error_t btle_init(void)
 {
     APP_TIMER_INIT(0, 8, 5, false);
-//  SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, false);
-	SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_RC_250_PPM_4000MS_CALIBRATION, false);
+  	SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, false);
+//	SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_RC_250_PPM_4000MS_CALIBRATION, false);
 
     ASSERT_STATUS( softdevice_ble_evt_handler_set(btle_handler));
     ASSERT_STATUS( softdevice_sys_evt_handler_set(sys_evt_dispatch));
--- a/nRF51822/projectconfig.h	Wed Aug 20 13:37:04 2014 +0000
+++ b/nRF51822/projectconfig.h	Fri Aug 29 04:40:46 2014 +0000
@@ -113,7 +113,7 @@
 
     /*--------------------------------- GAP -------------------------------*/
     #define CFG_GAP_APPEARANCE                         BLE_APPEARANCE_GENERIC_TAG
-    #define CFG_GAP_LOCAL_NAME                         "mbed HRM1017"
+    #define CFG_GAP_LOCAL_NAME                         "mbed WallbotBLE"
 
     #define CFG_GAP_CONNECTION_MIN_INTERVAL_MS         50//500                      /**< Minimum acceptable connection interval */
     #define CFG_GAP_CONNECTION_MAX_INTERVAL_MS         100//1000                     /**< Maximum acceptable connection interval */