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/USBHost.h
- Revision:
- 24:868cbfe611a7
- Parent:
- 23:759ec18ee1a7
--- a/USBHost/USBHost.h Fri Mar 07 16:00:46 2014 +0000
+++ b/USBHost/USBHost.h Tue Jun 03 11:30:38 2014 +0100
@@ -35,7 +35,7 @@
* Static method to create or retrieve the single USBHost instance
*/
static USBHost * getHostInst();
-
+
/**
* Control read: setup stage, data stage and status stage
*
@@ -186,19 +186,19 @@
dev->onDisconnect(intf, fn);
}
}
-
+
/**
* Instantiate to protect USB thread from accessing shared objects (USBConnectedDevices and Interfaces)
*/
class Lock
{
public:
- Lock(USBHost* pHost);
- ~Lock();
+ Lock(USBHost* pHost);
+ ~Lock();
private:
USBHost* m_pHost;
};
-
+
friend class USBHostHub;
protected:
@@ -257,7 +257,7 @@
bool deviceAttachedDriver[MAX_DEVICE_CONNECTED][MAX_INTF];
bool deviceReset[MAX_DEVICE_CONNECTED];
bool deviceInited[MAX_DEVICE_CONNECTED];
-
+
#if MAX_HUB_NB
USBHostHub hubs[MAX_HUB_NB];
bool hub_in_use[MAX_HUB_NB];
@@ -265,7 +265,7 @@
// to store a setup packet
uint8_t setupPacket[8];
-
+
typedef struct {
uint8_t event_id;
void * td_addr;
@@ -275,17 +275,17 @@
uint8_t td_state;
void * hub_parent;
} message_t;
-
+
Thread usbThread;
void usb_process();
static void usb_process_static(void const * arg);
Mail<message_t, 10> mail_usb_event;
Mutex usb_mutex;
Mutex td_mutex;
-
+
// buffer for conf descriptor
uint8_t data[415];
-
+
/**
* Add a transfer on the TD linked list associated to an ED
*
@@ -296,7 +296,7 @@
* @return status of the transfer
*/
USB_TYPE addTransfer(USBEndpoint * ed, uint8_t * buf, uint32_t len) ;
-
+
/**
* Link the USBEndpoint to the linked list and attach an USBEndpoint this USBEndpoint to a device
*
@@ -318,7 +318,7 @@
* @returns pointer on the USBEndpoint created
*/
USBEndpoint * newEndpoint(ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir, uint32_t size, uint8_t addr) ;
-
+
/**
* Request the device descriptor
*
@@ -338,7 +338,7 @@
* @param len_conf_descr pointer to store the length of the packet transferred
*/
USB_TYPE getConfigurationDescriptor(USBDeviceConnected * dev, uint8_t * buf, uint16_t max_len_buf, uint16_t * len_conf_descr = NULL);
-
+
/**
* Set the address of a specific device
*
@@ -354,7 +354,7 @@
* @param conf configuration number to activate (usually 1)
*/
USB_TYPE setConfiguration(USBDeviceConnected * dev, uint8_t conf);
-
+
/**
* Free a specific device
*
@@ -378,7 +378,7 @@
bool blocking,
ENDPOINT_TYPE type,
bool write) ;
-
+
void fillControlBuf(uint8_t requestType, uint8_t request, uint16_t value, uint16_t index, int len) ;
void parseConfDescr(USBDeviceConnected * dev, uint8_t * conf_descr, uint32_t len, IUSBEnumerator* pEnumerator) ;
int findDevice(USBDeviceConnected * dev) ;
