pos 机 gd32f103 midi设备
1/芯片本身有usb 直接 初始化成 usb midi 设备,然后将 io 数据传输到串口就ok
引用连接:https://blog.csdn.net/weixin_41082557/article/details/105579510?utm_source=app&app_version=4.7.1
修改 hid 接口,增加 midi 接口
在原是STM32F103 USB HID的工程基础上改为USB MIDI设备
主要内容修改配置描述符 USBD_CUSTOM_HID_CfgDesc,
注意MIDI属于音频类,需要配置为Audio类,并且需要添加控制端点。
__ALIGN_BEGIN static uint8_t USBD_CUSTOM_HID_CfgDesc[USB_CUSTOM_HID_CONFIG_DESC_SIZ] __ALIGN_END =
{
0x09, /* bLength: Configuration Descriptor size */
USB_DESC_TYPE_CONFIGURATION, /* bDescriptorType: Configuration */
USB_CUSTOM_HID_CONFIG_DESC_SIZ,
/* wTotalLength: Bytes returned */
0x00,
0x02,//1 /bNumInterfaces: 2 interface/
0x01, /bConfigurationValue: Configuration value/
0x00, /*iConfiguration: Index of string descriptor describing
the configuration*/
0xC0, /*bmAttributes: bus powered */
0x32, /MaxPower 100 mA: this current is used for detecting Vbus/
/******************* Standard AC Interface Descriptor *********************/
/* 09 */
0x09, /bLength: Interface Descriptor size/
USB_DESC_TYPE_INTERFACE, /bDescriptorType: Interface descriptor type/
0x00, /bInterfaceNumber: Number of Interface/
0x00, /bAlternateSetting: Alternate setting/
0x00, /bNumEndpoints/
0x01, /bInterfaceClass: Audio/
0x01, /bInterfaceSubClass : Audio Control/
0, /nInterfaceProtocol/
0, /iInterface: Index of string descriptor/
/**************** Class-specific AC Interface Descriptor ******************/
/* 18 */
0x09, /bLength: Interface Descriptor size/
0x24, /bDescriptorType: Class-specific interface descriptor type/
0x01, /bDescriptorSubType: Header/
0x00, /bcdADC: Revision of class specification - 1.0/
0x01,
0x09, /wTotalLength: Total size of class specific discriptor/
0x00,
0x01, /bInCollection: Number of streaming interfaces/
0x01, /*baInterfaceNr : MIDIStreaming interface 1 belongs to
this AudioControl interface*/
/******************* Standard MS Interface Descriptor *********************/
/* 27 */
0x09, /bLength: Interface Descriptor size/
USB_DESC_TYPE_INTERFACE, /bDescriptorType: Interface descriptor type/
0x01, /bInterfaceNumber: Number of Interface/
0x00, /bAlternateSetting: Alternate setting/
0x02, /bNumEndpoints/
0x01, /bInterfaceClass: Audio/
0x03, /bInterfaceSubClass : MIDI Streaming/
0, /nInterfaceProtocol/
0, /iInterface: Index of string descriptor/
/**************** Class-specific MS Interface Descriptor ******************/
/* 36 */
0x07, /bLength: Interface Descriptor size/
0x24, /bDescriptorType: Class-specific interface descriptor type/
0x01, /bDescriptorSubType: MS Header/
0x00, /bcdADC: Revision of class specification/
0x01,
0x41, /wTotalLength: Total size of class specific discriptor/
0x00,
/******************* MIDI IN Jack Descriptor (Embedded) *******************/
/* 43 */
0x06, /bLength: Size of this descriptor/
0x24, /bDescriptorType: Class-specific interface descriptor type/
0x02, /bDescriptorSubType: MIDI IN Jack/
0x01, /bJackType: Embedded/
0x01, /bJackID: ID of this Jack/
0x00, /iJack/
/******************* MIDI IN Jack Descriptor (External) 扩展midi输入接口*******************/
/* 49 */
0x06, /bLength: Size of this descriptor/
0x24, /bDescriptorType: Class-specific interface descriptor type/
0x02, /bDescriptorSubType: MIDI IN Jack/
0x02, /bJackType: External/
0x02, /bJackID: ID of this Jack/
0x00, /iJack/
/******************* MIDI OUT Jack Descriptor (Embedded) ******************/
/* 55 */
0x09, /bLength: Size of this descriptor/
0x24, /bDescriptorType: Class-specific interface descriptor type/
0x03, /bDescriptorSubType: MIDI OUT Jack/
0x01, /bJackType: Embedded/
0x03, /bJackID: ID of this Jack/
0x01, /bNrInputPins: Number of Input Pins of this Jack/
0x02, /BaSourceID: ID of the Entry to which this Pin is connected/
0x01, /*BaSourceID: Output Pin number of the Entry to
which this Input Pin is connected*/
0x00, /iJack/
/******************* MIDI OUT Jack Descriptor (External) 扩展 midi 输出接口******************/
/* 64 */
0x09, /bLength: Size of this descriptor/
0x24, /bDescriptorType: Class-specific interface descriptor type/
0x03, /bDescriptorSubType: MIDI OUT Jack/
0x02, /bJackType: External/
0x04, /bJackID: ID of this Jack/
0x01, /bNrInputPins: Number of Input Pins of this Jack/
0x01, /BaSourceID: ID of the Entry to which this Pin is connected/
0x01, /*BaSourceID: Output Pin number of the Entry to
which this Input Pin is connected*/
0x00, /iJack/
/****************** Standard Bulk OUT Endpoint Descriptor *****************/
/* 73 */
0x09, /bLength: Size of this descriptor/
USB_DESC_TYPE_ENDPOINT, /bDescriptorType: Endpoint descriptor type/
0x01, /bEndpointAddress: OUT Endpoint 1/
0x02, /bmAttributes: Bulk, not shared./
0x40, /wMaxPacketSize 64/
0x00,
0x00, /bInterval/
0x00, /bRefresh/
0x00, /bSynchAddress/
/************* Class-specific MS Bulk OUT Endpoint Descriptor *************/
/* 82 */
0x05, /bLength: Size of this descriptor/
0x25, /bDescriptorType: Class-specific endpoint descriptor type/
0x01, /bDescriptorSubType: MS General/
0x01, /bNumEmbMIDIJack: Number of embedded MIDI IN Jack/
0x01, /BaAssocJackID: ID of the Embedded MIDI IN Jack/
/****************** Standard Bulk IN Endpoint Descriptor 标准绑定输入端点***************/
/* 87 */
0x09, /bLength: Size of this descriptor/
USB_DESC_TYPE_ENDPOINT, /bDescriptorType: Endpoint descriptor type/
0x81, /bEndpointAddress: IN Endpoint 1/
0x02, /bmAttributes: Bulk, not shared./
0x40, /wMaxPacketSize 64/
0x00,
0x00, /bInterval/
0x00, /bRefresh/
0x00, /bSynchAddress/
/************* Class-specific MS Bulk OUT Endpoint Descriptor 特别类 低位绑定输出端点***********/
/* 96 */
0x05, /bLength: Size of this descriptor/
0x25, /bDescriptorType: Class-specific endpoint descriptor type/
0x01, /bDescriptorSubType: MS General/
0x01, /bNumEmbMIDIJack: Number of embedded MIDI OUT Jack/
0x03, /BaAssocJackID: ID of the Embedded MIDI OUT Jack/
/* 101 */
} ;
修改配置描述符长度
hidsend 发送数据 修改为 键盘轮询接口 并加入串口收发就ok
2/电子琴需要外接两个74hc164增加
pos 机 gd32f103 midi设备相关推荐
- POS机介绍——密码设备研发商介绍No.1
通过一段时间的探索,我找到了很多国内商用密码设备制造商,打算对这些密码设备制造商的主营业务进行了解,于是创建密码设备制造商专栏.本篇为第首篇. 0 引言 通过对POS产品占国内40%以上市场份额,位居 ...
- pos机 gd32f103 串口上位机可调正弦波(纯正弦波逆变器)
- 手机POS机支付能否挑战支付宝、微信?
你能想象到,只要2个手机"碰一碰"就能收付款了吗?在今年12月,华为与银联合作了,推出新的支付方式了--手机POS机,用户无需另行打开支付窗口,只要"碰一碰"N ...
- 动联出席2015中国(广州)国际POS机展顶级盛会
随着中国经济的高速发展,现代化产业的不断快速增长以及移动支付方式的骤然流行,POS机市场正处于一个高速增长时期,如超市.餐饮娱乐.银行.企业.零售业和商用自助产业的发展需求日益扩大时.POS机具有广阔 ...
- pos机未能连接服务器,pos 机链接不了服务器
pos 机链接不了服务器 内容精选 换一换 在本章节中,您将运行已部署好的游戏,登录游戏客户端.已准备好Windows机器,硬盘至少20G,且必须安装有显卡.服务器地址:节点的弹性IP地址,请登录CC ...
- POS机C井例子代码(2)
详细代码 using System; using System.Drawing; using System.Collections; using System.ComponentModel; usin ...
- POS机行业获客新思路,如何高效推广,且看明白这几点
由于互联网网络获客收益的慢慢消退,POS机行业的拓客艰难,POS领域的高成本费变成推动其发展趋势的一大短板.那为什么拓客越来越艰难,而推广费用却愈来愈高? 公众号:浪浪数据精准获客 坦白说,伴随着移动 ...
- android 控制POS机图文打印(一)
因为公司业务的需要,要用android客户端控制pos机打印票据,不单只是中文的,而且还要包括二维码的打印的!经过两天的努力!终于搞定了!!!!我真是! 首先,先奉上ESC/POS指令集. EPSON ...
- 揭秘:传统pos机手续费为什么比无卡支付手续费还贵!
随着互联网水平的提高,超前消费理念已经深入人心,越来越多的人手里或多或少都有几张信用卡. 信用卡用的久了,资深卡友基本上都产生了一个疑问,pos机手续费是0.6%,而无卡支付是0.55%-0.40%, ...
最新文章
- ClickHouse系列教程一:Debian/Ubuntu 下ClickHouse的安装和使用
- java面试题34下面关于程序编译说法正确的是()
- php smarty模板配置,Smarty模板简单配置与使用方法示例
- css3特效-传送带示例
- java react_2019JAVA最新课程-React从入门到实战(新)
- 使用Docker部署Gitlab
- c语言小车路径规划算法,小车自动避障及路径规划.doc
- STM3库文件 hal_uart.c的使用
- matlab数学建模题及答案,数学建模中30道经典 MATLAB程序.doc
- 内存数据库 TimesTen
- JavaAndroid开发视频教程汇总
- FTL(闪存转换层)简单介绍
- 罚函数法约束函数优matlab,外点惩罚函数法matlab
- 对Orders订单表中的常见统计查询
- PHP网页文件扩展名,网页文件的扩展名有哪些
- Gcd HYSBZ - 2818
- 注意 怎么选择车险附加险?避免“这也不赔那也不赔”
- 莺尾花数据(画出不同分类器的ROC曲线)
- 关于Blurry无法加载的问题
- SWFObject 2.0