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 : usb0_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 USB0_HOST_H
mbed_official 27:4206883f4cb7 30 #define USB0_HOST_H
mbed_official 27:4206883f4cb7 31
mbed_official 27:4206883f4cb7 32 /*******************************************************************************
mbed_official 27:4206883f4cb7 33 Includes <System Includes> , "Project Includes"
mbed_official 27:4206883f4cb7 34 *******************************************************************************/
mbed_official 27:4206883f4cb7 35 #include "devdrv_usb_host_api.h"
mbed_official 27:4206883f4cb7 36 #include "usb_host.h"
mbed_official 27:4206883f4cb7 37
mbed_official 27:4206883f4cb7 38 /*******************************************************************************
mbed_official 27:4206883f4cb7 39 Imported global variables and functions (from other files)
mbed_official 27:4206883f4cb7 40 *******************************************************************************/
mbed_official 27:4206883f4cb7 41 extern const uint16_t g_usb0_host_bit_set[];
mbed_official 27:4206883f4cb7 42 extern uint32_t g_usb0_host_data_count[USB_HOST_MAX_PIPE_NO + 1];
mbed_official 27:4206883f4cb7 43 extern uint8_t *g_usb0_host_data_pointer[USB_HOST_MAX_PIPE_NO + 1];
mbed_official 27:4206883f4cb7 44
mbed_official 27:4206883f4cb7 45 extern uint16_t g_usb0_host_PipeIgnore[];
mbed_official 27:4206883f4cb7 46 extern uint16_t g_usb0_host_PipeTbl[];
mbed_official 27:4206883f4cb7 47 extern uint16_t g_usb0_host_pipe_status[];
mbed_official 27:4206883f4cb7 48 extern uint32_t g_usb0_host_PipeDataSize[];
mbed_official 27:4206883f4cb7 49
mbed_official 27:4206883f4cb7 50 extern USB_HOST_DMA_t g_usb0_host_DmaInfo[];
mbed_official 27:4206883f4cb7 51 extern uint16_t g_usb0_host_DmaPipe[];
mbed_official 27:4206883f4cb7 52 extern uint16_t g_usb0_host_DmaBval[];
mbed_official 27:4206883f4cb7 53 extern uint16_t g_usb0_host_DmaStatus[];
mbed_official 27:4206883f4cb7 54
mbed_official 27:4206883f4cb7 55 extern uint16_t g_usb0_host_driver_state;
mbed_official 27:4206883f4cb7 56 extern uint16_t g_usb0_host_ConfigNum;
mbed_official 27:4206883f4cb7 57 extern uint16_t g_usb0_host_CmdStage;
mbed_official 27:4206883f4cb7 58 extern uint16_t g_usb0_host_bchg_flag;
mbed_official 27:4206883f4cb7 59 extern uint16_t g_usb0_host_detach_flag;
mbed_official 27:4206883f4cb7 60 extern uint16_t g_usb0_host_attach_flag;
mbed_official 27:4206883f4cb7 61
mbed_official 27:4206883f4cb7 62 extern uint16_t g_usb0_host_UsbAddress;
mbed_official 27:4206883f4cb7 63 extern uint16_t g_usb0_host_setUsbAddress;
mbed_official 27:4206883f4cb7 64 extern uint16_t g_usb0_host_default_max_packet[USB_HOST_MAX_DEVICE + 1];
mbed_official 27:4206883f4cb7 65 extern uint16_t g_usb0_host_UsbDeviceSpeed;
mbed_official 27:4206883f4cb7 66 extern uint16_t g_usb0_host_SupportUsbDeviceSpeed;
mbed_official 27:4206883f4cb7 67
mbed_official 27:4206883f4cb7 68 extern uint16_t g_usb0_host_SavReq;
mbed_official 27:4206883f4cb7 69 extern uint16_t g_usb0_host_SavVal;
mbed_official 27:4206883f4cb7 70 extern uint16_t g_usb0_host_SavIndx;
mbed_official 27:4206883f4cb7 71 extern uint16_t g_usb0_host_SavLen;
mbed_official 27:4206883f4cb7 72
mbed_official 27:4206883f4cb7 73 extern uint16_t g_usb0_host_pipecfg[USB_HOST_MAX_PIPE_NO + 1];
mbed_official 27:4206883f4cb7 74 extern uint16_t g_usb0_host_pipebuf[USB_HOST_MAX_PIPE_NO + 1];
mbed_official 27:4206883f4cb7 75 extern uint16_t g_usb0_host_pipemaxp[USB_HOST_MAX_PIPE_NO + 1];
mbed_official 27:4206883f4cb7 76 extern uint16_t g_usb0_host_pipeperi[USB_HOST_MAX_PIPE_NO + 1];
mbed_official 27:4206883f4cb7 77
mbed_official 27:4206883f4cb7 78 /*******************************************************************************
mbed_official 27:4206883f4cb7 79 Functions Prototypes
mbed_official 27:4206883f4cb7 80 *******************************************************************************/
mbed_official 27:4206883f4cb7 81 /* ==== common ==== */
mbed_official 27:4206883f4cb7 82 void usb0_host_dma_stop_d0(uint16_t pipe, uint32_t remain);
mbed_official 27:4206883f4cb7 83 void usb0_host_dma_stop_d1(uint16_t pipe, uint32_t remain);
mbed_official 27:4206883f4cb7 84 uint16_t usb0_host_is_hispeed(void);
mbed_official 27:4206883f4cb7 85 uint16_t usb0_host_is_hispeed_enable(void);
mbed_official 27:4206883f4cb7 86 uint16_t usb0_host_start_send_transfer(uint16_t pipe, uint32_t size, uint8_t *data);
mbed_official 27:4206883f4cb7 87 uint16_t usb0_host_write_buffer(uint16_t pipe);
mbed_official 27:4206883f4cb7 88 uint16_t usb0_host_write_buffer_c(uint16_t pipe);
mbed_official 27:4206883f4cb7 89 uint16_t usb0_host_write_buffer_d0(uint16_t pipe);
mbed_official 27:4206883f4cb7 90 uint16_t usb0_host_write_buffer_d1(uint16_t pipe);
mbed_official 27:4206883f4cb7 91 void usb0_host_start_receive_transfer(uint16_t pipe, uint32_t size, uint8_t *data);
mbed_official 27:4206883f4cb7 92 uint16_t usb0_host_read_buffer(uint16_t pipe);
mbed_official 27:4206883f4cb7 93 uint16_t usb0_host_read_buffer_c(uint16_t pipe);
mbed_official 27:4206883f4cb7 94 uint16_t usb0_host_read_buffer_d0(uint16_t pipe);
mbed_official 27:4206883f4cb7 95 uint16_t usb0_host_read_buffer_d1(uint16_t pipe);
mbed_official 27:4206883f4cb7 96 uint16_t usb0_host_change_fifo_port(uint16_t pipe, uint16_t fifosel, uint16_t isel, uint16_t mbw);
mbed_official 27:4206883f4cb7 97 void usb0_host_set_curpipe(uint16_t pipe, uint16_t fifosel, uint16_t isel, uint16_t mbw);
mbed_official 27:4206883f4cb7 98 void usb0_host_set_curpipe2(uint16_t pipe, uint16_t fifosel, uint16_t isel, uint16_t mbw, uint16_t dfacc);
mbed_official 27:4206883f4cb7 99 uint16_t usb0_host_get_mbw(uint32_t trncount, uint32_t dtptr);
mbed_official 27:4206883f4cb7 100 uint16_t usb0_host_read_dma(uint16_t pipe);
mbed_official 27:4206883f4cb7 101 void usb0_host_stop_transfer(uint16_t pipe);
mbed_official 27:4206883f4cb7 102 void usb0_host_brdy_int(uint16_t status, uint16_t int_enb);
mbed_official 27:4206883f4cb7 103 void usb0_host_nrdy_int(uint16_t status, uint16_t int_enb);
mbed_official 27:4206883f4cb7 104 void usb0_host_bemp_int(uint16_t status, uint16_t int_enb);
mbed_official 27:4206883f4cb7 105 void usb0_host_setting_interrupt(uint8_t level);
mbed_official 27:4206883f4cb7 106 void usb0_host_reset_module(uint16_t clockmode);
mbed_official 27:4206883f4cb7 107 uint16_t usb0_host_get_buf_size(uint16_t pipe);
mbed_official 27:4206883f4cb7 108 uint16_t usb0_host_get_mxps(uint16_t pipe);
mbed_official 27:4206883f4cb7 109 void usb0_host_enable_brdy_int(uint16_t pipe);
mbed_official 27:4206883f4cb7 110 void usb0_host_disable_brdy_int(uint16_t pipe);
mbed_official 27:4206883f4cb7 111 void usb0_host_clear_brdy_sts(uint16_t pipe);
mbed_official 27:4206883f4cb7 112 void usb0_host_enable_bemp_int(uint16_t pipe);
mbed_official 27:4206883f4cb7 113 void usb0_host_disable_bemp_int(uint16_t pipe);
mbed_official 27:4206883f4cb7 114 void usb0_host_clear_bemp_sts(uint16_t pipe);
mbed_official 27:4206883f4cb7 115 void usb0_host_enable_nrdy_int(uint16_t pipe);
mbed_official 27:4206883f4cb7 116 void usb0_host_disable_nrdy_int(uint16_t pipe);
mbed_official 27:4206883f4cb7 117 void usb0_host_clear_nrdy_sts(uint16_t pipe);
mbed_official 27:4206883f4cb7 118 void usb0_host_set_pid_buf(uint16_t pipe);
mbed_official 27:4206883f4cb7 119 void usb0_host_set_pid_nak(uint16_t pipe);
mbed_official 27:4206883f4cb7 120 void usb0_host_set_pid_stall(uint16_t pipe);
mbed_official 27:4206883f4cb7 121 void usb0_host_clear_pid_stall(uint16_t pipe);
mbed_official 27:4206883f4cb7 122 uint16_t usb0_host_get_pid(uint16_t pipe);
mbed_official 27:4206883f4cb7 123 void usb0_host_set_sqclr(uint16_t pipe);
mbed_official 27:4206883f4cb7 124 void usb0_host_set_sqset(uint16_t pipe);
mbed_official 27:4206883f4cb7 125 void usb0_host_set_csclr(uint16_t pipe);
mbed_official 27:4206883f4cb7 126 void usb0_host_aclrm(uint16_t pipe);
mbed_official 27:4206883f4cb7 127 void usb0_host_set_aclrm(uint16_t pipe);
mbed_official 27:4206883f4cb7 128 void usb0_host_clr_aclrm(uint16_t pipe);
mbed_official 27:4206883f4cb7 129 uint16_t usb0_host_get_sqmon(uint16_t pipe);
mbed_official 27:4206883f4cb7 130 uint16_t usb0_host_get_inbuf(uint16_t pipe);
mbed_official 27:4206883f4cb7 131
mbed_official 27:4206883f4cb7 132 /* ==== host ==== */
mbed_official 27:4206883f4cb7 133 void usb0_host_init_pipe_status(void);
mbed_official 27:4206883f4cb7 134 int32_t usb0_host_CtrlTransStart(uint16_t devadr, uint16_t Req, uint16_t Val, uint16_t Indx, uint16_t Len, uint8_t *Buf);
mbed_official 27:4206883f4cb7 135 void usb0_host_SetupStage(uint16_t Req, uint16_t Val, uint16_t Indx, uint16_t Len);
mbed_official 27:4206883f4cb7 136 void usb0_host_CtrlReadStart(uint32_t Bsize, uint8_t *Table);
mbed_official 27:4206883f4cb7 137 uint16_t usb0_host_CtrlWriteStart(uint32_t Bsize, uint8_t *Table);
mbed_official 27:4206883f4cb7 138 void usb0_host_StatusStage(void);
mbed_official 27:4206883f4cb7 139 void usb0_host_get_devadd(uint16_t addr, uint16_t *devadd);
mbed_official 27:4206883f4cb7 140 void usb0_host_set_devadd(uint16_t addr, uint16_t *devadd);
mbed_official 27:4206883f4cb7 141 void usb0_host_InitModule(void);
mbed_official 27:4206883f4cb7 142 uint16_t usb0_host_CheckAttach(void);
mbed_official 27:4206883f4cb7 143 void usb0_host_UsbDetach(void);
mbed_official 27:4206883f4cb7 144 void usb0_host_UsbDetach2(void);
mbed_official 27:4206883f4cb7 145 void usb0_host_UsbAttach(void);
mbed_official 27:4206883f4cb7 146 uint16_t usb0_host_UsbBusReset(void);
mbed_official 27:4206883f4cb7 147 int32_t usb0_host_UsbResume(void);
mbed_official 27:4206883f4cb7 148 int32_t usb0_host_UsbSuspend(void);
mbed_official 27:4206883f4cb7 149 void usb0_host_Enable_DetachINT(void);
mbed_official 27:4206883f4cb7 150 void usb0_host_Disable_DetachINT(void);
mbed_official 27:4206883f4cb7 151 void usb0_host_UsbStateManager(void);
mbed_official 27:4206883f4cb7 152
mbed_official 27:4206883f4cb7 153
mbed_official 27:4206883f4cb7 154 #endif /* USB0_HOST_H */
mbed_official 27:4206883f4cb7 155
mbed_official 27:4206883f4cb7 156 /* End of File */