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
Diff: USBHost/USBHostTypes.h
- Revision:
- 13:b58a2204422f
- Parent:
- 8:93da8ea2708b
- Child:
- 24:868cbfe611a7
--- a/USBHost/USBHostTypes.h Tue Aug 13 09:42:31 2013 +0000
+++ b/USBHost/USBHostTypes.h Mon Sep 16 15:36:24 2013 +0100
@@ -18,6 +18,7 @@
#define USB_INC_H
#include "mbed.h"
+#include "toolchain.h"
enum USB_TYPE {
USB_TYPE_OK = 0,
@@ -135,34 +136,34 @@
#define CONFIGURATION_DESCRIPTOR_LENGTH 0x09
// ------------ HostController Transfer Descriptor ------------
-typedef __packed struct HCTD {
+typedef struct HCTD {
__IO uint32_t control; // Transfer descriptor control
__IO uint8_t * currBufPtr; // Physical address of current buffer pointer
__IO HCTD * nextTD; // Physical pointer to next Transfer Descriptor
__IO uint8_t * bufEnd; // Physical address of end of buffer
void * ep; // ep address where a td is linked in
uint32_t dummy[3]; // padding
-} HCTD;
+} PACKED HCTD;
// ----------- HostController EndPoint Descriptor -------------
-typedef __packed struct hcEd {
+typedef struct hcEd {
__IO uint32_t control; // Endpoint descriptor control
__IO HCTD * tailTD; // Physical address of tail in Transfer descriptor list
__IO HCTD * headTD; // Physcial address of head in Transfer descriptor list
__IO hcEd * nextED; // Physical address of next Endpoint descriptor
-} HCED;
+} PACKED HCED;
// ----------- Host Controller Communication Area ------------
-typedef __packed struct hcca {
+typedef struct hcca {
__IO uint32_t IntTable[32]; // Interrupt Table
__IO uint32_t FrameNumber; // Frame Number
__IO uint32_t DoneHead; // Done Head
volatile uint8_t Reserved[116]; // Reserved for future use
volatile uint8_t Unknown[4]; // Unused
-} HCCA;
+} PACKED HCCA;
-typedef __packed struct {
+typedef struct {
uint8_t bLength;
uint8_t bDescriptorType;
uint16_t bcdUSB;
@@ -177,9 +178,9 @@
uint8_t iProduct;
uint8_t iSerialNumber;
uint8_t bNumConfigurations;
-} DeviceDescriptor;
+} PACKED DeviceDescriptor;
-typedef __packed struct {
+typedef struct {
uint8_t bLength;
uint8_t bDescriptorType;
uint16_t wTotalLength;
@@ -188,7 +189,7 @@
uint8_t iConfiguration;
uint8_t bmAttributes;
uint8_t bMaxPower;
-} ConfigurationDescriptor;
+} PACKED ConfigurationDescriptor;
typedef struct {
uint8_t bLength;
