SDG+USBHost(Mouse) Sample

Dependencies:   Sound_Generator USBHost_custom

Fork of SDG_Mouse_Sample by GR-PEACH_producer_meeting

Information

Japanese version is available in lower part of this page.
このページの後半に日本語版が用意されています.

What is this?

This program is a demonstration that sounds the sound by mouse operation by using USBHost(Mouse) and Sound Generator.

Settings

Close JP3 of GR-PEACH.
/media/uploads/RyoheiHagimoto/sdg-mouse.jpg

Operation

operationeffect
Right clickSounds
Left clickReset to base tone (C)
Moves the mouse to the rightLower the sound
Moves the mouse to the leftHigher the sound
Center cursorAdjust the sensitivity.
Reset the reference value in the click.

Others

The default setting of serial communication (baud rate etc.) in mbed is shown the following link.
Please refer to the link and change the settings of your PC terminal software.
The default value of baud rate in mbed is 9600, and this application uses baud rate 9600.
https://developer.mbed.org/teams/Renesas/wiki/GR-PEACH-Getting-Started#install-the-usb-serial-communication


概要

このプログラムは、USBHost(Mouse) + Sound Generatorで、マウス操作による擬似笛デモです。

設定

GR-PEACHのJP3をショートする必要があります。
/media/uploads/RyoheiHagimoto/sdg-mouse.jpg

操作方法

操作内容
右クリック音出力開始
左クリック基準音(ド)にリセット
マウス右移動高音になります
マウス左移動低音になります
センターカーソル音高低の変化量調整(クリックで基準値にリセット)

Others

mbedのシリアル通信(ボーレート等)のデフォルト設定は以下のリンクに示しています。
リンクを参考に、お使いのPCターミナルソフトの設定を変更して下さい。
mbedでのボーレートのデフォルト値は9600で、このサンプルではボーレート9600を使います。
https://developer.mbed.org/teams/Renesas/wiki/GR-PEACH-Getting-Started#install-the-usb-serial-communication

Committer:
mbed_official
Date:
Mon Jan 19 14:30:37 2015 +0000
Revision:
27:4206883f4cb7
Synchronized with git revision 0ab8d2e6b3d884137dcb5c62d29a07abe132bac7

Full URL: https://github.com/mbedmicro/mbed/commit/0ab8d2e6b3d884137dcb5c62d29a07abe132bac7/

RZ_A1H - Implement some USB functions and fix some bugs about USBHost common codes.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 27:4206883f4cb7 1 /*******************************************************************************
mbed_official 27:4206883f4cb7 2 * DISCLAIMER
mbed_official 27:4206883f4cb7 3 * This software is supplied by Renesas Electronics Corporation and is only
mbed_official 27:4206883f4cb7 4 * intended for use with Renesas products. No other uses are authorized. This
mbed_official 27:4206883f4cb7 5 * software is owned by Renesas Electronics Corporation and is protected under
mbed_official 27:4206883f4cb7 6 * all applicable laws, including copyright laws.
mbed_official 27:4206883f4cb7 7 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
mbed_official 27:4206883f4cb7 8 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
mbed_official 27:4206883f4cb7 9 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
mbed_official 27:4206883f4cb7 10 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
mbed_official 27:4206883f4cb7 11 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
mbed_official 27:4206883f4cb7 12 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
mbed_official 27:4206883f4cb7 13 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
mbed_official 27:4206883f4cb7 14 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
mbed_official 27:4206883f4cb7 15 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
mbed_official 27:4206883f4cb7 16 * Renesas reserves the right, without notice, to make changes to this software
mbed_official 27:4206883f4cb7 17 * and to discontinue the availability of this software. By using this software,
mbed_official 27:4206883f4cb7 18 * you agree to the additional terms and conditions found by accessing the
mbed_official 27:4206883f4cb7 19 * following link:
mbed_official 27:4206883f4cb7 20 * http://www.renesas.com/disclaimer
mbed_official 27:4206883f4cb7 21 * Copyright (C) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
mbed_official 27:4206883f4cb7 22 *******************************************************************************/
mbed_official 27:4206883f4cb7 23 /*******************************************************************************
mbed_official 27:4206883f4cb7 24 * File Name : usb_host.h
mbed_official 27:4206883f4cb7 25 * $Rev: 1116 $
mbed_official 27:4206883f4cb7 26 * $Date:: 2014-07-09 16:29:19 +0900#$
mbed_official 27:4206883f4cb7 27 * Description : RZ/A1H R7S72100 USB Sample Program
mbed_official 27:4206883f4cb7 28 *******************************************************************************/
mbed_official 27:4206883f4cb7 29 #ifndef USB_HOST_H
mbed_official 27:4206883f4cb7 30 #define USB_HOST_H
mbed_official 27:4206883f4cb7 31
mbed_official 27:4206883f4cb7 32
mbed_official 27:4206883f4cb7 33 /*******************************************************************************
mbed_official 27:4206883f4cb7 34 Includes <System Includes> , "Project Includes"
mbed_official 27:4206883f4cb7 35 *******************************************************************************/
mbed_official 27:4206883f4cb7 36 #include "r_typedefs.h"
mbed_official 27:4206883f4cb7 37 #include "iodefine.h"
mbed_official 27:4206883f4cb7 38 #include "rza_io_regrw.h"
mbed_official 27:4206883f4cb7 39
mbed_official 27:4206883f4cb7 40
mbed_official 27:4206883f4cb7 41 /*******************************************************************************
mbed_official 27:4206883f4cb7 42 Typedef definitions
mbed_official 27:4206883f4cb7 43 *******************************************************************************/
mbed_official 27:4206883f4cb7 44
mbed_official 27:4206883f4cb7 45
mbed_official 27:4206883f4cb7 46 /*******************************************************************************
mbed_official 27:4206883f4cb7 47 Macro definitions
mbed_official 27:4206883f4cb7 48 *******************************************************************************/
mbed_official 27:4206883f4cb7 49 #define USB_HOST_DEVICE_0 (0u)
mbed_official 27:4206883f4cb7 50 #define USB_HOST_DEVICE_1 (1u)
mbed_official 27:4206883f4cb7 51 #define USB_HOST_DEVICE_2 (2u)
mbed_official 27:4206883f4cb7 52 #define USB_HOST_DEVICE_3 (3u)
mbed_official 27:4206883f4cb7 53 #define USB_HOST_DEVICE_4 (4u)
mbed_official 27:4206883f4cb7 54 #define USB_HOST_DEVICE_5 (5u)
mbed_official 27:4206883f4cb7 55 #define USB_HOST_DEVICE_6 (6u)
mbed_official 27:4206883f4cb7 56 #define USB_HOST_DEVICE_7 (7u)
mbed_official 27:4206883f4cb7 57 #define USB_HOST_DEVICE_8 (8u)
mbed_official 27:4206883f4cb7 58 #define USB_HOST_DEVICE_9 (9u)
mbed_official 27:4206883f4cb7 59 #define USB_HOST_DEVICE_10 (10u)
mbed_official 27:4206883f4cb7 60
mbed_official 27:4206883f4cb7 61 #define USB_HOST_ENDPOINT_DESC (0x05)
mbed_official 27:4206883f4cb7 62
mbed_official 27:4206883f4cb7 63 #define USB_HOST_BITUPLLE (0x0002u)
mbed_official 27:4206883f4cb7 64 #define USB_HOST_BITUCKSEL (0x0004u)
mbed_official 27:4206883f4cb7 65 #define USB_HOST_BITBWAIT (0x003fu)
mbed_official 27:4206883f4cb7 66
mbed_official 27:4206883f4cb7 67 #define USB_HOST_BUSWAIT_02 (0x0000u)
mbed_official 27:4206883f4cb7 68 #define USB_HOST_BUSWAIT_03 (0x0001u)
mbed_official 27:4206883f4cb7 69 #define USB_HOST_BUSWAIT_04 (0x0002u)
mbed_official 27:4206883f4cb7 70 #define USB_HOST_BUSWAIT_05 (0x0003u)
mbed_official 27:4206883f4cb7 71 #define USB_HOST_BUSWAIT_06 (0x0004u)
mbed_official 27:4206883f4cb7 72 #define USB_HOST_BUSWAIT_07 (0x0005u)
mbed_official 27:4206883f4cb7 73 #define USB_HOST_BUSWAIT_08 (0x0006u)
mbed_official 27:4206883f4cb7 74 #define USB_HOST_BUSWAIT_09 (0x0007u)
mbed_official 27:4206883f4cb7 75 #define USB_HOST_BUSWAIT_10 (0x0008u)
mbed_official 27:4206883f4cb7 76 #define USB_HOST_BUSWAIT_11 (0x0009u)
mbed_official 27:4206883f4cb7 77 #define USB_HOST_BUSWAIT_12 (0x000au)
mbed_official 27:4206883f4cb7 78 #define USB_HOST_BUSWAIT_13 (0x000bu)
mbed_official 27:4206883f4cb7 79 #define USB_HOST_BUSWAIT_14 (0x000cu)
mbed_official 27:4206883f4cb7 80 #define USB_HOST_BUSWAIT_15 (0x000du)
mbed_official 27:4206883f4cb7 81 #define USB_HOST_BUSWAIT_16 (0x000eu)
mbed_official 27:4206883f4cb7 82 #define USB_HOST_BUSWAIT_17 (0x000fu)
mbed_official 27:4206883f4cb7 83
mbed_official 27:4206883f4cb7 84 #define USB_HOST_FS_JSTS (0x0001u)
mbed_official 27:4206883f4cb7 85 #define USB_HOST_LS_JSTS (0x0002u)
mbed_official 27:4206883f4cb7 86
mbed_official 27:4206883f4cb7 87 #define USB_HOST_BITRST (0x0040u)
mbed_official 27:4206883f4cb7 88 #define USB_HOST_BITRESUME (0x0020u)
mbed_official 27:4206883f4cb7 89 #define USB_HOST_BITUACT (0x0010u)
mbed_official 27:4206883f4cb7 90 #define USB_HOST_HSPROC (0x0004u)
mbed_official 27:4206883f4cb7 91 #define USB_HOST_HSMODE (0x0003u)
mbed_official 27:4206883f4cb7 92 #define USB_HOST_FSMODE (0x0002u)
mbed_official 27:4206883f4cb7 93 #define USB_HOST_LSMODE (0x0001u)
mbed_official 27:4206883f4cb7 94 #define USB_HOST_UNDECID (0x0000u)
mbed_official 27:4206883f4cb7 95
mbed_official 27:4206883f4cb7 96 #define USB_HOST_BITRCNT (0x8000u)
mbed_official 27:4206883f4cb7 97 #define USB_HOST_BITDREQE (0x1000u)
mbed_official 27:4206883f4cb7 98 #define USB_HOST_BITMBW (0x0c00u)
mbed_official 27:4206883f4cb7 99 #define USB_HOST_BITMBW_8 (0x0000u)
mbed_official 27:4206883f4cb7 100 #define USB_HOST_BITMBW_16 (0x0400u)
mbed_official 27:4206883f4cb7 101 #define USB_HOST_BITMBW_32 (0x0800u)
mbed_official 27:4206883f4cb7 102 #define USB_HOST_BITBYTE_LITTLE (0x0000u)
mbed_official 27:4206883f4cb7 103 #define USB_HOST_BITBYTE_BIG (0x0100u)
mbed_official 27:4206883f4cb7 104 #define USB_HOST_BITISEL (0x0020u)
mbed_official 27:4206883f4cb7 105 #define USB_HOST_BITCURPIPE (0x000fu)
mbed_official 27:4206883f4cb7 106
mbed_official 27:4206883f4cb7 107 #define USB_HOST_CFIFO_READ (0x0000u)
mbed_official 27:4206883f4cb7 108 #define USB_HOST_CFIFO_WRITE (0x0020u)
mbed_official 27:4206883f4cb7 109
mbed_official 27:4206883f4cb7 110 #define USB_HOST_BITBVAL (0x8000u)
mbed_official 27:4206883f4cb7 111 #define USB_HOST_BITBCLR (0x4000u)
mbed_official 27:4206883f4cb7 112 #define USB_HOST_BITFRDY (0x2000u)
mbed_official 27:4206883f4cb7 113 #define USB_HOST_BITDTLN (0x0fffu)
mbed_official 27:4206883f4cb7 114
mbed_official 27:4206883f4cb7 115 #define USB_HOST_BITBEMPE (0x0400u)
mbed_official 27:4206883f4cb7 116 #define USB_HOST_BITNRDYE (0x0200u)
mbed_official 27:4206883f4cb7 117 #define USB_HOST_BITBRDYE (0x0100u)
mbed_official 27:4206883f4cb7 118 #define USB_HOST_BITBEMP (0x0400u)
mbed_official 27:4206883f4cb7 119 #define USB_HOST_BITNRDY (0x0200u)
mbed_official 27:4206883f4cb7 120 #define USB_HOST_BITBRDY (0x0100u)
mbed_official 27:4206883f4cb7 121
mbed_official 27:4206883f4cb7 122 #define USB_HOST_BITBCHGE (0x4000u)
mbed_official 27:4206883f4cb7 123 #define USB_HOST_BITDTCHE (0x1000u)
mbed_official 27:4206883f4cb7 124 #define USB_HOST_BITATTCHE (0x0800u)
mbed_official 27:4206883f4cb7 125 #define USB_HOST_BITEOFERRE (0x0040u)
mbed_official 27:4206883f4cb7 126 #define USB_HOST_BITBCHG (0x4000u)
mbed_official 27:4206883f4cb7 127 #define USB_HOST_BITDTCH (0x1000u)
mbed_official 27:4206883f4cb7 128 #define USB_HOST_BITATTCH (0x0800u)
mbed_official 27:4206883f4cb7 129 #define USB_HOST_BITEOFERR (0x0040u)
mbed_official 27:4206883f4cb7 130
mbed_official 27:4206883f4cb7 131 #define USB_HOST_BITSIGNE (0x0020u)
mbed_official 27:4206883f4cb7 132 #define USB_HOST_BITSACKE (0x0010u)
mbed_official 27:4206883f4cb7 133 #define USB_HOST_BITSIGN (0x0020u)
mbed_official 27:4206883f4cb7 134 #define USB_HOST_BITSACK (0x0010u)
mbed_official 27:4206883f4cb7 135
mbed_official 27:4206883f4cb7 136 #define USB_HOST_BITSUREQ (0x4000u)
mbed_official 27:4206883f4cb7 137 #define USB_HOST_BITSQSET (0x0080u)
mbed_official 27:4206883f4cb7 138 #define USB_HOST_PID_STALL2 (0x0003u)
mbed_official 27:4206883f4cb7 139 #define USB_HOST_PID_STALL (0x0002u)
mbed_official 27:4206883f4cb7 140 #define USB_HOST_PID_BUF (0x0001u)
mbed_official 27:4206883f4cb7 141 #define USB_HOST_PID_NAK (0x0000u)
mbed_official 27:4206883f4cb7 142
mbed_official 27:4206883f4cb7 143 #define USB_HOST_PIPExBUF (64u)
mbed_official 27:4206883f4cb7 144
mbed_official 27:4206883f4cb7 145 #define USB_HOST_D0FIFO (0)
mbed_official 27:4206883f4cb7 146 #define USB_HOST_D1FIFO (1)
mbed_official 27:4206883f4cb7 147 #define USB_HOST_DMA_READY (0)
mbed_official 27:4206883f4cb7 148 #define USB_HOST_DMA_BUSY (1)
mbed_official 27:4206883f4cb7 149 #define USB_HOST_DMA_BUSYEND (2)
mbed_official 27:4206883f4cb7 150
mbed_official 27:4206883f4cb7 151 #define USB_HOST_FIFO_USE (0x7000)
mbed_official 27:4206883f4cb7 152
mbed_official 27:4206883f4cb7 153 #define USB_HOST_FIFOERROR (0xffff)
mbed_official 27:4206883f4cb7 154 #define USB_HOST_WRITEEND (0)
mbed_official 27:4206883f4cb7 155 #define USB_HOST_WRITESHRT (1)
mbed_official 27:4206883f4cb7 156 #define USB_HOST_WRITING (2)
mbed_official 27:4206883f4cb7 157 #define USB_HOST_WRITEDMA (3)
mbed_official 27:4206883f4cb7 158 #define USB_HOST_READEND (0)
mbed_official 27:4206883f4cb7 159 #define USB_HOST_READSHRT (1)
mbed_official 27:4206883f4cb7 160 #define USB_HOST_READING (2)
mbed_official 27:4206883f4cb7 161 #define USB_HOST_READOVER (3)
mbed_official 27:4206883f4cb7 162 #define USB_HOST_READZERO (4)
mbed_official 27:4206883f4cb7 163
mbed_official 27:4206883f4cb7 164 #define USB_HOST_CMD_IDLE (0x0000)
mbed_official 27:4206883f4cb7 165 #define USB_HOST_CMD_DOING (0x0001)
mbed_official 27:4206883f4cb7 166 #define USB_HOST_CMD_DONE (0x0002)
mbed_official 27:4206883f4cb7 167 #define USB_HOST_CMD_NORES (0x0003)
mbed_official 27:4206883f4cb7 168 #define USB_HOST_CMD_STALL (0x0004)
mbed_official 27:4206883f4cb7 169 #define USB_HOST_CMD_FIELD (0x000f)
mbed_official 27:4206883f4cb7 170
mbed_official 27:4206883f4cb7 171 #if 0
mbed_official 27:4206883f4cb7 172 #define USB_HOST_CHG_CMDFIELD( r, v ) do { r &= ( ~USB_HOST_CMD_FIELD ); \
mbed_official 27:4206883f4cb7 173 r |= v; } while(0)
mbed_official 27:4206883f4cb7 174 #endif
mbed_official 27:4206883f4cb7 175
mbed_official 27:4206883f4cb7 176 #define USB_HOST_MODE_WRITE (0x0100)
mbed_official 27:4206883f4cb7 177 #define USB_HOST_MODE_READ (0x0200)
mbed_official 27:4206883f4cb7 178 #define USB_HOST_MODE_NO_DATA (0x0300)
mbed_official 27:4206883f4cb7 179 #define USB_HOST_MODE_FIELD (0x0f00)
mbed_official 27:4206883f4cb7 180
mbed_official 27:4206883f4cb7 181 #define USB_HOST_STAGE_SETUP (0x0010)
mbed_official 27:4206883f4cb7 182 #define USB_HOST_STAGE_DATA (0x0020)
mbed_official 27:4206883f4cb7 183 #define USB_HOST_STAGE_STATUS (0x0030)
mbed_official 27:4206883f4cb7 184 #define USB_HOST_STAGE_FIELD (0x00f0)
mbed_official 27:4206883f4cb7 185
mbed_official 27:4206883f4cb7 186 #if 0
mbed_official 27:4206883f4cb7 187 #define USB_HOST_CHG_STAGEFIELD( r, v ) do { r &= ( ~USB_HOST_STAGE_FIELD ); \
mbed_official 27:4206883f4cb7 188 r |= v; } while(0)
mbed_official 27:4206883f4cb7 189 #endif
mbed_official 27:4206883f4cb7 190
mbed_official 27:4206883f4cb7 191 #define USB_HOST_DEVADD_MASK (0x7fc0)
mbed_official 27:4206883f4cb7 192
mbed_official 27:4206883f4cb7 193
mbed_official 27:4206883f4cb7 194 /*******************************************************************************
mbed_official 27:4206883f4cb7 195 Imported global variables and functions (from other files)
mbed_official 27:4206883f4cb7 196 *******************************************************************************/
mbed_official 27:4206883f4cb7 197 extern uint16_t g_usb_host_elt_clockmode;
mbed_official 27:4206883f4cb7 198
mbed_official 27:4206883f4cb7 199 #endif /* USB_HOST_H */
mbed_official 27:4206883f4cb7 200
mbed_official 27:4206883f4cb7 201 /* End of File */