iOSのBLEコントローラアプリ「RCBController」とmbed HRM1017を接続し、RCサーボモータを操作するテストプログラムです。

Dependencies:   BLE_API_Native_IRC Servo mbed

Fork of BLE_RCBController by Junichi Katsu

  • 古いBLEライブラリを使っているのでプラットフォームは”Nordic nRF51822”を選択してください。
  • ライブラリ類はUpdateしないでください。コンパイルエラーになります。

うまく接続できない時は、iPhone/iPadのBluetoothをOFF->ONしてキャッシュをクリアしてみてください。

/media/uploads/robo8080/img_1560.jpg

Committer:
jksoft
Date:
Thu Jul 10 14:21:52 2014 +0000
Revision:
0:8c643bfe55b7
??

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 0:8c643bfe55b7 1 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
jksoft 0:8c643bfe55b7 2 *
jksoft 0:8c643bfe55b7 3 * The information contained herein is property of Nordic Semiconductor ASA.
jksoft 0:8c643bfe55b7 4 * Terms and conditions of usage are described in detail in NORDIC
jksoft 0:8c643bfe55b7 5 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
jksoft 0:8c643bfe55b7 6 *
jksoft 0:8c643bfe55b7 7 * Licensees are granted free, non-transferable use of the information. NO
jksoft 0:8c643bfe55b7 8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
jksoft 0:8c643bfe55b7 9 * the file.
jksoft 0:8c643bfe55b7 10 *
jksoft 0:8c643bfe55b7 11 */
jksoft 0:8c643bfe55b7 12
jksoft 0:8c643bfe55b7 13 #include <string.h>
jksoft 0:8c643bfe55b7 14 #include <stdint.h>
jksoft 0:8c643bfe55b7 15 #include <stdbool.h>
jksoft 0:8c643bfe55b7 16 #include <nrf51.h>
jksoft 0:8c643bfe55b7 17 #include "ble_error_log.h"
jksoft 0:8c643bfe55b7 18 #include "app_util.h"
jksoft 0:8c643bfe55b7 19 #include "app_error.h"
jksoft 0:8c643bfe55b7 20 #include "nrf_gpio.h"
jksoft 0:8c643bfe55b7 21 #include "pstorage.h"
jksoft 0:8c643bfe55b7 22
jksoft 0:8c643bfe55b7 23
jksoft 0:8c643bfe55b7 24 // Made static to avoid the error_log to go on the stack.
jksoft 0:8c643bfe55b7 25 static ble_error_log_data_t m_ble_error_log; /**< . */
jksoft 0:8c643bfe55b7 26 //lint -esym(526,__Vectors)
jksoft 0:8c643bfe55b7 27 extern uint32_t * __Vectors; /**< The initialization vector holds the address to __initial_sp that will be used when fetching the stack. */
jksoft 0:8c643bfe55b7 28
jksoft 0:8c643bfe55b7 29 static void fetch_stack(ble_error_log_data_t * error_log)
jksoft 0:8c643bfe55b7 30 {
jksoft 0:8c643bfe55b7 31 // KTOWN: Temporarily removed 06022014
jksoft 0:8c643bfe55b7 32 /*
jksoft 0:8c643bfe55b7 33 uint32_t * p_stack;
jksoft 0:8c643bfe55b7 34 uint32_t * initial_sp;
jksoft 0:8c643bfe55b7 35 uint32_t length;
jksoft 0:8c643bfe55b7 36
jksoft 0:8c643bfe55b7 37 initial_sp = (uint32_t *) __Vectors;
jksoft 0:8c643bfe55b7 38 p_stack = (uint32_t *) GET_SP();
jksoft 0:8c643bfe55b7 39
jksoft 0:8c643bfe55b7 40 length = ((uint32_t) initial_sp) - ((uint32_t) p_stack);
jksoft 0:8c643bfe55b7 41 memcpy(error_log->stack_info,
jksoft 0:8c643bfe55b7 42 p_stack,
jksoft 0:8c643bfe55b7 43 (length > STACK_DUMP_LENGTH) ? STACK_DUMP_LENGTH : length);
jksoft 0:8c643bfe55b7 44 */
jksoft 0:8c643bfe55b7 45 }
jksoft 0:8c643bfe55b7 46
jksoft 0:8c643bfe55b7 47 uint32_t ble_error_log_write(uint32_t err_code, const uint8_t * p_message, uint16_t line_number)
jksoft 0:8c643bfe55b7 48 {
jksoft 0:8c643bfe55b7 49 m_ble_error_log.failure = true;
jksoft 0:8c643bfe55b7 50 m_ble_error_log.err_code = err_code;
jksoft 0:8c643bfe55b7 51 m_ble_error_log.line_number = line_number;
jksoft 0:8c643bfe55b7 52
jksoft 0:8c643bfe55b7 53 strncpy((char *)m_ble_error_log.message, (const char *)p_message, ERROR_MESSAGE_LENGTH - 1);
jksoft 0:8c643bfe55b7 54 m_ble_error_log.message[ERROR_MESSAGE_LENGTH - 1] = '\0';
jksoft 0:8c643bfe55b7 55
jksoft 0:8c643bfe55b7 56 fetch_stack(&m_ble_error_log);
jksoft 0:8c643bfe55b7 57
jksoft 0:8c643bfe55b7 58 // Write to flash removed, to be redone.
jksoft 0:8c643bfe55b7 59
jksoft 0:8c643bfe55b7 60 return NRF_SUCCESS;
jksoft 0:8c643bfe55b7 61 }