RCBControllerでモータを制御します。うおーるぼっとも動かせました。

Dependencies:   BLE_API TB6612FNG2 mbed nRF51822

Fork of BLE_RCBController2 by Junichi Katsu

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

ライブラリ類をUpdateするとコンパイル出来なくなります。インポートした物をそのまま使って下さい。

RCBControllerでうおーるぼっとを操縦する例 /media/uploads/robo8080/img_1671.jpg

Components / Wallbot
This robot has switch, line sensors and motors. It controls by mbed.

RCBControllerでの操縦は次の4種類あります。 それぞれうおーるぼっとの動きが異なりますので試してみてください。

  • 左十字ボタン
  • 左のみアナログ
  • 右のみアナログ
  • 両方アナログ

うおーるぼっと(LPC1768のソケット)とHRM1017の接続はこれです。

LPC1768 ー HRM1017

p11 ーーー P0_0

p12 ーーー P0_1

p13 ーーー P0_28

p14 ーーー P0_29

p21 ーーー P0_30

p22 ーーー P0_25

GND ーーー GND

/media/uploads/robo8080/img_1711.jpg

/media/uploads/robo8080/img_1703.jpg

HRM1017の電源はうおーるぼっとのUSBコネクタからとります。 /media/uploads/robo8080/img_1674.jpg

Committer:
jksoft
Date:
Wed Aug 20 13:41:01 2014 +0000
Revision:
4:ebda47d22091
Parent:
nRF51822/nordic/nrf-sdk/ble/ble_flash.h@1:48f6e08a3ac2
?????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 1:48f6e08a3ac2 1 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
jksoft 1:48f6e08a3ac2 2 *
jksoft 1:48f6e08a3ac2 3 * The information contained herein is property of Nordic Semiconductor ASA.
jksoft 1:48f6e08a3ac2 4 * Terms and conditions of usage are described in detail in NORDIC
jksoft 1:48f6e08a3ac2 5 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
jksoft 1:48f6e08a3ac2 6 *
jksoft 1:48f6e08a3ac2 7 * Licensees are granted free, non-transferable use of the information. NO
jksoft 1:48f6e08a3ac2 8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
jksoft 1:48f6e08a3ac2 9 * the file.
jksoft 1:48f6e08a3ac2 10 *
jksoft 1:48f6e08a3ac2 11 */
jksoft 1:48f6e08a3ac2 12
jksoft 1:48f6e08a3ac2 13 /** @file
jksoft 1:48f6e08a3ac2 14 *
jksoft 1:48f6e08a3ac2 15 * @defgroup ble_flash_module Flash Manager
jksoft 1:48f6e08a3ac2 16 * @{
jksoft 1:48f6e08a3ac2 17 * @ingroup ble_sdk_lib
jksoft 1:48f6e08a3ac2 18 * @brief Module for accessing flash memory.
jksoft 1:48f6e08a3ac2 19 *
jksoft 1:48f6e08a3ac2 20 * @details It contains functions for reading, writing and erasing one page in flash.
jksoft 1:48f6e08a3ac2 21 *
jksoft 1:48f6e08a3ac2 22 * The module uses the first 32 bits of the flash page to write a magic number in order to
jksoft 1:48f6e08a3ac2 23 * determine if the page has been written or not.
jksoft 1:48f6e08a3ac2 24 *
jksoft 1:48f6e08a3ac2 25 * @note Be careful not to use a page number in the SoftDevice area (which currently occupies the
jksoft 1:48f6e08a3ac2 26 * range 0 to 127), or in your application space! In both cases, this would end up
jksoft 1:48f6e08a3ac2 27 * with a hard fault.
jksoft 1:48f6e08a3ac2 28 */
jksoft 1:48f6e08a3ac2 29
jksoft 1:48f6e08a3ac2 30 #ifndef BLE_FLASH_H__
jksoft 1:48f6e08a3ac2 31 #define BLE_FLASH_H__
jksoft 1:48f6e08a3ac2 32
jksoft 1:48f6e08a3ac2 33 #include <stdint.h>
jksoft 1:48f6e08a3ac2 34 #include <stdbool.h>
jksoft 1:48f6e08a3ac2 35 #include <nrf51.h>
jksoft 1:48f6e08a3ac2 36
jksoft 1:48f6e08a3ac2 37 #define BLE_FLASH_PAGE_SIZE ((uint16_t)NRF_FICR->CODEPAGESIZE) /**< Size of one flash page. */
jksoft 1:48f6e08a3ac2 38 #define BLE_FLASH_MAGIC_NUMBER 0x45DE0000 /**< Magic value to identify if flash contains valid data. */
jksoft 1:48f6e08a3ac2 39 #define BLE_FLASH_EMPTY_MASK 0xFFFFFFFF /**< Bit mask that defines an empty address in flash. */
jksoft 1:48f6e08a3ac2 40
jksoft 1:48f6e08a3ac2 41
jksoft 1:48f6e08a3ac2 42 /**@brief Macro for getting the end of the flash available for application.
jksoft 1:48f6e08a3ac2 43 *
jksoft 1:48f6e08a3ac2 44 * @details The result flash page number indicates the end boundary of the flash available
jksoft 1:48f6e08a3ac2 45 * to the application. If a bootloader is used, the end will be the start of the
jksoft 1:48f6e08a3ac2 46 * bootloader region. Otherwise, the end will be the size of the flash.
jksoft 1:48f6e08a3ac2 47 */
jksoft 1:48f6e08a3ac2 48 #define BLE_FLASH_PAGE_END \
jksoft 1:48f6e08a3ac2 49 ((NRF_UICR->BOOTLOADERADDR != BLE_FLASH_EMPTY_MASK) \
jksoft 1:48f6e08a3ac2 50 ? (NRF_UICR->BOOTLOADERADDR / BLE_FLASH_PAGE_SIZE) \
jksoft 1:48f6e08a3ac2 51 : NRF_FICR->CODESIZE)
jksoft 1:48f6e08a3ac2 52
jksoft 1:48f6e08a3ac2 53 /**@brief Function for erasing the specified flash page, and then writes the given data to this page.
jksoft 1:48f6e08a3ac2 54 *
jksoft 1:48f6e08a3ac2 55 * @warning This operation blocks the CPU. DO NOT use while in a connection!
jksoft 1:48f6e08a3ac2 56 *
jksoft 1:48f6e08a3ac2 57 * @param[in] page_num Page number to update.
jksoft 1:48f6e08a3ac2 58 * @param[in] p_in_array Pointer to a RAM area containing the elements to write in flash.
jksoft 1:48f6e08a3ac2 59 * This area has to be 32 bits aligned.
jksoft 1:48f6e08a3ac2 60 * @param[in] word_count Number of 32 bits words to write in flash.
jksoft 1:48f6e08a3ac2 61 *
jksoft 1:48f6e08a3ac2 62 * @return NRF_SUCCESS on successful flash write, otherwise an error code.
jksoft 1:48f6e08a3ac2 63 */
jksoft 1:48f6e08a3ac2 64 uint32_t ble_flash_page_write(uint8_t page_num, uint32_t * p_in_array, uint8_t word_count);
jksoft 1:48f6e08a3ac2 65
jksoft 1:48f6e08a3ac2 66 /**@brief Function for reading data from flash to RAM.
jksoft 1:48f6e08a3ac2 67 *
jksoft 1:48f6e08a3ac2 68 * @param[in] page_num Page number to read.
jksoft 1:48f6e08a3ac2 69 * @param[out] p_out_array Pointer to a RAM area where the found data will be written.
jksoft 1:48f6e08a3ac2 70 * This area has to be 32 bits aligned.
jksoft 1:48f6e08a3ac2 71 * @param[out] p_word_count Number of 32 bits words read.
jksoft 1:48f6e08a3ac2 72 *
jksoft 1:48f6e08a3ac2 73 * @return NRF_SUCCESS on successful upload, NRF_ERROR_NOT_FOUND if no valid data has been found
jksoft 1:48f6e08a3ac2 74 * in flash (first 32 bits not equal to the MAGIC_NUMBER+CRC).
jksoft 1:48f6e08a3ac2 75 */
jksoft 1:48f6e08a3ac2 76 uint32_t ble_flash_page_read(uint8_t page_num, uint32_t * p_out_array, uint8_t * p_word_count);
jksoft 1:48f6e08a3ac2 77
jksoft 1:48f6e08a3ac2 78 /**@brief Function for erasing a flash page.
jksoft 1:48f6e08a3ac2 79 *
jksoft 1:48f6e08a3ac2 80 * @note This operation blocks the CPU, so it should not be done while the radio is running!
jksoft 1:48f6e08a3ac2 81 *
jksoft 1:48f6e08a3ac2 82 * @param[in] page_num Page number to erase.
jksoft 1:48f6e08a3ac2 83 *
jksoft 1:48f6e08a3ac2 84 * @return NRF_SUCCESS on success, an error_code otherwise.
jksoft 1:48f6e08a3ac2 85 */
jksoft 1:48f6e08a3ac2 86 uint32_t ble_flash_page_erase(uint8_t page_num);
jksoft 1:48f6e08a3ac2 87
jksoft 1:48f6e08a3ac2 88 /**@brief Function for writing one word to flash.
jksoft 1:48f6e08a3ac2 89 *
jksoft 1:48f6e08a3ac2 90 * @note Flash location to be written must have been erased previously.
jksoft 1:48f6e08a3ac2 91 *
jksoft 1:48f6e08a3ac2 92 * @param[in] p_address Pointer to flash location to be written.
jksoft 1:48f6e08a3ac2 93 * @param[in] value Value to write to flash.
jksoft 1:48f6e08a3ac2 94 *
jksoft 1:48f6e08a3ac2 95 * @return NRF_SUCCESS.
jksoft 1:48f6e08a3ac2 96 */
jksoft 1:48f6e08a3ac2 97 uint32_t ble_flash_word_write(uint32_t * p_address, uint32_t value);
jksoft 1:48f6e08a3ac2 98
jksoft 1:48f6e08a3ac2 99 /**@brief Function for writing a data block to flash.
jksoft 1:48f6e08a3ac2 100 *
jksoft 1:48f6e08a3ac2 101 * @note Flash locations to be written must have been erased previously.
jksoft 1:48f6e08a3ac2 102 *
jksoft 1:48f6e08a3ac2 103 * @param[in] p_address Pointer to start of flash location to be written.
jksoft 1:48f6e08a3ac2 104 * @param[in] p_in_array Pointer to start of flash block to be written.
jksoft 1:48f6e08a3ac2 105 * @param[in] word_count Number of words to be written.
jksoft 1:48f6e08a3ac2 106 *
jksoft 1:48f6e08a3ac2 107 * @return NRF_SUCCESS.
jksoft 1:48f6e08a3ac2 108 */
jksoft 1:48f6e08a3ac2 109 uint32_t ble_flash_block_write(uint32_t * p_address, uint32_t * p_in_array, uint16_t word_count);
jksoft 1:48f6e08a3ac2 110
jksoft 1:48f6e08a3ac2 111 /**@brief Function for computing pointer to start of specified flash page.
jksoft 1:48f6e08a3ac2 112 *
jksoft 1:48f6e08a3ac2 113 * @param[in] page_num Page number.
jksoft 1:48f6e08a3ac2 114 * @param[out] pp_page_addr Pointer to start of flash page.
jksoft 1:48f6e08a3ac2 115 *
jksoft 1:48f6e08a3ac2 116 * @return NRF_SUCCESS.
jksoft 1:48f6e08a3ac2 117 */
jksoft 1:48f6e08a3ac2 118 uint32_t ble_flash_page_addr(uint8_t page_num, uint32_t ** pp_page_addr);
jksoft 1:48f6e08a3ac2 119
jksoft 1:48f6e08a3ac2 120 /**@brief Function for calculating a 16 bit CRC using the CRC-16-CCITT scheme.
jksoft 1:48f6e08a3ac2 121 *
jksoft 1:48f6e08a3ac2 122 * @param[in] p_data Pointer to data on which the CRC is to be calulated.
jksoft 1:48f6e08a3ac2 123 * @param[in] size Number of bytes on which the CRC is to be calulated.
jksoft 1:48f6e08a3ac2 124 * @param[in] p_crc Initial CRC value (if NULL, a preset value is used as the initial value).
jksoft 1:48f6e08a3ac2 125 *
jksoft 1:48f6e08a3ac2 126 * @return Calculated CRC.
jksoft 1:48f6e08a3ac2 127 */
jksoft 1:48f6e08a3ac2 128 uint16_t ble_flash_crc16_compute(uint8_t * p_data, uint16_t size, uint16_t * p_crc);
jksoft 1:48f6e08a3ac2 129
jksoft 1:48f6e08a3ac2 130 /**@brief Function for handling flashing module Radio Notification event.
jksoft 1:48f6e08a3ac2 131 *
jksoft 1:48f6e08a3ac2 132 * @note For flash writing to work safely while in a connection or while advertising, this function
jksoft 1:48f6e08a3ac2 133 * MUST be called from the Radio Notification module's event handler (see
jksoft 1:48f6e08a3ac2 134 * @ref ble_radio_notification for details).
jksoft 1:48f6e08a3ac2 135 *
jksoft 1:48f6e08a3ac2 136 * @param[in] radio_active TRUE if radio is active (or about to become active), FALSE otherwise.
jksoft 1:48f6e08a3ac2 137 */
jksoft 1:48f6e08a3ac2 138 void ble_flash_on_radio_active_evt(bool radio_active);
jksoft 1:48f6e08a3ac2 139
jksoft 1:48f6e08a3ac2 140 #endif // BLE_FLASH_H__
jksoft 1:48f6e08a3ac2 141
jksoft 1:48f6e08a3ac2 142 /** @} */