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

Revision:
30:ff42cc7a0d55
Parent:
29:181839dc8cb0
Child:
31:f6d9dbbc1481
--- a/USBHost/TARGET_RENESAS/TARGET_RZ_A1H/src/common/usb0_host_intrn.c	Tue Mar 31 07:44:06 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,285 +0,0 @@
-/*******************************************************************************
-* DISCLAIMER
-* This software is supplied by Renesas Electronics Corporation and is only
-* intended for use with Renesas products. No other uses are authorized. This
-* software is owned by Renesas Electronics Corporation and is protected under
-* all applicable laws, including copyright laws.
-* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
-* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
-* LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
-* AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
-* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
-* ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
-* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
-* ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
-* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-* Renesas reserves the right, without notice, to make changes to this software
-* and to discontinue the availability of this software. By using this software,
-* you agree to the additional terms and conditions found by accessing the
-* following link:
-* http://www.renesas.com/disclaimer
-* Copyright (C) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
-*******************************************************************************/
-/*******************************************************************************
-* File Name    : usb0_host_intrn.c
-* $Rev: 1116 $
-* $Date:: 2014-07-09 16:29:19 +0900#$
-* Device(s)    : RZ/A1H
-* Tool-Chain   :
-* OS           : None
-* H/W Platform :
-* Description  : RZ/A1H R7S72100 USB Sample Program
-* Operation    :
-* Limitations  :
-*******************************************************************************/
-
-
-/*******************************************************************************
-Includes   <System Includes> , "Project Includes"
-*******************************************************************************/
-#include "usb0_host.h"
-#if(1) /* ohci_wrapp */
-#include "ohci_wrapp_RZ_A1_local.h"
-#endif
-
-
-/*******************************************************************************
-Typedef definitions
-*******************************************************************************/
-
-
-/*******************************************************************************
-Macro definitions
-*******************************************************************************/
-
-
-/*******************************************************************************
-Imported global variables and functions (from other files)
-*******************************************************************************/
-
-
-/*******************************************************************************
-Exported global variables and functions (to be accessed by other files)
-*******************************************************************************/
-
-
-/*******************************************************************************
-Private global variables and functions
-*******************************************************************************/
-
-
-/*******************************************************************************
-* Function Name: usb0_host_brdy_int
-* Description  : Executes BRDY interrupt(USB_HOST_PIPE1-9).
-*              : According to the pipe that interrupt is generated in,
-*              : reads/writes buffer allocated in the pipe.
-*              : This function is executed in the BRDY interrupt handler.
-*              : This function clears BRDY interrupt status and BEMP interrupt
-*              : status.
-* Arguments    : uint16_t status       ; BRDYSTS Register Value
-*              : uint16_t int_enb      ; BRDYENB Register Value
-* Return Value : none
-*******************************************************************************/
-void usb0_host_brdy_int (uint16_t status, uint16_t int_enb)
-{
-    uint32_t int_sense = 0;
-    uint16_t pipe;
-    uint16_t pipebit;
-
-    for (pipe = USB_HOST_PIPE1; pipe <= USB_HOST_MAX_PIPE_NO; pipe++)
-    {
-        pipebit = g_usb0_host_bit_set[pipe];
-
-        if ((status & pipebit) && (int_enb & pipebit))
-        {
-            USB200.BRDYSTS = (uint16_t)~pipebit;
-            USB200.BEMPSTS = (uint16_t)~pipebit;
-
-            if ((g_usb0_host_PipeTbl[pipe] & USB_HOST_FIFO_USE) == USB_HOST_D0FIFO_DMA)
-            {
-                if (g_usb0_host_DmaStatus[USB_HOST_D0FIFO] != USB_HOST_DMA_READY)
-                {
-                    usb0_host_dma_interrupt_d0fifo(int_sense);
-                }
-
-                if (RZA_IO_RegRead_16(&g_usb0_host_pipecfg[pipe], USB_PIPECFG_BFRE_SHIFT, USB_PIPECFG_BFRE) == 0)
-                {
-                    usb0_host_read_dma(pipe);
-                    usb0_host_disable_brdy_int(pipe);
-                }
-                else
-                {
-                    USB200.D0FIFOCTR = USB_HOST_BITBCLR;
-                    g_usb0_host_pipe_status[pipe] = USB_HOST_PIPE_DONE;
-                }
-            }
-            else if ((g_usb0_host_PipeTbl[pipe] & USB_HOST_FIFO_USE) == USB_HOST_D1FIFO_DMA)
-            {
-                if (g_usb0_host_DmaStatus[USB_HOST_D1FIFO] != USB_HOST_DMA_READY)
-                {
-                    usb0_host_dma_interrupt_d1fifo(int_sense);
-                }
-
-                if (RZA_IO_RegRead_16(&g_usb0_host_pipecfg[pipe], USB_PIPECFG_BFRE_SHIFT, USB_PIPECFG_BFRE) == 0)
-                {
-                    usb0_host_read_dma(pipe);
-                    usb0_host_disable_brdy_int(pipe);
-                }
-                else
-                {
-                    USB200.D1FIFOCTR = USB_HOST_BITBCLR;
-                    g_usb0_host_pipe_status[pipe] = USB_HOST_PIPE_DONE;
-                }
-            }
-            else
-            {
-                if (RZA_IO_RegRead_16(&g_usb0_host_pipecfg[pipe], USB_PIPECFG_DIR_SHIFT, USB_PIPECFG_DIR) == 0)
-                {
-                    usb0_host_read_buffer(pipe);
-                }
-                else
-                {
-                    usb0_host_write_buffer(pipe);
-                }
-            }
-#if(1) /* ohci_wrapp */
-            switch (g_usb0_host_pipe_status[pipe])
-            {
-                case USB_HOST_PIPE_DONE:
-                    ohciwrapp_loc_TransEnd(pipe, TD_CC_NOERROR);
-                break;
-                case USB_HOST_PIPE_NORES:
-                case USB_HOST_PIPE_STALL:
-                case USB_HOST_PIPE_ERROR:
-                    ohciwrapp_loc_TransEnd(pipe, TD_CC_STALL);
-                break;
-                default:
-                    /* Do Nothing */
-                break;
-            }
-#endif
-        }
-    }
-}
-
-/*******************************************************************************
-* Function Name: usb0_host_nrdy_int
-* Description  : Executes NRDY interrupt(USB_HOST_PIPE1-9).
-*              : Checks NRDY interrupt cause by PID. When the cause if STALL,
-*              : regards the pipe state as STALL and ends the processing.
-*              : Then the cause is not STALL, increments the error count to
-*              : communicate again. When the error count is 3, determines
-*              : the pipe state as USB_HOST_PIPE_NORES and ends the processing.
-*              : This function is executed in the NRDY interrupt handler.
-*              : This function clears NRDY interrupt status.
-* Arguments    : uint16_t status       ; NRDYSTS Register Value
-*              : uint16_t int_enb      ; NRDYENB Register Value
-* Return Value : none
-*******************************************************************************/
-void usb0_host_nrdy_int (uint16_t status, uint16_t int_enb)
-{
-    uint16_t pid;
-    uint16_t pipe;
-    uint16_t bitcheck;
-
-    bitcheck = (uint16_t)(status & int_enb);
-
-    USB200.NRDYSTS = (uint16_t)~status;
-
-    for (pipe = USB_HOST_PIPE1; pipe <= USB_HOST_MAX_PIPE_NO; pipe++)
-    {
-        if ((bitcheck&g_usb0_host_bit_set[pipe]) == g_usb0_host_bit_set[pipe])
-        {
-            if (RZA_IO_RegRead_16(&USB200.SYSCFG0,
-                                    USB_SYSCFG_DCFM_SHIFT,
-                                    USB_SYSCFG_DCFM) == 1)
-            {
-                if (g_usb0_host_pipe_status[pipe] == USB_HOST_PIPE_WAIT)
-                {
-                    pid = usb0_host_get_pid(pipe);
-
-                    if ((pid == USB_HOST_PID_STALL) || (pid == USB_HOST_PID_STALL2))
-                    {
-                        g_usb0_host_pipe_status[pipe] = USB_HOST_PIPE_STALL;
-#if(1) /* ohci_wrapp */
-                        ohciwrapp_loc_TransEnd(pipe, TD_CC_STALL);
-#endif
-                    }
-                    else
-                    {
-#if(1) /* ohci_wrapp */
-                        g_usb0_host_pipe_status[pipe] = USB_HOST_PIPE_NORES;
-                        ohciwrapp_loc_TransEnd(pipe, TD_CC_STALL);
-#else
-                        g_usb0_host_PipeIgnore[pipe]++;
-
-                        if (g_usb0_host_PipeIgnore[pipe] == 3)
-                        {
-                            g_usb0_host_pipe_status[pipe] = USB_HOST_PIPE_NORES;
-                        }
-                        else
-                        {
-                            usb0_host_set_pid_buf(pipe);
-                        }
-#endif
-                    }
-                }
-            }
-            else
-            {
-                /* USB Function */
-            }
-        }
-    }
-}
-
-/*******************************************************************************
-* Function Name: usb0_host_bemp_int
-* Description  : Executes BEMP interrupt(USB_HOST_PIPE1-9).
-* Arguments    : uint16_t status       ; BEMPSTS Register Value
-*              : uint16_t int_enb      ; BEMPENB Register Value
-* Return Value : none
-*******************************************************************************/
-void usb0_host_bemp_int (uint16_t status, uint16_t int_enb)
-{
-    uint16_t pid;
-    uint16_t pipe;
-    uint16_t bitcheck;
-    uint16_t inbuf;
-
-    bitcheck = (uint16_t)(status & int_enb);
-
-    USB200.BEMPSTS = (uint16_t)~status;
-
-    for (pipe = USB_HOST_PIPE1; pipe <= USB_HOST_MAX_PIPE_NO; pipe++)
-    {
-        if ((bitcheck&g_usb0_host_bit_set[pipe]) == g_usb0_host_bit_set[pipe])
-        {
-            pid = usb0_host_get_pid(pipe);
-
-            if ((pid == USB_HOST_PID_STALL) || (pid == USB_HOST_PID_STALL2))
-            {
-                g_usb0_host_pipe_status[pipe] = USB_HOST_PIPE_STALL;
-#if(1) /* ohci_wrapp */
-                ohciwrapp_loc_TransEnd(pipe, TD_CC_STALL);
-#endif
-            }
-            else
-            {
-                inbuf = usb0_host_get_inbuf(pipe);
-
-                if (inbuf == 0)
-                {
-                    usb0_host_disable_bemp_int(pipe);
-                    usb0_host_set_pid_nak(pipe);
-                    g_usb0_host_pipe_status[pipe] = USB_HOST_PIPE_DONE;
-#if(1) /* ohci_wrapp */
-                    ohciwrapp_loc_TransEnd(pipe, TD_CC_NOERROR);
-#endif
-                }
-            }
-        }
-    }
-}
-
-/* End of File */