SDG+USBHost(Mouse) Sample
Dependencies: Sound_Generator USBHost_custom
Fork of SDG_Mouse_Sample by
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.
Operation
| operation | effect |
|---|---|
| Right click | Sounds |
| Left click | Reset to base tone (C) |
| Moves the mouse to the right | Lower the sound |
| Moves the mouse to the left | Higher the sound |
| Center cursor | Adjust 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をショートする必要があります。
操作方法
| 操作 | 内容 |
|---|---|
| 右クリック | 音出力開始 |
| 左クリック | 基準音(ド)にリセット |
| マウス右移動 | 高音になります |
| マウス左移動 | 低音になります |
| センターカーソル | 音高低の変化量調整(クリックで基準値にリセット) |
Others
mbedのシリアル通信(ボーレート等)のデフォルト設定は以下のリンクに示しています。
リンクを参考に、お使いのPCターミナルソフトの設定を変更して下さい。
mbedでのボーレートのデフォルト値は9600で、このサンプルではボーレート9600を使います。
https://developer.mbed.org/teams/Renesas/wiki/GR-PEACH-Getting-Started#install-the-usb-serial-communication
USBHost/TARGET_RENESAS/TARGET_RZ_A1H/inc/usb0_host_dmacdrv.h@27:4206883f4cb7, 2015-01-19 (annotated)
- 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?
| User | Revision | Line number | New 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_dmacdrv.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_DMACDRV_H |
| mbed_official | 27:4206883f4cb7 | 30 | #define USB0_HOST_DMACDRV_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 | |
| mbed_official | 27:4206883f4cb7 | 37 | |
| mbed_official | 27:4206883f4cb7 | 38 | /******************************************************************************* |
| mbed_official | 27:4206883f4cb7 | 39 | Typedef definitions |
| mbed_official | 27:4206883f4cb7 | 40 | *******************************************************************************/ |
| mbed_official | 27:4206883f4cb7 | 41 | typedef struct dmac_transinfo |
| mbed_official | 27:4206883f4cb7 | 42 | { |
| mbed_official | 27:4206883f4cb7 | 43 | uint32_t src_addr; /* Transfer source address */ |
| mbed_official | 27:4206883f4cb7 | 44 | uint32_t dst_addr; /* Transfer destination address */ |
| mbed_official | 27:4206883f4cb7 | 45 | uint32_t count; /* Transfer byte count */ |
| mbed_official | 27:4206883f4cb7 | 46 | uint32_t src_size; /* Transfer source data size */ |
| mbed_official | 27:4206883f4cb7 | 47 | uint32_t dst_size; /* Transfer destination data size */ |
| mbed_official | 27:4206883f4cb7 | 48 | uint32_t saddr_dir; /* Transfer source address direction */ |
| mbed_official | 27:4206883f4cb7 | 49 | uint32_t daddr_dir; /* Transfer destination address direction */ |
| mbed_official | 27:4206883f4cb7 | 50 | } dmac_transinfo_t; |
| mbed_official | 27:4206883f4cb7 | 51 | |
| mbed_official | 27:4206883f4cb7 | 52 | |
| mbed_official | 27:4206883f4cb7 | 53 | /******************************************************************************* |
| mbed_official | 27:4206883f4cb7 | 54 | Macro definitions |
| mbed_official | 27:4206883f4cb7 | 55 | *******************************************************************************/ |
| mbed_official | 27:4206883f4cb7 | 56 | /* ==== Transfer specification of the sample program ==== */ |
| mbed_official | 27:4206883f4cb7 | 57 | #define DMAC_SAMPLE_SINGLE (0) /* Single transfer */ |
| mbed_official | 27:4206883f4cb7 | 58 | #define DMAC_SAMPLE_CONTINUATION (1) /* Continuous transfer (use REN bit) */ |
| mbed_official | 27:4206883f4cb7 | 59 | |
| mbed_official | 27:4206883f4cb7 | 60 | /* ==== DMA modes ==== */ |
| mbed_official | 27:4206883f4cb7 | 61 | #define DMAC_MODE_REGISTER (0) /* Register mode */ |
| mbed_official | 27:4206883f4cb7 | 62 | #define DMAC_MODE_LINK (1) /* Link mode */ |
| mbed_official | 27:4206883f4cb7 | 63 | |
| mbed_official | 27:4206883f4cb7 | 64 | /* ==== Transfer requests ==== */ |
| mbed_official | 27:4206883f4cb7 | 65 | #define DMAC_REQ_MODE_EXT (0) /* External request */ |
| mbed_official | 27:4206883f4cb7 | 66 | #define DMAC_REQ_MODE_PERI (1) /* On-chip peripheral module request */ |
| mbed_official | 27:4206883f4cb7 | 67 | #define DMAC_REQ_MODE_SOFT (2) /* Auto-request (request by software) */ |
| mbed_official | 27:4206883f4cb7 | 68 | |
| mbed_official | 27:4206883f4cb7 | 69 | /* ==== DMAC transfer sizes ==== */ |
| mbed_official | 27:4206883f4cb7 | 70 | #define DMAC_TRANS_SIZE_8 (0) /* 8 bits */ |
| mbed_official | 27:4206883f4cb7 | 71 | #define DMAC_TRANS_SIZE_16 (1) /* 16 bits */ |
| mbed_official | 27:4206883f4cb7 | 72 | #define DMAC_TRANS_SIZE_32 (2) /* 32 bits */ |
| mbed_official | 27:4206883f4cb7 | 73 | #define DMAC_TRANS_SIZE_64 (3) /* 64 bits */ |
| mbed_official | 27:4206883f4cb7 | 74 | #define DMAC_TRANS_SIZE_128 (4) /* 128 bits */ |
| mbed_official | 27:4206883f4cb7 | 75 | #define DMAC_TRANS_SIZE_256 (5) /* 256 bits */ |
| mbed_official | 27:4206883f4cb7 | 76 | #define DMAC_TRANS_SIZE_512 (6) /* 512 bits */ |
| mbed_official | 27:4206883f4cb7 | 77 | #define DMAC_TRANS_SIZE_1024 (7) /* 1024 bits */ |
| mbed_official | 27:4206883f4cb7 | 78 | |
| mbed_official | 27:4206883f4cb7 | 79 | /* ==== Address increment for transferring ==== */ |
| mbed_official | 27:4206883f4cb7 | 80 | #define DMAC_TRANS_ADR_NO_INC (1) /* Not increment */ |
| mbed_official | 27:4206883f4cb7 | 81 | #define DMAC_TRANS_ADR_INC (0) /* Increment */ |
| mbed_official | 27:4206883f4cb7 | 82 | |
| mbed_official | 27:4206883f4cb7 | 83 | /* ==== Method for detecting DMA request ==== */ |
| mbed_official | 27:4206883f4cb7 | 84 | #define DMAC_REQ_DET_FALL (0) /* Falling edge detection */ |
| mbed_official | 27:4206883f4cb7 | 85 | #define DMAC_REQ_DET_RISE (1) /* Rising edge detection */ |
| mbed_official | 27:4206883f4cb7 | 86 | #define DMAC_REQ_DET_LOW (2) /* Low level detection */ |
| mbed_official | 27:4206883f4cb7 | 87 | #define DMAC_REQ_DET_HIGH (3) /* High level detection */ |
| mbed_official | 27:4206883f4cb7 | 88 | |
| mbed_official | 27:4206883f4cb7 | 89 | /* ==== Request Direction ==== */ |
| mbed_official | 27:4206883f4cb7 | 90 | #define DMAC_REQ_DIR_SRC (0) /* DMAREQ is the source/ DMAACK is active when reading */ |
| mbed_official | 27:4206883f4cb7 | 91 | #define DMAC_REQ_DIR_DST (1) /* DMAREQ is the destination/ DMAACK is active when writing */ |
| mbed_official | 27:4206883f4cb7 | 92 | |
| mbed_official | 27:4206883f4cb7 | 93 | /* ==== Descriptors ==== */ |
| mbed_official | 27:4206883f4cb7 | 94 | #define DMAC_DESC_HEADER (0) /* Header */ |
| mbed_official | 27:4206883f4cb7 | 95 | #define DMAC_DESC_SRC_ADDR (1) /* Source Address */ |
| mbed_official | 27:4206883f4cb7 | 96 | #define DMAC_DESC_DST_ADDR (2) /* Destination Address */ |
| mbed_official | 27:4206883f4cb7 | 97 | #define DMAC_DESC_COUNT (3) /* Transaction Byte */ |
| mbed_official | 27:4206883f4cb7 | 98 | #define DMAC_DESC_CHCFG (4) /* Channel Confg */ |
| mbed_official | 27:4206883f4cb7 | 99 | #define DMAC_DESC_CHITVL (5) /* Channel Interval */ |
| mbed_official | 27:4206883f4cb7 | 100 | #define DMAC_DESC_CHEXT (6) /* Channel Extension */ |
| mbed_official | 27:4206883f4cb7 | 101 | #define DMAC_DESC_LINK_ADDR (7) /* Link Address */ |
| mbed_official | 27:4206883f4cb7 | 102 | |
| mbed_official | 27:4206883f4cb7 | 103 | /* ==== On-chip peripheral module requests ===== */ |
| mbed_official | 27:4206883f4cb7 | 104 | typedef enum dmac_request_factor |
| mbed_official | 27:4206883f4cb7 | 105 | { |
| mbed_official | 27:4206883f4cb7 | 106 | DMAC_REQ_USB0_DMA0_TX, /* USB_0 channel 0 transmit FIFO empty */ |
| mbed_official | 27:4206883f4cb7 | 107 | DMAC_REQ_USB0_DMA0_RX, /* USB_0 channel 0 receive FIFO full */ |
| mbed_official | 27:4206883f4cb7 | 108 | DMAC_REQ_USB0_DMA1_TX, /* USB_0 channel 1 transmit FIFO empty */ |
| mbed_official | 27:4206883f4cb7 | 109 | DMAC_REQ_USB0_DMA1_RX, /* USB_0 channel 1 receive FIFO full */ |
| mbed_official | 27:4206883f4cb7 | 110 | DMAC_REQ_USB1_DMA0_TX, /* USB_1 channel 0 transmit FIFO empty */ |
| mbed_official | 27:4206883f4cb7 | 111 | DMAC_REQ_USB1_DMA0_RX, /* USB_1 channel 0 receive FIFO full */ |
| mbed_official | 27:4206883f4cb7 | 112 | DMAC_REQ_USB1_DMA1_TX, /* USB_1 channel 1 transmit FIFO empty */ |
| mbed_official | 27:4206883f4cb7 | 113 | DMAC_REQ_USB1_DMA1_RX, /* USB_1 channel 1 receive FIFO full */ |
| mbed_official | 27:4206883f4cb7 | 114 | } dmac_request_factor_t; |
| mbed_official | 27:4206883f4cb7 | 115 | |
| mbed_official | 27:4206883f4cb7 | 116 | |
| mbed_official | 27:4206883f4cb7 | 117 | /******************************************************************************* |
| mbed_official | 27:4206883f4cb7 | 118 | Variable Externs |
| mbed_official | 27:4206883f4cb7 | 119 | *******************************************************************************/ |
| mbed_official | 27:4206883f4cb7 | 120 | |
| mbed_official | 27:4206883f4cb7 | 121 | |
| mbed_official | 27:4206883f4cb7 | 122 | /******************************************************************************* |
| mbed_official | 27:4206883f4cb7 | 123 | Functions Prototypes |
| mbed_official | 27:4206883f4cb7 | 124 | *******************************************************************************/ |
| mbed_official | 27:4206883f4cb7 | 125 | void usb0_host_DMAC1_PeriReqInit(const dmac_transinfo_t * trans_info, uint32_t dmamode, uint32_t continuation, |
| mbed_official | 27:4206883f4cb7 | 126 | uint32_t request_factor, uint32_t req_direction); |
| mbed_official | 27:4206883f4cb7 | 127 | int32_t usb0_host_DMAC1_Open(uint32_t req); |
| mbed_official | 27:4206883f4cb7 | 128 | void usb0_host_DMAC1_Close(uint32_t * remain); |
| mbed_official | 27:4206883f4cb7 | 129 | void usb0_host_DMAC1_Load_Set(uint32_t src_addr, uint32_t dst_addr, uint32_t count); |
| mbed_official | 27:4206883f4cb7 | 130 | |
| mbed_official | 27:4206883f4cb7 | 131 | void usb0_host_DMAC2_PeriReqInit(const dmac_transinfo_t * trans_info, uint32_t dmamode, uint32_t continuation, |
| mbed_official | 27:4206883f4cb7 | 132 | uint32_t request_factor, uint32_t req_direction); |
| mbed_official | 27:4206883f4cb7 | 133 | int32_t usb0_host_DMAC2_Open(uint32_t req); |
| mbed_official | 27:4206883f4cb7 | 134 | void usb0_host_DMAC2_Close(uint32_t * remain); |
| mbed_official | 27:4206883f4cb7 | 135 | void usb0_host_DMAC2_Load_Set(uint32_t src_addr, uint32_t dst_addr, uint32_t count); |
| mbed_official | 27:4206883f4cb7 | 136 | |
| mbed_official | 27:4206883f4cb7 | 137 | #endif /* USB0_HOST_DMACDRV_H */ |
| mbed_official | 27:4206883f4cb7 | 138 | |
| mbed_official | 27:4206883f4cb7 | 139 | /* End of File */ |
