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:24:20 2014 +0000
Revision:
1:48f6e08a3ac2
2014.08.20?????BLE?????????????; ???mbed?????????????????; mbed HRM1017; Nordic nRF51822

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 1:48f6e08a3ac2 1 /*
jksoft 1:48f6e08a3ac2 2 * Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
jksoft 1:48f6e08a3ac2 3 *
jksoft 1:48f6e08a3ac2 4 * The information contained herein is confidential property of Nordic Semiconductor. The use,
jksoft 1:48f6e08a3ac2 5 * copying, transfer or disclosure of such information is prohibited except by express written
jksoft 1:48f6e08a3ac2 6 * agreement with Nordic Semiconductor.
jksoft 1:48f6e08a3ac2 7 *
jksoft 1:48f6e08a3ac2 8 */
jksoft 1:48f6e08a3ac2 9 /**
jksoft 1:48f6e08a3ac2 10 @defgroup nrf_mbr_api Master Boot Record API
jksoft 1:48f6e08a3ac2 11 @{
jksoft 1:48f6e08a3ac2 12
jksoft 1:48f6e08a3ac2 13 @brief APIs for updating SoftDevice and BootLoader
jksoft 1:48f6e08a3ac2 14
jksoft 1:48f6e08a3ac2 15 */
jksoft 1:48f6e08a3ac2 16
jksoft 1:48f6e08a3ac2 17 /* Header guard */
jksoft 1:48f6e08a3ac2 18 #ifndef NRF_MBR_H__
jksoft 1:48f6e08a3ac2 19 #define NRF_MBR_H__
jksoft 1:48f6e08a3ac2 20
jksoft 1:48f6e08a3ac2 21 #include "nrf_svc.h"
jksoft 1:48f6e08a3ac2 22 #include <stdint.h>
jksoft 1:48f6e08a3ac2 23
jksoft 1:48f6e08a3ac2 24
jksoft 1:48f6e08a3ac2 25 /** @addtogroup NRF_MBR_DEFINES Defines
jksoft 1:48f6e08a3ac2 26 * @{ */
jksoft 1:48f6e08a3ac2 27
jksoft 1:48f6e08a3ac2 28 /**@brief MBR SVC Base number. */
jksoft 1:48f6e08a3ac2 29 #define MBR_SVC_BASE 0x18
jksoft 1:48f6e08a3ac2 30 /** @} */
jksoft 1:48f6e08a3ac2 31
jksoft 1:48f6e08a3ac2 32 /** @addtogroup NRF_MBR_ENUMS Enumerations
jksoft 1:48f6e08a3ac2 33 * @{ */
jksoft 1:48f6e08a3ac2 34
jksoft 1:48f6e08a3ac2 35 /**@brief nRF Master Boot Record API SVC numbers. */
jksoft 1:48f6e08a3ac2 36 enum NRF_MBR_SVCS
jksoft 1:48f6e08a3ac2 37 {
jksoft 1:48f6e08a3ac2 38 SD_MBR_COMMAND = MBR_SVC_BASE, /**< ::sd_mbr_command */
jksoft 1:48f6e08a3ac2 39 };
jksoft 1:48f6e08a3ac2 40
jksoft 1:48f6e08a3ac2 41 /**@brief Possible values for ::sd_mbr_command_t.command */
jksoft 1:48f6e08a3ac2 42 enum NRF_MBR_COMMANDS
jksoft 1:48f6e08a3ac2 43 {
jksoft 1:48f6e08a3ac2 44 SD_MBR_COMMAND_COPY_BL, /**< Copy a new a new BootLoader. @see sd_mbr_command_copy_bl_t */
jksoft 1:48f6e08a3ac2 45 SD_MBR_COMMAND_COPY_SD, /**< Copy a new SoftDevice. @see ::sd_mbr_command_copy_sd_t*/
jksoft 1:48f6e08a3ac2 46 SD_MBR_COMMAND_INIT_SD, /**< Init forwarding interrupts to SD, and run reset function in SD*/
jksoft 1:48f6e08a3ac2 47 SD_MBR_COMMAND_COMPARE, /**< This command works like memcmp. @see ::sd_mbr_command_compare_t*/
jksoft 1:48f6e08a3ac2 48 SD_MBR_COMMAND_VECTOR_TABLE_BASE_SET, /**< Start forwarding all exception to this address @see ::sd_mbr_command_vector_table_base_set_t*/
jksoft 1:48f6e08a3ac2 49 };
jksoft 1:48f6e08a3ac2 50
jksoft 1:48f6e08a3ac2 51 /** @} */
jksoft 1:48f6e08a3ac2 52
jksoft 1:48f6e08a3ac2 53 /** @addtogroup NRF_MBR_TYPES Types
jksoft 1:48f6e08a3ac2 54 * @{ */
jksoft 1:48f6e08a3ac2 55
jksoft 1:48f6e08a3ac2 56 /**@brief This command copies part of a new SoftDevice
jksoft 1:48f6e08a3ac2 57 * The destination area is erased before copying.
jksoft 1:48f6e08a3ac2 58 * If dst is in the middle of a flash page, that whole flash page will be erased.
jksoft 1:48f6e08a3ac2 59 * If (dst+len) is in the middle of a flash page, that whole flash page will be erased.
jksoft 1:48f6e08a3ac2 60 *
jksoft 1:48f6e08a3ac2 61 * The user of this function is responsible for setting the PROTENSET registers.
jksoft 1:48f6e08a3ac2 62 *
jksoft 1:48f6e08a3ac2 63 * @retval ::NRF_SUCCESS indicates that the contents of the memory blocks where copied correctly.
jksoft 1:48f6e08a3ac2 64 * @retval ::NRF_ERROR_INTERNAL indicates that the contents of the memory blocks where not verified correctly after copying.
jksoft 1:48f6e08a3ac2 65 */
jksoft 1:48f6e08a3ac2 66 typedef struct
jksoft 1:48f6e08a3ac2 67 {
jksoft 1:48f6e08a3ac2 68 uint32_t *src; /**< Pointer to the source of data to be copied.*/
jksoft 1:48f6e08a3ac2 69 uint32_t *dst; /**< Pointer to the destination where the content is to be copied.*/
jksoft 1:48f6e08a3ac2 70 uint32_t len; /**< Number of 32 bit words to copy. Must be a multiple of 256 words*/
jksoft 1:48f6e08a3ac2 71 }sd_mbr_command_copy_sd_t;
jksoft 1:48f6e08a3ac2 72
jksoft 1:48f6e08a3ac2 73
jksoft 1:48f6e08a3ac2 74 /**@brief This command works like memcmp, but takes the length in words.
jksoft 1:48f6e08a3ac2 75 *
jksoft 1:48f6e08a3ac2 76 * @retval ::NRF_SUCCESS indicates that the contents of both memory blocks are equal.
jksoft 1:48f6e08a3ac2 77 * @retval ::NRF_ERROR_NULL indicates that the contents of the memory blocks are not equal.
jksoft 1:48f6e08a3ac2 78 */
jksoft 1:48f6e08a3ac2 79 typedef struct
jksoft 1:48f6e08a3ac2 80 {
jksoft 1:48f6e08a3ac2 81 uint32_t *ptr1; /**< Pointer to block of memory */
jksoft 1:48f6e08a3ac2 82 uint32_t *ptr2; /**< Pointer to block of memory */
jksoft 1:48f6e08a3ac2 83 uint32_t len; /**< Number of 32 bit words to compare*/
jksoft 1:48f6e08a3ac2 84 }sd_mbr_command_compare_t;
jksoft 1:48f6e08a3ac2 85
jksoft 1:48f6e08a3ac2 86
jksoft 1:48f6e08a3ac2 87 /**@brief This command copies a new BootLoader.
jksoft 1:48f6e08a3ac2 88 * With this command, destination of BootLoader is always the address written in NRF_UICR->BOOTADDR.
jksoft 1:48f6e08a3ac2 89 *
jksoft 1:48f6e08a3ac2 90 * Destination is erased by this function.
jksoft 1:48f6e08a3ac2 91 * If (destination+bl_len) is in the middle of a flash page, that whole flash page will be erased.
jksoft 1:48f6e08a3ac2 92 *
jksoft 1:48f6e08a3ac2 93 * This function will use PROTENSET to protect the flash that is not intended to be written.
jksoft 1:48f6e08a3ac2 94 *
jksoft 1:48f6e08a3ac2 95 * On Success, this function will not return. It will start the new BootLoader from reset-vector as normal.
jksoft 1:48f6e08a3ac2 96 *
jksoft 1:48f6e08a3ac2 97 * @retval ::NRF_ERROR_INVALID_STATE indicates that something was wrong.
jksoft 1:48f6e08a3ac2 98 * @retval ::NRF_ERROR_INTERNAL indicates an internal error that should not happen.
jksoft 1:48f6e08a3ac2 99 * @retval ::NRF_ERROR_FORBIDDEN if NRF_UICR->BOOTADDR is not set
jksoft 1:48f6e08a3ac2 100 * @retval ::NRF_ERROR_INVALID_LENGTH is invalid.
jksoft 1:48f6e08a3ac2 101 */
jksoft 1:48f6e08a3ac2 102 typedef struct
jksoft 1:48f6e08a3ac2 103 {
jksoft 1:48f6e08a3ac2 104 uint32_t *bl_src; /**< Pointer to the source of the Bootloader to be be copied.*/
jksoft 1:48f6e08a3ac2 105 uint32_t bl_len; /**< Number of 32 bit words to copy for BootLoader */
jksoft 1:48f6e08a3ac2 106 }sd_mbr_command_copy_bl_t;
jksoft 1:48f6e08a3ac2 107
jksoft 1:48f6e08a3ac2 108 /**@brief Sets the base address of the interrupt vector table for interrupts forwarded from the MBR
jksoft 1:48f6e08a3ac2 109 *
jksoft 1:48f6e08a3ac2 110 * Once this function has been called, this address is where the MBR will start to forward interrupts to after a reset.
jksoft 1:48f6e08a3ac2 111 *
jksoft 1:48f6e08a3ac2 112 * To restore default forwarding thiss function should be called with @param address set to 0.
jksoft 1:48f6e08a3ac2 113 * The MBR will then start forwarding to interrupts to the adress in NFR_UICR->BOOTADDR or to the SoftDevice if the BOOTADDR is not set.
jksoft 1:48f6e08a3ac2 114 *
jksoft 1:48f6e08a3ac2 115 * @retval ::NRF_SUCCESS
jksoft 1:48f6e08a3ac2 116 */
jksoft 1:48f6e08a3ac2 117 typedef struct
jksoft 1:48f6e08a3ac2 118 {
jksoft 1:48f6e08a3ac2 119 uint32_t address; /**< The base address of the interrupt vector table for forwarded interrupts.*/
jksoft 1:48f6e08a3ac2 120 }sd_mbr_command_vector_table_base_set_t;
jksoft 1:48f6e08a3ac2 121
jksoft 1:48f6e08a3ac2 122 typedef struct
jksoft 1:48f6e08a3ac2 123 {
jksoft 1:48f6e08a3ac2 124 uint32_t command; /**< type of command to be issued see @ref NRF_MBR_COMMANDS. */
jksoft 1:48f6e08a3ac2 125 union
jksoft 1:48f6e08a3ac2 126 {
jksoft 1:48f6e08a3ac2 127 sd_mbr_command_copy_sd_t copy_sd; /**< Parameters for copy*/
jksoft 1:48f6e08a3ac2 128 sd_mbr_command_copy_bl_t copy_bl; /**< Parameters for copy SoftDevice and BootLoader*/
jksoft 1:48f6e08a3ac2 129 sd_mbr_command_compare_t compare; /**< Parameters for verify*/
jksoft 1:48f6e08a3ac2 130 sd_mbr_command_vector_table_base_set_t base_set; /**< Parameters for vector table base set.*/
jksoft 1:48f6e08a3ac2 131 } params;
jksoft 1:48f6e08a3ac2 132 }sd_mbr_command_t;
jksoft 1:48f6e08a3ac2 133
jksoft 1:48f6e08a3ac2 134 /** @} */
jksoft 1:48f6e08a3ac2 135
jksoft 1:48f6e08a3ac2 136 /** @addtogroup NRF_MBR_FUNCTIONS Functions
jksoft 1:48f6e08a3ac2 137 * @{ */
jksoft 1:48f6e08a3ac2 138
jksoft 1:48f6e08a3ac2 139 /**@brief Issue Master Boot Record commands
jksoft 1:48f6e08a3ac2 140 *
jksoft 1:48f6e08a3ac2 141 * Commands used when updating a SoftDevice and bootloader
jksoft 1:48f6e08a3ac2 142 *
jksoft 1:48f6e08a3ac2 143 * @param[in] param Pointer to a struct describing the command
jksoft 1:48f6e08a3ac2 144 *
jksoft 1:48f6e08a3ac2 145 *@note for retvals see ::sd_mbr_command_copy_sd_t ::sd_mbr_command_copy_bl_t ::sd_mbr_command_compare_t
jksoft 1:48f6e08a3ac2 146
jksoft 1:48f6e08a3ac2 147 */
jksoft 1:48f6e08a3ac2 148 SVCALL(SD_MBR_COMMAND, uint32_t, sd_mbr_command(sd_mbr_command_t* param));
jksoft 1:48f6e08a3ac2 149
jksoft 1:48f6e08a3ac2 150 /** @} */
jksoft 1:48f6e08a3ac2 151 #endif // NRF_MBR_H__
jksoft 1:48f6e08a3ac2 152
jksoft 1:48f6e08a3ac2 153 /**
jksoft 1:48f6e08a3ac2 154 @}
jksoft 1:48f6e08a3ac2 155 */