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) 2013 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 /**@file
jksoft 0:8c643bfe55b7 14 *
jksoft 0:8c643bfe55b7 15 * @defgroup app_fifo FIFO implementation
jksoft 0:8c643bfe55b7 16 * @{
jksoft 0:8c643bfe55b7 17 * @ingroup app_common
jksoft 0:8c643bfe55b7 18 *
jksoft 0:8c643bfe55b7 19 * @brief FIFO implementation.
jksoft 0:8c643bfe55b7 20 */
jksoft 0:8c643bfe55b7 21
jksoft 0:8c643bfe55b7 22 #ifndef APP_FIFO_H__
jksoft 0:8c643bfe55b7 23 #define APP_FIFO_H__
jksoft 0:8c643bfe55b7 24
jksoft 0:8c643bfe55b7 25 #include <stdint.h>
jksoft 0:8c643bfe55b7 26 #include <stdlib.h>
jksoft 0:8c643bfe55b7 27 #include "nordic_global.h"
jksoft 0:8c643bfe55b7 28 #include "nrf_error.h"
jksoft 0:8c643bfe55b7 29
jksoft 0:8c643bfe55b7 30 /**@brief A FIFO instance structure. Keeps track of which bytes to read and write next.
jksoft 0:8c643bfe55b7 31 * Also it keeps the information about which memory is allocated for the buffer
jksoft 0:8c643bfe55b7 32 * and its size. This needs to be initialized by app_fifo_init() before use.
jksoft 0:8c643bfe55b7 33 */
jksoft 0:8c643bfe55b7 34 typedef struct
jksoft 0:8c643bfe55b7 35 {
jksoft 0:8c643bfe55b7 36 uint8_t * p_buf; /**< Pointer to FIFO buffer memory. */
jksoft 0:8c643bfe55b7 37 uint16_t buf_size_mask; /**< Read/write index mask. Also used for size checking. */
jksoft 0:8c643bfe55b7 38 volatile uint32_t read_pos; /**< Next read position in the FIFO buffer. */
jksoft 0:8c643bfe55b7 39 volatile uint32_t write_pos; /**< Next write position in the FIFO buffer. */
jksoft 0:8c643bfe55b7 40 } app_fifo_t;
jksoft 0:8c643bfe55b7 41
jksoft 0:8c643bfe55b7 42 /**@brief Function for initializing the FIFO.
jksoft 0:8c643bfe55b7 43 *
jksoft 0:8c643bfe55b7 44 * @param[out] p_fifo FIFO object.
jksoft 0:8c643bfe55b7 45 * @param[in] p_buf FIFO buffer for storing data. The buffer size has to be a power of two.
jksoft 0:8c643bfe55b7 46 * @param[in] buf_size Size of the FIFO buffer provided, has to be a power of 2.
jksoft 0:8c643bfe55b7 47 *
jksoft 0:8c643bfe55b7 48 * @retval NRF_SUCCESS If initialization was successful.
jksoft 0:8c643bfe55b7 49 * @retval NRF_ERROR_NULL If a NULL pointer is provided as buffer.
jksoft 0:8c643bfe55b7 50 * @retval NRF_ERROR_INVALID_LENGTH If size of buffer provided is not a power of two.
jksoft 0:8c643bfe55b7 51 */
jksoft 0:8c643bfe55b7 52 uint32_t app_fifo_init(app_fifo_t * p_fifo, uint8_t * p_buf, uint16_t buf_size);
jksoft 0:8c643bfe55b7 53
jksoft 0:8c643bfe55b7 54 /**@brief Function for adding an element to the FIFO.
jksoft 0:8c643bfe55b7 55 *
jksoft 0:8c643bfe55b7 56 * @param[in] p_fifo Pointer to the FIFO.
jksoft 0:8c643bfe55b7 57 * @param[in] byte Data byte to add to the FIFO.
jksoft 0:8c643bfe55b7 58 *
jksoft 0:8c643bfe55b7 59 * @retval NRF_SUCCESS If an element has been successfully added to the FIFO.
jksoft 0:8c643bfe55b7 60 * @retval NRF_ERROR_NO_MEM If the FIFO is full.
jksoft 0:8c643bfe55b7 61 */
jksoft 0:8c643bfe55b7 62 uint32_t app_fifo_put(app_fifo_t * p_fifo, uint8_t byte);
jksoft 0:8c643bfe55b7 63
jksoft 0:8c643bfe55b7 64 /**@brief Function for getting the next element from the FIFO.
jksoft 0:8c643bfe55b7 65 *
jksoft 0:8c643bfe55b7 66 * @param[in] p_fifo Pointer to the FIFO.
jksoft 0:8c643bfe55b7 67 * @param[out] p_byte Byte fetched from the FIFO.
jksoft 0:8c643bfe55b7 68 *
jksoft 0:8c643bfe55b7 69 * @retval NRF_SUCCESS If an element was returned.
jksoft 0:8c643bfe55b7 70 * @retval NRF_ERROR_NOT_FOUND If there is no more elements in the queue.
jksoft 0:8c643bfe55b7 71 */
jksoft 0:8c643bfe55b7 72 uint32_t app_fifo_get(app_fifo_t * p_fifo, uint8_t * p_byte);
jksoft 0:8c643bfe55b7 73
jksoft 0:8c643bfe55b7 74 /**@brief Function for flushing the FIFO.
jksoft 0:8c643bfe55b7 75 *
jksoft 0:8c643bfe55b7 76 * @param[in] p_fifo Pointer to the FIFO.
jksoft 0:8c643bfe55b7 77 *
jksoft 0:8c643bfe55b7 78 * @retval NRF_SUCCESS If the FIFO flushed successfully.
jksoft 0:8c643bfe55b7 79 */
jksoft 0:8c643bfe55b7 80 uint32_t app_fifo_flush(app_fifo_t * p_fifo);
jksoft 0:8c643bfe55b7 81
jksoft 0:8c643bfe55b7 82 #endif // APP_FIFO_H__
jksoft 0:8c643bfe55b7 83
jksoft 0:8c643bfe55b7 84 /** @} */