
{"id":14604,"date":"2022-05-12T15:45:53","date_gmt":"2022-05-12T06:45:53","guid":{"rendered":"https:\/\/okiraku-camera.tokyo\/blog\/?p=14604"},"modified":"2022-06-16T17:57:15","modified_gmt":"2022-06-16T08:57:15","slug":"ch9350l%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6arduino%e3%83%9c%e3%83%bc%e3%83%89%e3%81%abusb%e3%82%ad%e3%83%bc%e3%83%9c%e3%83%bc%e3%83%89%e3%82%92%e6%8e%a5%e7%b6%9a%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/okiraku-camera.tokyo\/blog\/?p=14604","title":{"rendered":"CH9350L\u3092\u4f7f\u3063\u3066Arduino\u30dc\u30fc\u30c9\u306bUSB\u30ad\u30fc\u30dc\u30fc\u30c9\u3092\u63a5\u7d9a\u3059\u308b"},"content":{"rendered":"<h1>\u6982\u8981<\/h1>\n<p>USB\u30ad\u30fc\u30dc\u30fc\u30c9\u3084\u30de\u30a6\u30b9\u3092\u8a8d\u8b58\u3057\u3001HID\u5165\u529b\u30ec\u30dd\u30fc\u30c8\u3092\u30b7\u30ea\u30a2\u30eb\u30c7\u30fc\u30bf\u3068\u3057\u3066\u51fa\u529b\u3057\u3066\u304f\u308c\u308b <strong>CH9350L\u3092\u4f7f\u3063\u3066USB\u30ad\u30fc\u30dc\u30fc\u30c9\u3092Arduino\u30dc\u30fc\u30c9\u306b\u63a5\u7d9a\u3057\u30ad\u30fc\u30dc\u30fc\u30c9\u5165\u529b\u3092\u5229\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b<\/strong>\u3002\u30b7\u30ea\u30a2\u30eb\u30dd\u30fc\u30c8(UART)\u3092\u5099\u3048\u305fArduino\u30dc\u30fc\u30c9\u306a\u3089\u3070\u63a5\u7d9a\u3084\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306f\u30b7\u30f3\u30d7\u30eb\u306a\u306e\u3067\u3001\u304a\u305d\u3089\u304fMAX3421E \u3092\u4f7f\u3063\u305fUSB Host Shield \u3088\u308a\u3082\u7c21\u5358\u306b\u4f7f\u3048\u308b\u3002<\/p>\n<figure id=\"attachment_14616\" aria-describedby=\"caption-attachment-14616\" style=\"width: 552px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2022\/05\/8fdb1b25ec43eddd17367569d236b785.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-14616\" src=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2022\/05\/8fdb1b25ec43eddd17367569d236b785-552x552.jpg\" alt=\"\" width=\"552\" height=\"552\" \/><\/a><figcaption id=\"caption-attachment-14616\" class=\"wp-caption-text\">CH9350L<\/figcaption><\/figure>\n<p>\u3053\u306e\u6295\u7a3f\u3067\u306f\u3001CH9350L\u306e\u8a55\u4fa1\u7528\u30dc\u30fc\u30c9\u3068<strong>SparkFun Pro\u00a0 Micro<\/strong>(5V \/ 16MHz)\u540c\u7b49\u54c1\u3092\u3064\u306a\u3044\u3067\u4f7f\u3044\u65b9\u3092\u8abf\u3079\u3066\u307f\u305f\u8a71\u3092\u307e\u3068\u3081\u305f\u3002\u305d\u3057\u3066CH9350L\u3068<strong>Seeduino XIAO-m0<\/strong> \u3092\u7d44\u307f\u5408\u305b\u3066\u3001\u3075\u3064\u3046\u306e\u65e5\u672c\u8a9e\u30ad\u30fc\u30dc\u30fc\u30c9\u3092\u307b\u307cNICOLA\u30ad\u30fc\u30dc\u30fc\u30c9(\u89aa\u6307\u30b7\u30d5\u30c8\u30ad\u30fc\u30dc\u30fc\u30c9)\u3068\u3057\u3066\u4f7f\u3048\u308b\u3088\u3046\u306b\u3059\u308bhoboNicola\u30a2\u30c0\u30d7\u30bf\u30fc\u3092\u4f5c\u6210\u3057\u305f\u8a71\u3082\u7d9a\u304f\u4e88\u5b9a\u3002<\/p>\n<h2>CH9350L\u306e\u6982\u7565<\/h2>\n<p>CH9350L\u306f\u3001USB\u30b7\u30ea\u30a2\u30eb\u5909\u63db\u30c7\u30d0\u30a4\u30b9\u306eCH340\u30b7\u30ea\u30fc\u30ba\u3084MCS51(8051)\u4e92\u63db\u306eCH559L\u306a\u3069\u3067\u77e5\u3089\u308c\u3066\u3044\u308b<a href=\"http:\/\/www.wch.cn\/\" target=\"_blank\" rel=\"noopener\">\u5357\u4eac\u6c81\u6052\u5fae\u7535\u5b50\u80a1\u4efd\u6709\u9650\u516c\u53f8<\/a> \u00a0(\u82f1\u8a9e\u540d : <a href=\"http:\/\/www.wch-ic.com\/\" target=\"_blank\" rel=\"noopener\">Nanjing Qinheng Microelectronics<\/a>) \u306e\u88fd\u54c1\u3067\u3001\u4ed6\u306e\u88fd\u54c1\u3068\u540c\u3058\u304f\u56fd\u5185\u306e\u901a\u8ca9\u30b5\u30a4\u30c8(\u79cb\u6708\u96fb\u5b50\u306a\u3069)\u3067\u304a\u5b89\u304f\u5165\u624b\u3067\u304d\u308b\u3002<\/p>\n<p>\u3053\u306e\u30c7\u30d0\u30a4\u30b9\u306f\u3001\u30ad\u30fc\u30dc\u30fc\u30c9\u3084\u30de\u30a6\u30b9(\u304a\u3088\u3073\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4)\u306a\u3069\u306e\u64cd\u4f5c\u5074\u3068\u64cd\u4f5c\u5bfe\u8c61\u306e\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u9593\u306e\u8ddd\u96e2\u3092\u901a\u4fe1\u6280\u8853\u3092\u4f7f\u3063\u3066\u5ef6\u9577\u3059\u308b\u3001KVM\u30b9\u30a4\u30c3\u30c1\u3042\u308b\u3044\u306fKVM\u30a8\u30af\u30b9\u30c6\u30f3\u30c0\u3068\u547c\u3070\u308c\u308b\u88fd\u54c1\u3067\u306e\u5229\u7528\u3092\u4e3b\u76ee\u7684\u3068\u3057\u3066\u4f5c\u3089\u308c\u305f\u30c7\u30d0\u30a4\u30b9\u306e\u3088\u3046\u3067\u3001\u3053\u306e\u30c7\u30d0\u30a4\u30b9\u304c\u5165\u51fa\u529b\u3059\u308b\u30b7\u30ea\u30a2\u30eb\u901a\u4fe1\u90e8\u5206\u3092\u30d3\u30c7\u30aa\u4fe1\u53f7\u306b\u91cd\u7573\u3059\u308b\u3068\u304bRS485\u898f\u683c\u3092\u4f7f\u3046\u3068\u304b\u3057\u3066\u5ef6\u9577\u3059\u308b\u3053\u3068\u304c\u60f3\u5b9a\u3055\u308c\u3066\u3044\u308b\u3088\u3046\u3060\u3002<\/p>\n<p>CH9350L\u306e\u304a\u3082\u306a\u7279\u9577\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3002<\/p>\n<ul>\n<li>\u63a5\u7d9a\u5bfe\u8c61\u306b\u5fdc\u3058\u305f<strong>2\u7a2e\u985e\u306e\u52d5\u4f5c\u30e2\u30fc\u30c9(\u4e0a\u4f4d\u5074\u3001\u4e0b\u4f4d\u5074)<\/strong>\u3068\u3001\u4f7f\u3044\u65b9\u306b\u5fdc\u3058\u305f<strong>5\u7a2e\u985e\u306e\u52d5\u4f5c\u30b9\u30c6\u30fc\u30c8(\u52d5\u4f5c\u30b9\u30c6\u30fc\u30c80\uff5e4)<\/strong>\u3092\u3082\u3064\u3002\u4eca\u56de\u306f\u3001\u4e0b\u4f4d\u5074\u52d5\u4f5c\u30e2\u30fc\u30c9\u3001\u52d5\u4f5c\u30b9\u30c6\u30fc\u30c80\u3092\u5229\u7528\u3059\u308b\u3002<\/li>\n<li>\u57fa\u672c\u7684\u306b\u306f\u3001\u4e0a\u4f4d\u5074\u30e2\u30fc\u30c9\u3068\u4e0b\u4f4d\u5074\u30e2\u30fc\u30c9\u3067\u52d5\u4f5c\u3059\u308b2\u3064\u306eCH9350L\u3092\u30b7\u30ea\u30a2\u30eb\u901a\u4fe1\u3067\u63a5\u7d9a\u3057\u3066\u4f7f\u3046\u3053\u3068\u304c\u60f3\u5b9a\u3055\u308c\u3066\u3044\u308b\u3002<\/li>\n<li>USB2.0\u898f\u683c\u3068\u4e92\u63db\u6027\u304c\u3042\u308a12Mbps\u30681.5MBps\u306e\u901a\u4fe1\u901f\u5ea6\u3092\u30b5\u30dd\u30fc\u30c8\u3059\u308b\u3002<\/li>\n<li>USB\u30ad\u30fc\u30dc\u30fc\u30c9\u3084\u30de\u30a6\u30b9\u306e\u51fa\u529b\u30c7\u30fc\u30bf(HID\u5165\u529b\u30ec\u30dd\u30fc\u30c8)\u3092\u30b7\u30ea\u30a2\u30eb\u30c7\u30fc\u30bf\u306b\u5909\u63db\u3057\u3066\u51fa\u529b\u3067\u304d\u308b\u3002<\/li>\n<li>\u65e5\u672c\u8a9e\u30ad\u30fc\u30dc\u30fc\u30c9\u3067\u62e1\u5f35\u3055\u308c\u305f\u30ad\u30fc(\u5909\u63db\u3001\u7121\u5909\u63db\u3001\u3072\u3089\u304c\u306a\u306a\u3069)\u306b\u3064\u3044\u3066\u3082\u3001\u6240\u5b9a\u306eHID Usage ID\u304c\u51fa\u529b\u3055\u308c\u308b\u3002<\/li>\n<li>\u4e0a\u4f4d\u5074\u304b\u3089\u306e\u30b7\u30ea\u30a2\u30eb\u30c7\u30fc\u30bf\u306b\u3088\u308a\u3001USB\u30ad\u30fc\u30dc\u30fc\u30c9\u306eLED\u3092\u70b9\u706f\uff0f\u6d88\u706f\u3067\u304d\u308b(\u51fa\u529b\u30ec\u30dd\u30fc\u30c8\u306e\u30b5\u30dd\u30fc\u30c8)\u3002<\/li>\n<li>UART\u306e\u901a\u4fe1\u901f\u5ea6\u306f115200\/57600\/38400bps\u3092\u30b5\u30dd\u30fc\u30c8(\u30c7\u30d5\u30a9\u30eb\u30c8\u306f115200bps\u3067\u3001\u7279\u6b8a\u7528\u9014\u3067\u306f300000bps\u3082\u5229\u7528\u3067\u304d\u308b)\u3002\u30c7\u30fc\u30bf\u5f62\u5f0f\u306f\u30018\u30d3\u30c3\u30c8\u30011\u30b9\u30c8\u30c3\u30d7\u3001\u30d1\u30ea\u30c6\u30a3\u7121\u3057\u3002<\/li>\n<li>\u6c34\u6676\u767a\u632f\u5668\u3068\u30d1\u30ef\u30fc\u30aa\u30f3\u30ea\u30bb\u30c3\u30c8\u56de\u8def\u3092\u5185\u8535\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u5468\u8fba\u56de\u8def\u304c\u3068\u3066\u3082\u30b7\u30f3\u30d7\u30eb\u3002<\/li>\n<li>\u5916\u90e8\u96fb\u6e90\u96fb\u5727\u306f+5V\u304a\u3088\u3073+3.3V\u3092\u30b5\u30dd\u30fc\u30c8\u3002+5V\u306f\u5185\u8535+3.3V\u51fa\u529b\u96fb\u5727\u30ec\u30ae\u30e5\u30ec\u30fc\u30bf\u306e\u5165\u529b\u3068\u306a\u3063\u3066\u304a\u308a\u3001\u5185\u90e8\u52d5\u4f5c\u96fb\u5727\u306f+3.3V\u3002\u5165\u51fa\u529b\u30ed\u30b8\u30c3\u30af\u30ec\u30d9\u30eb\u306f\u57fa\u672c\u7684\u306b+3.3V\u3002<\/li>\n<\/ul>\n<h4>\u5916\u90e8\u3068\u306e\u63a5\u7d9a<\/h4>\n<p>CH9350L\u306f2\u7cfb\u7d71\u306eUSB2.0\u30dd\u30fc\u30c8\u3068UART(TXD\/RXD) \u30dd\u30fc\u30c8\u306b\u3088\u3063\u3066\u5916\u90e8\u306e\u6a5f\u5668(\u307e\u305f\u306f\u3082\u3046\u4e00\u3064\u306eCH9350L)\u3068\u63a5\u7d9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002<\/p>\n<figure id=\"attachment_14626\" aria-describedby=\"caption-attachment-14626\" style=\"width: 552px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2022\/05\/66c19942ab4ba346fdb64ccc04cde373-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"waku wp-image-14626 size-large\" src=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2022\/05\/66c19942ab4ba346fdb64ccc04cde373-1-552x244.png\" alt=\"\" width=\"552\" height=\"244\" \/><\/a><figcaption id=\"caption-attachment-14626\" class=\"wp-caption-text\">CH9350L interface<\/figcaption><\/figure>\n<p>2\u3064\u306e\u52d5\u4f5c\u30e2\u30fc\u30c9\u306f\u3001USB\u30dd\u30fc\u30c8\u306e\u7528\u9014\u3092\u898f\u5b9a\u3057\u3066\u3044\u308b\u3002<\/p>\n<ul>\n<li><strong>\u4e0a\u4f4d\u5074\u30e2\u30fc\u30c9(Upper computer mode)<\/strong> \u3067\u306f\u3001PC\u306a\u3069\u306eUSB\u30db\u30b9\u30c8\u3078\u306e\u63a5\u7d9a\u306b\u5bfe\u5fdc\u3059\u308b\u3002\u30dd\u30fc\u30c81(DP\/DM\u30d4\u30f3)\u306e\u307f\u304c\u4f7f\u3048\u308b\u3002<\/li>\n<li><strong>\u4e0b\u4f4d\u5074\u30e2\u30fc\u30c9(Lower computer mode) <\/strong>\u3067\u306f\u3001\u30ad\u30fc\u30dc\u30fc\u30c9\u3084\u30de\u30a6\u30b9\u3068\u3044\u3063\u305fUSB\u30c7\u30d0\u30a4\u30b9\u3078\u306e\u63a5\u7d9a\u3092\u30b5\u30dd\u30fc\u30c8\u3059\u308b\u3002\u30dd\u30fc\u30c81(DP\/DM\u30d4\u30f3)\u3068\u30dd\u30fc\u30c82(HP\/HM\u30d4\u30f3)\u306e2\u7cfb\u7d71\u304c\u4f7f\u3048\u308b\u3002<\/li>\n<\/ul>\n<p>CH9350L\u81ea\u4f53\u306f\u3001\u4e0a\u4f4d\u5074\u30e2\u30fc\u30c9\u3067\u306fUSB\u30c7\u30d0\u30a4\u30b9\u3068\u3057\u3066\u52d5\u4f5c\u3057\u3001\u4e0b\u4f4d\u5074\u30e2\u30fc\u30c9\u3067\u306f(2\u53f0\u306eUSB\u30c7\u30d0\u30a4\u30b9\u3092\u63a5\u7d9a\u3067\u304d\u308b)USB\u30db\u30b9\u30c8\u3068\u3057\u3066\u52d5\u4f5c\u3059\u308b\u3053\u3068\u306b\u306a\u308b\u30022\u3064\u306eCH9350L\u3092\u7d44\u5408\u305b\u305fKVM\u7528\u9014\u306a\u3069\u3067\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u69cb\u6210\u306b\u306a\u308b\u3002<\/p>\n<figure id=\"attachment_14618\" aria-describedby=\"caption-attachment-14618\" style=\"width: 552px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2022\/05\/66c19942ab4ba346fdb64ccc04cde373.png\"><img loading=\"lazy\" decoding=\"async\" class=\"waku wp-image-14618 size-large\" src=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2022\/05\/66c19942ab4ba346fdb64ccc04cde373-552x142.png\" alt=\"\" width=\"552\" height=\"142\" \/><\/a><figcaption id=\"caption-attachment-14618\" class=\"wp-caption-text\">CH9350L typical application diagram<\/figcaption><\/figure>\n<p>\u4eca\u56de\u306f\u3001CH9350L\u3092\u4e0b\u4f4d\u5074\u30e2\u30fc\u30c9\u3068\u3057\u3066\u52d5\u4f5c\u3055\u305b\u308b\u3002\u305d\u3057\u3066\u3001\u4e0a\u4f4d\u5074\u306eCH9350L\u306e\u4ee3\u308f\u308a\u306bArduino\u30dc\u30fc\u30c9\u3092\u30b7\u30ea\u30a2\u30eb\u901a\u4fe1\u3067\u63a5\u7d9a\u3059\u308b\u3002<\/p>\n<h4>\u30c7\u30fc\u30bf\u30b7\u30fc\u30c8<\/h4>\n<p>CH9350L\u306e\u8a73\u7d30\u306b\u3064\u3044\u3066\u306f\u30e1\u30fc\u30ab\u30fc\u306e\u30c7\u30fc\u30bf\u30b7\u30fc\u30c8\u3092\u53c2\u7167\u306e\u3053\u3068\u3002<a href=\"http:\/\/www.wch.cn\/downloads\/CH9350DS_PDF.html\" target=\"_blank\" rel=\"noopener\">\u4e2d\u6587\u7248\u306e\u30c7\u30fc\u30bf\u30b7\u30fc\u30c8\u306a\u3069\u306f\u3053\u3061\u3089<\/a>\u306e\u30da\u30fc\u30b8\u304b\u3089\u3001<a href=\"http:\/\/www.wch-ic.com\/downloads\/CH9350DS_PDF.html\" target=\"_blank\" rel=\"noopener\">\u82f1\u8a9e\u7248\u306e\u30c7\u30fc\u30bf\u30b7\u30fc\u30c8\u306a\u3069\u306f\u3053\u3061\u3089<\/a>\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3067\u304d\u308b\u3002\u3053\u308c\u3092\u66f8\u3044\u3066\u3044\u308b\u6642\u70b9\u3067\u306f\u3001\u4e2d\u6587\u7248\u304c2.6\u7248\u3067\u82f1\u8a9e\u7248\u306f2.3\u7248\u3060\u3063\u305f\u3002\u306a\u304a\u3001<a href=\"https:\/\/akizukidenshi.com\/catalog\/g\/gI-16308\/\" target=\"_blank\" rel=\"noopener\">\u79cb\u6708\u96fb\u5b50\u306eCH9350L\u8ca9\u58f2\u30da\u30fc\u30b8<\/a>\u5185\u306b\u30ea\u30f3\u30af\u3055\u308c\u3066\u3044\u308b\u30c7\u30fc\u30bf\u30b7\u30fc\u30c8\u306f\u4e2d\u6587\u306e2.3\u7248\u306a\u306e\u3067\u3061\u3087\u3063\u3068\u53e4\u3081\u3060\u3063\u305f\u3002<\/p>\n<h2>CH9350L\u306e\u8a55\u4fa1\u306b\u4f7f\u3063\u305f\u30dc\u30fc\u30c9<\/h2>\n<p>Aliexpress\u304b\u3089\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u8a55\u4fa1\u7528\u30dc\u30fc\u30c9\u3092\u8cfc\u5165\u3057\u305f\u3002\u4fa1\u683c\u306f\u9001\u6599\u8fbc\u307f\u30671000\u5186\u307b\u3069\u3060\u3063\u305f\u304c\u5186\u5b89\u304c\u9032\u3080\u3068\u9ad8\u304f\u306a\u3063\u3066\u3057\u307e\u3046\u3002<\/p>\n<figure id=\"attachment_14617\" aria-describedby=\"caption-attachment-14617\" style=\"width: 552px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2022\/05\/c97a31c95f035e284b817c53cc982d82.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-14617\" src=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2022\/05\/c97a31c95f035e284b817c53cc982d82-552x414.jpg\" alt=\"\" width=\"552\" height=\"414\" \/><\/a><figcaption id=\"caption-attachment-14617\" class=\"wp-caption-text\">CH9350L\u8a55\u4fa1\u30dc\u30fc\u30c9<\/figcaption><\/figure>\n<p>\u53f3\u5074\u306bUSB Type-A\u30ec\u30bb\u30d7\u30bf\u30af\u30eb\u304c2\u3064\u3001\u5de6\u5074\u306bType-B\u30ec\u30bb\u30d7\u30bf\u30af\u30eb\u304c\u5b9f\u88c5\u3055\u308c\u3066\u3044\u308b\u3002\u4eca\u56de\u306f\u4e0b\u4f4d\u5074\u30e2\u30fc\u30c9\u3067\u5229\u7528\u3059\u308b\u306e\u3067\u30012\u3064\u306eType-A\u306b\u30ad\u30fc\u30dc\u30fc\u30c9\u3068\u30de\u30a6\u30b9\u3092\u3064\u306a\u3044\u3067\u52d5\u4f5c\u3092\u898b\u305f\u3002Type-B\u5074\u306e\u914d\u7dda\u306f\u3001TypeA\u306eUSB \u30dd\u30fc\u30c81\u3068\u540c\u3058\u30d4\u30f3(DP\/DM)\u306b\u63a5\u7d9a\u3055\u308c\u3066\u3044\u308b\u3002<\/p>\n<p>\u9ec4\u8272\u3044\u30d4\u30f3\u30d8\u30c3\u30c0\u306b\u3001\u96fb\u6e90(+5V\u3068GND)\u3001UART\u4fe1\u53f7(TXD\u3068RXD)\u304c\u5f15\u304d\u51fa\u3055\u308c\u3066\u3044\u308b\u3002<\/p>\n<figure id=\"attachment_14636\" aria-describedby=\"caption-attachment-14636\" style=\"width: 552px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2022\/05\/f72516aaf1158254c3531ee710bd3458.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-14636\" src=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2022\/05\/f72516aaf1158254c3531ee710bd3458-552x414.jpg\" alt=\"\" width=\"552\" height=\"414\" \/><\/a><figcaption id=\"caption-attachment-14636\" class=\"wp-caption-text\">CH9350L\u8a55\u4fa1\u30dc\u30fc\u30c9<\/figcaption><\/figure>\n<p>Aliexpress\u306e\u4e2d\u306e\u30b7\u30e7\u30c3\u30d7\u306e\u8ca9\u58f2\u30da\u30fc\u30b8\u306b\u6dfb\u4ed8\u306e\u56de\u8def\u56f3\u3067\u306f\u3001CH9350L\u306eTXD\u3068RXD\u306f\u3001\u305d\u308c\u305e\u308c\u30d4\u30f3\u30d8\u30c3\u30c0\u306eRXD\u3068TXD\u306b\u5f15\u304d\u51fa\u3055\u308c\u3066\u3044\u308b\u306f\u305a\u3060\u304c\u3001\u5b9f\u969b\u306b\u306fTXD\u306fTXD\u306b\u3001RXD\u306fRXD\u306b\u63a5\u7d9a\u3055\u308c\u3066\u3044\u305f\u3002\u30b7\u30eb\u30af\u3068\u5b9f\u969b\u304c\u9055\u3046\u306e\u306f\u3088\u304f\u3042\u308b\u3053\u3068\u3002<\/p>\n<p>\u3053\u306e\u30dc\u30fc\u30c9\u306b\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b5\u56de\u8def\u306eDIP\u30b9\u30a4\u30c3\u30c1\u304c\u8f09\u3063\u3066\u3044\u308b\u3002<\/p>\n<figure id=\"attachment_14637\" aria-describedby=\"caption-attachment-14637\" style=\"width: 552px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2022\/05\/64b5864e230e9d2d2f2b8ec807feb002.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-14637\" src=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2022\/05\/64b5864e230e9d2d2f2b8ec807feb002-552x414.jpg\" alt=\"\" width=\"552\" height=\"414\" \/><\/a><figcaption id=\"caption-attachment-14637\" class=\"wp-caption-text\">CH9350L\u8a55\u4fa1\u30dc\u30fc\u30c9<\/figcaption><\/figure>\n<p>DIP\u30b9\u30a4\u30c3\u30c1\u306b\u3088\u3063\u3066\u3001UART\u306e\u901a\u4fe1\u901f\u5ea6\u3001\u52d5\u4f5c\u30e2\u30fc\u30c9\u3092\u898f\u5b9a\u3059\u308bSEL\u30d4\u30f3\u306e\u30ec\u30d9\u30eb\u3001\u52d5\u4f5c\u30b9\u30c6\u30fc\u30c8\u6c7a\u3081\u308bS1\u304a\u3088\u3073S0\u30d4\u30f3\u306e\u30ec\u30d9\u30eb\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u304c\u3001\u5199\u771f\u306e\u3088\u3046\u5168OFF(HIGH\u30ec\u30d9\u30eb)\u306b\u3057\u3066\u304a\u304f\u3068\u3001<strong>115200bps\u3001SEL=1(\u4e0b\u4f4d\u5074\u30e2\u30fc\u30c9)\u3001S1|S0=11(\u52d5\u4f5c\u30b9\u30c6\u30fc\u30c80\u307e\u305f\u306f1)<\/strong> \u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308b\u3002\u4eca\u56de\u306f\u3053\u306e\u72b6\u614b\u3067\u5229\u7528\u3057\u305f\u3002\u306a\u304a\u3001\u3053\u308c\u3089\u306e\u30d4\u30f3\u306f\u30c7\u30d0\u30a4\u30b9\u5185\u90e8\u3067\u30d7\u30eb\u30a2\u30c3\u30d7\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u5916\u90e8\u914d\u7dda\u7121\u3057\u3067\u3059\u3079\u3066HIGH\u3067\u3042\u308b\u3002<\/p>\n<p>\u96fb\u6e90\u3092\u4e0e\u3048\u305f\u72b6\u614b\u3067CH9350L\u306eUSB\u30dd\u30fc\u30c81(DP\/DM)\u306b\u30ad\u30fc\u30dc\u30fc\u30c9\u3092\u3064\u306a\u3050\u3068\u3001\u30dd\u30fc\u30c81\u5074\u306e\u9752\u3044LED\u304c\u70b9\u706f\u3059\u308b(USB\u30dd\u30fc\u30c8\u306f\u30db\u30c3\u30c8\u30d7\u30e9\u30b0\u5bfe\u5fdc)\u3002\u3053\u306eLED\u306fLED1\u30d4\u30f3(#1)\u306b\u63a5\u7d9a\u3055\u308c\u3066\u3044\u3066\u3001LED1\u30d4\u30f3\u304cLOW\u30ec\u30d9\u30eb\u306e\u3068\u304d\u70b9\u706f\u3059\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u308b\u3002LED1\u30d4\u30f3\u306f\u3001\u63a5\u7d9a\u3055\u308c\u305f\u30c7\u30d0\u30a4\u30b9\u306e\u8a8d\u8b58\u304c\u5b8c\u4e86\u3057\u305f\u6642\u70b9\u3067LOW\u3068\u306a\u308a\u3001\u4f55\u304b\u306e\u30ad\u30fc\u5165\u529b\u3092\u691c\u51fa\u3059\u308b\u3068260msec\u9593\u306eHIGH\u306e\u3042\u3068LOW\u306b\u623b\u308b\u3002\u3064\u307e\u308a\u3001\u30ad\u30fc\u5165\u529b\u306e\u305f\u3073\u306b\u30c1\u30ab\u30c1\u30ab\u3059\u308b\u3002\u3053\u308c\u306b\u3088\u308a\u3001CH9350L\u304c\u30ad\u30fc\u5165\u529b\u3092\u691c\u51fa\u3057\u3066\u3044\u308b\u3053\u3068\u304c\u8996\u899a\u7684\u306b\u5206\u304b\u308b\u3002<\/p>\n<p>(hoboNicola\u30a2\u30c0\u30d7\u30bf\u30fc\u7528\u306e\u56de\u8def\u56f3\u306f\u6b21\u306e\u6295\u7a3f\u3067\u63b2\u8f09\u306e\u4e88\u5b9a)\u3002<\/p>\n<h1>Pro Micro(+5V\/16MHz)\u3068\u306e\u63a5\u7d9a<\/h1>\n<p>CH9350L\u306eTXD\u3068RXD\u3092Pro Micro\u306eRX(PD2)\u3068TX(PD3)\u306b\u63a5\u7d9a\u3057\u3001+5V\u3068GND\u3092\u63a5\u7d9a\u3059\u308b\u3060\u3051\u306a\u306e\u3067\u7279\u306b\u914d\u7dda\u56f3\u306f\u306a\u3057\u3002Pro Micro\u3067\u52d5\u304b\u3059\u30b9\u30b1\u30c3\u30c1\u3067\u306f\u30cf\u30fc\u30c9\u30a6\u30a7\u30a2UART\u306eSerial1\u306b\u3088\u3063\u3066CH9350L\u3068\u5165\u51fa\u529b\u3059\u308b\u3053\u3068\u306b\u306a\u308b\u3002<\/p>\n<h4>+5V\u30ed\u30b8\u30c3\u30af\u3068\u306e\u63a5\u7d9a\u306b\u3064\u3044\u3066<\/h4>\n<p>CH9350L\u306f\u57fa\u672c\u7684\u306b+3.3V\u52d5\u4f5c\u306a\u306e\u3067\u3001 \u5165\u51fa\u529b\u30ec\u30d9\u30eb\u304c+3.3V\u306e\u30de\u30a4\u30b3\u30f3\u3068\u63a5\u7d9a\u3059\u308b\u306e\u304c\u9593\u9055\u3044\u306e\u306a\u3044\u3068\u3053\u308d\u3060\u304c\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u7406\u7531\u3067+5V\u30ed\u30b8\u30c3\u30af\u306e Pro Micro (+5V\/16MHz)\u306b\u76f4\u7d50\u3057\u3066\u3082\u5927\u4e08\u592b\u3060\u308d\u3046\u3068\u5224\u65ad\u3057\u305f\u3002\u30c7\u30fc\u30bf\u30b7\u30fc\u30c8\u306b\u660e\u793a\u3055\u308c\u3066\u3044\u306a\u3044\u4e8b\u9805\u306a\u306e\u3067\u3001\u58ca\u308c\u3066\u3082\u3057\u304b\u305f\u304c\u306a\u3044\u3068\u3044\u3046\u524d\u63d0\u3002<\/p>\n<p>CH9350L\u306eUART\u306e\u51fa\u529b\u5074(TXD)\u306eHIGH\u30ec\u30d9\u30eb\u306f+3.3V\u306a\u306e\u3067+5V\u30ed\u30b8\u30c3\u30af\u306e\u30de\u30a4\u30b3\u30f3\u306eRXD\u306b\u305d\u306e\u307e\u307e\u63a5\u7d9a\u3057\u3066\u3082\u554f\u984c\u306a\u3044\u3002\u5165\u529b\u5074(RXD)\u306b\u3064\u3044\u3066\u306f\u3001<strong>CH559L\u304c\u5927\u4e08\u592b\u306a\u306e\u3060\u304b\u3089CH9350L\u3082\u30aa\u30fc\u30b1\u30fc<\/strong>\u3060\u308d\u3046\u3068\u8003\u3048\u305f\u3002<\/p>\n<p>\u540c\u3058\u4f1a\u793e\u304c\u4f5c\u3063\u3066\u3044\u308bMCS51\u4e92\u63db\u306eCH559\u3067\u306f\u3001\u591a\u304f\u306eGPIO\u5165\u529b\u306b\u3064\u3044\u3066<span style=\"text-decoration: underline;\">+5V\u30ec\u30d9\u30eb\u306e\u5165\u529b\u304c\u8a31\u5bb9\u3055\u308c\u3066\u3044\u308b<\/span> (<a href=\"https:\/\/akizukidenshi.com\/download\/ds\/wch\/CH559Datasheet.pdf\" target=\"_blank\" rel=\"noopener\">CH559 \u30c7\u30fc\u30bf\u30b7\u30fc\u30c8<\/a>\u306e <em>2.Features<\/em> \u306b\u6b21\u306e\u3088\u3046\u306b\u660e\u8a18\u3055\u308c\u3066\u3044\u308b\u3002<em>GPIO: support up to 45 GPIO,3.3V voltage output, support 5V voltage input except pins:P1.0\uff5eP1.7, XI, XO, RST<\/em>)\u3002<\/p>\n<p>QFP\u306eCH559L\u3068CH9350L\u3067\u306f\u3001\u4f7f\u3044\u65b9\u304c\u4e00\u81f4\u3057\u3066\u3044\u308b\u30d4\u30f3\u304c\u591a\u304fCH559\u306e#27\u30d4\u30f3\u306fRXD1\/P2.6\u3067\u3042\u308aCH9350L\u306eRXD\u30d4\u30f3\u3082#27\u30d4\u30f3\u3002CH559L\u306b\u5c02\u7528\u306e\u30d5\u30a1\u30fc\u30e0\u30a6\u30a7\u30a2\u3092\u713c\u3044\u305f\u3082\u306e\u304cCH9350L\u3067\u306f\u306a\u304b\u308d\u3046\u304b\u3002\u78ba\u8a3c\u306e\u306a\u3044\u8a71\u3067\u306f\u3042\u308b\u304c\u3001\u5c11\u306a\u304f\u3068\u3082\u3046\u3061\u3067\u306f +5V\u52d5\u4f5c\u306ePro\u00a0 Micro\u3068\u63a5\u7d9a\u3057\u3066\u58ca\u308c\u305a\u306b\u52d5\u3044\u3066\u3044\u308b\u3002\u5fc3\u914d\u306a\u65b9\u306f\u3001+3.3V\u306e\u30de\u30a4\u30b3\u30f3\u3067\u8a66\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2>\u52d5\u4f5c\u78ba\u8a8d\u30b9\u30b1\u30c3\u30c1<\/h2>\n<p>Pro Micro\u306eUSB\u306fPC\u306b\u63a5\u7d9a\u3057\u3066\u4eee\u60f3COM\u30dd\u30fc\u30c8\u3068\u3057\u3001\u30b7\u30ea\u30a2\u30eb\u30e2\u30cb\u30bf\u3067\u30c7\u30fc\u30bf\u304c\u898b\u3048\u308b\u3088\u3046\u306b\u3057\u305f\u3002<\/p>\n<h3>\u3068\u308a\u3042\u3048\u305a\u30c7\u30fc\u30bf\u3092\u898b\u308b<\/h3>\n<p>\u4f8b\u3048\u3070\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b9\u30b1\u30c3\u30c1\u3092\u66f8\u304f\u3068\u3001CH9350L\u304b\u3089\u9001\u3089\u308c\u3066\u304f\u308b\u30c7\u30fc\u30bf\u3092\u30b7\u30ea\u30a2\u30eb\u30e2\u30cb\u30bf\u3067\u898b\u308b\u3053\u3068\u304c\u51fa\u6765\u308b\u3002<\/p>\n<pre class=\"lang:default decode:true\">static const char hex[] = \"0123456789ABCDEF\";\r\nvoid dump_byte(uint8_t c) {\r\n  char tmp[3];\r\n  tmp[0] = hex[(c &gt;&gt; 4) &amp; 0x0f];\r\n  tmp[1] = hex[c &amp; 0x0f];\r\n  tmp[2] = 0; \r\n  Serial.print(tmp);\r\n  Serial.print(\" \");\r\n}\r\nvoid setup() {\r\n  Serial1.begin(115200);\r\n  Serial.begin(115200);\r\n}\r\n\r\nvoid loop() {\r\n  while(Serial1.available()) {\r\n    uint8_t c = Serial1.read();\r\n    dump_byte(c);\r\n  }\r\n}<\/pre>\n<p>\u3053\u306e\u30b9\u30b1\u30c3\u30c1\u3092\u66f8\u304d\u8fbc\u3080\u3068\u3001\u30b7\u30ea\u30a2\u30eb\u30e2\u30cb\u30bf\u306b\u306f <span class=\"lang:default decode:true crayon-inline \">57 AB 82 A3 57 AB 82 A3 57 AB 82 A3 57 AB 82 A3&#8230;.<\/span>\u00a0 \u3068\u3044\u3046\u3001CH9350L\u304b\u3089\u306e4\u30d0\u30a4\u30c8\u306e\u30c7\u30fc\u30bf\u304c\u9023\u7d9a\u7684\u306b\u8868\u793a\u3055\u308c\u308b\u3002\u30c7\u30fc\u30bf\u30b7\u30fc\u30c8\u306b\u3088\u308b\u3068\u3001<strong>0x57 0xAB 0x82 0xA3<\/strong> \u3068\u3044\u3046\u30d5\u30ec\u30fc\u30e0\u306f\u3001<strong>\u30b9\u30c6\u30fc\u30bf\u30b9\u30ea\u30af\u30a8\u30b9\u30c8\u30d5\u30ec\u30fc\u30e0<\/strong>\u3068\u547c\u3070\u308c\u308b\u3082\u306e\u3067\u300166msec\u3054\u3068\u306b\u51fa\u529b\u3055\u308c\u3066\u304f\u308b\u3002\u6700\u5f8c\u306e0xA3\u306e\u4e0b\u4f4d4\u30d3\u30c3\u30c8\u306f\u3001IO1\uff5eIO4\u30d4\u30f3\u306e\u72b6\u614b(\u30ed\u30b8\u30c3\u30af\u30ec\u30d9\u30eb)\u3092\u8868\u3057\u3066\u3044\u308b\u3068\u306e\u3053\u3068\u3060\u304c\u3001\u7279\u306b\u78ba\u8a8d\u3057\u3066\u3044\u306a\u3044\u3002<\/p>\n<h4>\u52d5\u4f5c\u30b9\u30c6\u30fc\u30c80<\/h4>\n<p>\u983b\u7e41\u306b\u9001\u4fe1\u3055\u308c\u308b\u30b9\u30c6\u30fc\u30bf\u30b9\u30ea\u30af\u30a8\u30b9\u30c8\u30d5\u30ec\u30fc\u30e0\u3092\u505c\u6b62\u3055\u305b\u308b\u305f\u3081\u306b\u306f\u3001\u4e0a\u8a18\u306e4\u30d0\u30a4\u30c8\u3092\u53d7\u4fe1\u3057\u305f\u3068\u304d\u306b\u4ee5\u4e0b\u306e\u30c7\u30fc\u30bf\u30d5\u30ec\u30fc\u30e0\u3092\u9001\u4fe1\u3057CH9350L\u3092<strong>\u52d5\u4f5c\u30b9\u30c6\u30fc\u30c80<\/strong>\u306b\u8a2d\u5b9a\u3059\u308b\u3002<\/p>\n<p><span class=\"lang:default highlight:0 decode:true crayon-inline\">0x57 0xAB 0x12 0x00 0x00 0x00 0x00 0xFF 0x80 0x00 0x20<\/span><\/p>\n<p>\u52d5\u4f5c\u30b9\u30c6\u30fc\u30c80\u306f\u3001\u4eca\u56de\u306e\u3088\u3046\u306b\u30ad\u30fc\u30dc\u30fc\u30c9\u3084\u30de\u30a6\u30b9\u304b\u3089\u306e\u30c7\u30fc\u30bf\u3092\u5358\u7d14\u306b\u30b7\u30ea\u30a2\u30eb\u30c7\u30fc\u30bf\u3068\u3057\u3066\u53d6\u308a\u51fa\u3057\u305f\u3044\u3068\u304d\u306b\u7528\u3044\u308b\u52d5\u4f5c\u30b9\u30c6\u30fc\u30c8\u3067\u3001\u52d5\u4f5c\u30b9\u30c6\u30fc\u30c8\u3092\u5909\u66f4\u3059\u308b\u304b\u30ea\u30bb\u30c3\u30c8\u3059\u308b\u307e\u3067\u30b9\u30c6\u30fc\u30bf\u30b9\u30ea\u30af\u30a8\u30b9\u30c8\u30d5\u30ec\u30fc\u30e0\u306e\u9001\u4fe1\u306f\u6b62\u307e\u308b\u3002<\/p>\n<p>\u306a\u304a\u3001\u6b21\u56de\u306b\u63b2\u8f09\u4e88\u5b9a\u306ehoboNicola\u30a2\u30c0\u30d7\u30bf\u30fc\u7528\u306e\u30b9\u30b1\u30c3\u30c1\u3067\u306f\u3001\u30ad\u30fc\u30dc\u30fc\u30c9LED\u306e\u70b9\u706f\u3092\u5236\u5fa1\u3059\u308b\u305f\u3081\u306b\u52d5\u4f5c\u30b9\u30c6\u30fc\u30c81\u3092\u4f7f\u3046\u3002<\/p>\n<h2>CH9350_test01.ino<\/h2>\n<p>\u30d5\u30ec\u30fc\u30e0\u5358\u4f4d\u3067\u30c7\u30fc\u30bf\u3092\u8868\u793a\u3059\u308b\u305f\u3081\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b9\u30b1\u30c3\u30c1\u3092\u66f8\u3044\u305f\u3002<\/p>\n<pre class=\"height-set:true nums:true lang:default decode:true\">\/**\r\n * CH9350_test01.ino Copyright (c) 2022 Takeshi Higasa\r\n * This software is released under the MIT License.\r\n * http:\/\/opensource.org\/licenses\/mit-license.php\r\n*\/\r\n#include \"arduino.h\"\r\n#if defined(USE_TINYUSB)\r\n#include \"Adafruit_TinyUSB.h\"\r\n#endif\r\nvoid setup() {\r\n  Serial1.begin(115200);\r\n  Serial.begin(115200);\r\n}\r\nstatic const char hex[] = \"0123456789ABCDEF\";\r\nvoid dump_byte(uint8_t c) {\r\n  char tmp[3];\r\n  tmp[0] = hex[(c &gt;&gt; 4) &amp; 0x0f];\r\n  tmp[1] = hex[c &amp; 0x0f];\r\n  tmp[2] = 0;  \r\n  Serial.print(tmp);\r\n  Serial.print(\" \");\r\n}\r\nstatic const uint8_t set_state[] = {\r\n  0x57,0xAB,0x12,0x00,0x00,0x00,0x00,0xFF,0x80,0x00,0x20  \r\n};\r\nuint8_t opcode = 0;\r\nuint8_t data_length = 0;\r\nuint8_t rx_length = 0;\r\nuint8_t data_frame[100];\r\nstatic const uint8_t frame_size = sizeof(data_frame);\r\nstatic const uint8_t none = 0;\r\nstatic const uint8_t has_57 = 1;\r\nstatic const uint8_t has_57ab = 2;\r\nstatic const uint8_t has_op = 3;\r\nstatic const uint8_t wait_data = 4;\r\nuint8_t rx_state = none;\r\n\r\nvoid loop() {\r\n  while(Serial1.available()) {\r\n    uint8_t c = Serial1.read();\r\n    if (c == 0x57 &amp;&amp; rx_state == none) {    \r\n      rx_state = has_57;\r\n      Serial.println();\r\n    } else if (rx_state == has_57) {\r\n      if (c != 0xab)\r\n        rx_state = none;\r\n      else\r\n        rx_state = has_57ab;\r\n    } else if (rx_state == has_57ab) {\r\n      if (c == 0x84 || c == 0x86 || c == 0x87) {\r\n        rx_state = none;\r\n      } else {\r\n        rx_state = has_op;\r\n        opcode = c;\r\n      }\r\n    } else if (rx_state == has_op) {\r\n      switch(opcode) {\r\n      case 0x83:  \/\/ data frame.\r\n      case 0x88: \r\n        data_length = c;\r\n        rx_length = 0;\r\n        rx_state = wait_data;       \r\n        break;\r\n      case 0x82:  \/\/ sync status.\r\n        Serial1.write(set_state, sizeof(set_state));\r\n        \/\/ through\r\n      default:\r\n        rx_state = none;\r\n        break;\r\n      } \r\n      opcode = 0;\r\n    } else if (rx_state == wait_data) {\r\n      data_frame[rx_length++] = c;          \r\n      if (rx_length &gt;= data_length || rx_length &gt;= frame_size) {\r\n        rx_state = none;\r\n        \/\/ data_frame[]\u306e\u4e2d\u8eab\u3092\u51e6\u7406\u3059\u308b\u3002\r\n      }\r\n    }\r\n    dump_byte(c);\r\n  }\r\n}<\/pre>\n<p>loop() \u306e\u4e2d\u8eab\u306f\u30b7\u30ea\u30a2\u30eb\u30c7\u30fc\u30bf\u3092\u53d7\u3051\u53d6\u308b\u969b\u306b\u6eef\u308a\u304c\u306a\u3044\u3088\u3046\u3001\u7c21\u5358\u306a\u30b9\u30c6\u30fc\u30c8\u30de\u30b7\u30f3\u3068\u3057\u305f\u3002\u3044\u304f\u3064\u304b\u30ad\u30fc\u3092\u53e9\u3044\u3066\u307f\u308b\u3068\u3001\u30b7\u30ea\u30a2\u30eb\u30e2\u30cb\u30bf\u306b\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8868\u793a\u3055\u308c\u305f\u3002<\/p>\n<pre class=\"lang:default decode:true\">57 AB 82 A3 \r\n57 AB 87 \r\n57 AB 88 0B 10 01 00 00 00 00 00 00 00 08 09 \/\/ \u5de6Ctrl\u30ad\u30fc \u30aa\u30f3\r\n57 AB 88 0B 10 01 00 2C 00 00 00 00 00 09 36 \/\/ \u5de6Ctrl + Space \u30aa\u30f3\r\n57 AB 88 0B 10 01 00 00 00 00 00 00 00 0A 0B \/\/ Space \u30aa\u30d5\r\n57 AB 88 0B 10 00 00 00 00 00 00 00 00 0B 0B \/\/ Ctrl \u30aa\u30d5\r\n...<\/pre>\n<p>&#8220;57 AB 88&#8221; \u304b\u3089\u59cb\u307e\u308b\u306e\u304c\u30b9\u30c6\u30fc\u30c80\u3067\u306e<strong>\u30c7\u30fc\u30bf\u30d5\u30ec\u30fc\u30e0<\/strong>\u3067\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u69cb\u6210\u306b\u306a\u3063\u3066\u3044\u308b\u3002<\/p>\n<h3>\u30c7\u30fc\u30bf\u30d5\u30ec\u30fc\u30e0\u306e\u69cb\u6210<\/h3>\n<table style=\"border-collapse: collapse; width: 100%; height: 384px;\">\n<tbody>\n<tr style=\"height: 36px;\">\n<td style=\"width: 24.4726%; height: 36px;\">\u30d5\u30a3\u30fc\u30eb\u30c9\u540d\u79f0<\/td>\n<td style=\"width: 8.64971%; height: 36px;\">\u30d0\u30a4\u30c8\u6570<\/td>\n<td style=\"width: 66.8776%; height: 36px;\">\u5185\u5bb9\/\u5099\u8003<\/td>\n<\/tr>\n<tr style=\"height: 18px;\">\n<td style=\"width: 24.4726%; height: 18px;\">\u30d5\u30ec\u30fc\u30e0\u30d8\u30c3\u30c0<\/td>\n<td style=\"width: 8.64971%; height: 18px;\">2<\/td>\n<td style=\"width: 66.8776%; height: 18px;\">\u5e38\u306b0x57 0xAB<\/td>\n<\/tr>\n<tr style=\"height: 18px;\">\n<td style=\"width: 24.4726%; height: 18px;\">opcode<\/td>\n<td style=\"width: 8.64971%; height: 18px;\">1<\/td>\n<td style=\"width: 66.8776%; height: 18px;\">0x88 (\u30b9\u30c6\u30fc\u30c81\u3067\u306f0x83)<\/td>\n<\/tr>\n<tr style=\"height: 18px;\">\n<td style=\"width: 24.4726%; height: 18px;\">\u30c7\u30fc\u30bf\u9577<br \/>\ndata_length<\/td>\n<td style=\"width: 8.64971%; height: 18px;\">1<\/td>\n<td style=\"width: 66.8776%; height: 18px;\">\u4ee5\u964d\u306e\u30d0\u30a4\u30c8\u6570<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 24.4726%;\">\u63a5\u7d9a\u60c5\u5831<br \/>\ndevice_kind<\/td>\n<td style=\"width: 8.64971%;\">1<\/td>\n<td style=\"width: 66.8776%;\">\u63a5\u7d9a\u6a5f\u5668\u3068\u63a5\u7d9a\u3055\u308c\u3066\u3044\u308b\u30dd\u30fc\u30c8\u3092\u8868\u3059\u3002<br \/>\n\u30c7\u30fc\u30bf\u30b7\u30fc\u30c8\u3067\u306f\u4ee5\u4e0b\u306e\u30d3\u30c3\u30c8\u69cb\u6210\u306b\u306a\u3063\u3066\u3044\u308b\u3002<\/p>\n<pre class=\"lang:default highlight:0 decode:true\">MSB 7 6 5 4 3 2 1 0   \r\n--------------------\r\n    0 0 S S 0 T T P\r\nSS = 00:other, 01:keyboard, 10:mouse, 11: media\r\nTT = 00:Unknown,01:HID,10:BIOS, 11:Reserved.\r\nP = 0: Port1\u30011:Port 2<\/pre>\n<\/td>\n<\/tr>\n<tr style=\"height: 18px;\">\n<td style=\"width: 24.4726%; height: 18px;\">\u30c7\u30fc\u30bf<br \/>\nreport<\/td>\n<td style=\"width: 8.64971%; height: 18px;\">\u53ef\u5909<\/td>\n<td style=\"width: 66.8776%; height: 18px;\">HID \u5165\u529b\u30ec\u30dd\u30fc\u30c8<\/td>\n<\/tr>\n<tr style=\"height: 36px;\">\n<td style=\"width: 24.4726%; height: 36px;\">\u30b7\u30ea\u30a2\u30eb<br \/>\n\u756a\u53f7<\/td>\n<td style=\"width: 8.64971%; height: 36px;\">1<\/td>\n<td style=\"width: 66.8776%; height: 36px;\">\u30ea\u30bb\u30c3\u30c8\u66420\u3067\u59cb\u307e\u308b\u30b7\u30ea\u30a2\u30eb\u756a\u53f7\u3002\u9001\u4fe1\u90fd\u5ea6\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\u3055\u308c\u308b\u3002<\/td>\n<\/tr>\n<tr style=\"height: 18px;\">\n<td style=\"width: 24.4726%; height: 18px;\">\u30c1\u30a7\u30c3\u30af\u30b5\u30e0<\/td>\n<td style=\"width: 8.64971%; height: 18px;\">1<\/td>\n<td style=\"width: 66.8776%; height: 18px;\">\u30c7\u30fc\u30bf\u3068\u30b7\u30ea\u30a2\u30eb\u756a\u53f7\u306e\u7dcf\u548c\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Ctrl + Space\u3092\u62bc\u4e0b\u3057\u305f\u3068\u304d\u306e\u30c7\u30fc\u30bf <span class=\"lang:default highlight:0 decode:true crayon-inline \">57 AB 88 0B 10 01 00 2C 00 00 00 00 00 09 36<\/span>\u00a0 \u306e\u3046\u3061\u30010x0B\u306f 0x10\u4ee5\u964d\u306b11\u30d0\u30a4\u30c8\u3042\u308b\u3053\u3068\u3092\u30010x10 \u306f Unknown\u306a\u30ad\u30fc\u30dc\u30fc\u30c9\u304c\u30dd\u30fc\u30c81\u306b\u63a5\u7d9a\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u8868\u3057\u3066\u3044\u308b\u3002\u305d\u3057\u3066\u4ee5\u964d\u306e8\u30d0\u30a4\u30c8\u304c\u5165\u529b\u30ec\u30dd\u30fc\u30c8\u672c\u4f53\u3067\u3001\u305d\u306e\u5f8c\u306b\u30b7\u30ea\u30a2\u30eb\u756a\u53f7\u3068\u30c1\u30a7\u30c3\u30af\u30b5\u30e0\u304c\u7d9a\u3044\u3066\u3044\u308b\u3002<\/p>\n<p>\u307e\u305f\u3001\u30dd\u30fc\u30c82\u306bUSB\u30de\u30a6\u30b9\u3092\u3064\u306a\u3044\u3067\u307f\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30c7\u30fc\u30bf\u304c\u5f97\u3089\u308c\u308b\u3002<\/p>\n<pre class=\"lang:default decode:true \">57 AB 88 07 21 01 03 FE 00 FE 00 \r\n57 AB 88 07 21 01 03 FE 00 FF 01 \r\n57 AB 88 07 21 01 03 FE 00 00 02<\/pre>\n<p>\u63a5\u7d9a\u60c5\u5831\u304c0x21\u306a\u306e\u3067\u3001Unknown\u306a\u30de\u30a6\u30b9\u304c\u30dd\u30fc\u30c82\u306b\u63a5\u7d9a\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u306b\u306a\u308b\u3002\u30c7\u30fc\u30bf\u90e8\u5206\u306f4\u30d0\u30a4\u30c8\u69cb\u6210\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3060\u3063\u305f\u3002<\/p>\n<pre class=\"lang:default decode:true\"> 0     1      2      3\r\n-------------------------\r\nBtns  Xmove  Ymove  Wheel\r\nBtns: bit0: Left, bit1:Right, bit2:Center<\/pre>\n<p>\u52d5\u4f5c\u30b9\u30c6\u30fc\u30c80\u306e\u5834\u5408\u3001\u63a5\u7d9a\u4e2d\u306e\u30ad\u30fc\u30dc\u30fc\u30c9\u304cBIOS (Boot\u30d7\u30ed\u30c8\u30b3\u30eb)\u306a\u306e\u304bHID(\u30ec\u30dd\u30fc\u30c8\u30d7\u30ed\u30c8\u30b3\u30eb)\u306a\u306e\u304b\u304c\u5224\u5225\u3067\u304d\u306a\u3044\u3088\u3046\u3060\u3063\u305f\u3002\u307e\u305f\u3001Fn\u30ad\u30fc\u306a\u3069\u3068\u306e\u4f75\u7528\u3067\u30e1\u30c7\u30a3\u30a2\u5236\u5fa1\u3084\u30b7\u30b9\u30c6\u30e0\u5236\u5fa1\u7528\u30b3\u30fc\u30c9\u3092\u51fa\u529b\u3059\u308b\u30b3\u30f3\u30dd\u30b8\u30c3\u30c8\u30c7\u30d0\u30a4\u30b9\u69cb\u6210\u306e\u30ad\u30fc\u30dc\u30fc\u30c9\u304b\u3069\u3046\u304b\u306e\u533a\u5225\u3082\u3067\u304d\u306a\u3044(\u52d5\u4f5c\u30b9\u30c6\u30fc\u30c81\u3067\u3082\u540c\u69d8)\u3002<\/p>\n<p>CH9350L\u306b\u3064\u306a\u304c\u3063\u3066\u3044\u308b\u30ad\u30fc\u30dc\u30fc\u30c9\u3084\u30de\u30a6\u30b9\u306e\u30ec\u30dd\u30fc\u30c8\u30c7\u30a3\u30b9\u30af\u30ea\u30d7\u30bf\u3092\u30d7\u30ed\u30b0\u30e9\u30e0\u7684\u306b\u898b\u308b\u3053\u3068\u304c\u3067\u304d\u306a\u3044\u306e\u3067\u3001\u3042\u3089\u3086\u308bUSB\u30ad\u30fc\u30dc\u30fc\u30c9\u306e\u30c7\u30fc\u30bf\u3092\u30b7\u30ea\u30a2\u30eb\u5909\u63db\u3059\u308b\u4ed5\u7d44\u307f\u306e\u5b9f\u88c5\u306f\u96e3\u3057\u3044\u3060\u308d\u3046\u3002\u305f\u3060\u3001\u30ad\u30fc\u30dc\u30fc\u30c9\u306b\u5408\u308f\u305b\u3066\u30b9\u30b1\u30c3\u30c1\u3092\u76f4\u305b\u3070\u306a\u3093\u3068\u304b\u306a\u308a\u305d\u3046\u306a\u306e\u3067\u3001\u500b\u4eba\u306e\u8da3\u5473\u7528\u3068\u3057\u3066\u306f\u554f\u984c\u306a\u3044\u306e\u3060\u304c\u3002<\/p>\n<h2>\u30ad\u30fc\u5165\u529b\u30c7\u30fc\u30bf\u306e\u62bd\u51fa (CH9350_test02.ino)<\/h2>\n<p>\u5148\u306e\u30b9\u30b1\u30c3\u30c1\u3067\u306f\u3001opcode = 0x88 \u306e\u3068\u304d\u306e\u30c7\u30fc\u30bf(\u63a5\u7d9a\u60c5\u5831\u30d5\u30a3\u30fc\u30eb\u30c9\u4ee5\u964d)\u304c data_frame\u00a0 \u914d\u5217 \u306b\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u3002\u3053\u306e\u30b9\u30b1\u30c3\u30c1\u3067\u306f\u3001\u63a5\u7d9a\u6a5f\u5668\u304c\u30ad\u30fc\u30dc\u30fc\u30c9\u306e\u3068\u304d\u3001data_frame \u5185\u306eHID\u5165\u529b\u30ec\u30dd\u30fc\u30c8\u3092\u76f4\u524d\u306b\u53d7\u4fe1\u3057\u305f\u5185\u5bb9\u3068\u6bd4\u8f03\u3057\u3001\u30aa\u30f3\u306b\u306a\u3063\u305f\u30ad\u30fc\u3068\u30aa\u30d5\u306b\u306a\u3063\u305f\u30ad\u30fc\u3092\u691c\u51fa\u3057\u3066\u30b7\u30ea\u30a2\u30eb\u30e2\u30cb\u30bf\u306b\u8868\u793a\u3059\u308b\u3088\u3046\u306b\u3057\u305f\u3002\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b9\u30b1\u30c3\u30c1\u3068\u3057\u305f\u3002<\/p>\n<pre class=\"height-set:true lang:default decode:true\">\/**\r\n * CH9350_test02.ino Copyright (c) 2022 Takeshi Higasa\r\n * This software is released under the MIT License.\r\n * http:\/\/opensource.org\/licenses\/mit-license.php\r\n*\/\r\n#include \"arduino.h\"\r\n#if defined(USE_TINYUSB)\r\n#include \"Adafruit_TinyUSB.h\"\r\n#endif\r\n\r\nvoid dump_byte(uint8_t c) {\r\n  static const char hex[] = \"0123456789ABCDEF\";\r\n  char tmp[3];\r\n  tmp[0] = hex[(c &gt;&gt; 4) &amp; 0x0f];\r\n  tmp[1] = hex[c &amp; 0x0f];\r\n  tmp[2] = 0;  \r\n  Serial.print(tmp);\r\n  Serial.print(\" \");\r\n}\r\nvoid key_event(uint8_t hid_code, bool on) {\r\n  dump_byte(hid_code);\r\n  Serial.println(on ? \"ON\" : \"OFF\");\r\n}\r\n\r\nstatic const uint8_t keys_count = 10;     \/\/ key_array size.\r\nstatic const uint8_t report_size = keys_count + 2; \/\/ key_array and modifiers and reserved.\r\nstatic const uint8_t frame_size = report_size + 3; \/\/ (dev_kind, report, serial, sum)\r\nuint8_t prev_rep[report_size] = {0};\r\n\r\nvoid parse_report(uint8_t* data, uint8_t datalen) {\r\n  if (!data || datalen &lt; 4)\r\n    return; \/\/ illegal size.\r\n#if 1\r\n  for(uint8_t i = 0; i &lt; datalen; i++)\r\n    dump_byte(data[i]);\r\n  Serial.print(\" : \");\r\n#endif    \r\n  uint8_t* rep = &amp;data[1];\r\n  if (rep[2] == 0x01) \/\/ roll-over error\r\n    return;\r\n\/\/ modifiers.\r\n  uint8_t change = rep[0] ^ prev_rep[0];\r\n  static const uint8_t modifier_base = 0xe0;\r\n  if (change != 0) {\r\n    uint8_t mask = 1;\r\n    for(uint8_t i = 0; i &lt; 8; i++, mask &lt;&lt;= 1) {\r\n      if (change &amp; mask) key_event(modifier_base + i, rep[0] &amp; mask);\r\n    }    \r\n  }\r\n\/\/ keys.\r\n  uint8_t rep_size = datalen -= 3;\r\n  for(uint8_t i = 2; i &lt; rep_size; i++) {  \/\/ search pressed.\r\n    bool cur_match = false;\r\n    bool prev_match = false;\r\n    for(uint8_t n = 2; n &lt; rep_size; n++) {\r\n      if (rep[i] == prev_rep[n]) cur_match = true;\r\n      if (prev_rep[i] == rep[n]) prev_match = true;\r\n    }\r\n    if (!cur_match) key_event(rep[i], true);  \/\/ detect ON key.\r\n    if (!prev_match) key_event(prev_rep[i], false); \/\/ detect OFF key.\r\n  }\r\n  memcpy(prev_rep, rep, report_size);  \r\n}\r\n\r\nstatic const uint8_t none = 0;\r\nstatic const uint8_t has_57 = 1;\r\nstatic const uint8_t has_57ab = 2;\r\nstatic const uint8_t has_op = 3;\r\nstatic const uint8_t wait_data = 4;\r\n\r\nstatic const uint8_t set_state[] = {\r\n  0x57,0xAB,0x12,0x00,0x00,0x00,0x00,0xFF,0x80,0x00,0x20  \r\n};\r\nvoid ch9350_loop() {\r\n  static uint8_t rx_state = 0;\r\n  static uint8_t opcode = 0;\r\n  static uint8_t data_length = 0;\r\n  static uint8_t rx_length = 0;\r\n  static uint8_t data_frame[frame_size] = {0};\r\n  \r\n  while(Serial1.available()) {\r\n    uint8_t c = Serial1.read();\r\n    if (c == 0x57 &amp;&amp; rx_state == none) {    \r\n      rx_state = has_57;\r\n    } else if (rx_state == has_57) {\r\n      if (c != 0xab)\r\n        rx_state = none;\r\n      else\r\n        rx_state = has_57ab;\r\n    } else if (rx_state == has_57ab) {\r\n      if (c == 0x84 || c == 0x86 || c == 0x87) {\r\n        rx_state = none;\r\n      } else {\r\n        rx_state = has_op;\r\n        opcode = c;\r\n      }\r\n    } else if (rx_state == has_op) {\r\n      switch(opcode) {\r\n      case 0x83:  \/\/ data frame.\r\n      case 0x88: \r\n        data_length = c;\r\n        rx_length = 0;\r\n        rx_state = wait_data;       \r\n        break;\r\n      case 0x82:  \/\/ sync status.\r\n        Serial1.write(set_state, sizeof(set_state));\r\n        \/\/ through\r\n      default:\r\n        rx_state = none;\r\n        break;\r\n      } \r\n      opcode = 0;\r\n    } else if (rx_state == wait_data) {\r\n      data_frame[rx_length++] = c;          \r\n      if (rx_length &gt;= data_length || rx_length &gt;= frame_size) {\r\n        rx_state = none;\r\n        if ((data_frame[0] &amp; 0x30) == 0x10) \/\/ keyboard.\r\n          parse_report(data_frame, rx_length);\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\nvoid setup() {\r\n  Serial1.begin(115200);\r\n  Serial.begin(115200);\r\n}\r\n\r\nvoid loop() {\r\n  ch9350_loop();\r\n}<\/pre>\n<p>\u3053\u306e\u30b9\u30b1\u30c3\u30c1\u3067\u306f\u3001CH9350L\u304b\u3089\u53d7\u4fe1\u3092\u884c\u3046\u90e8\u5206\u3092\u3001<em>ch9350_loop()<\/em> \u3068\u3057\u3066\u72ec\u7acb\u3055\u305b\u3001HID\u5165\u529b\u30ec\u30dd\u30fc\u30c8\u306e\u5185\u5bb9\u304b\u3089\u65b0\u3057\u3044\u30ad\u30fc\u30a4\u30d9\u30f3\u30c8\u3092\u62bd\u51fa\u3059\u308b\u95a2\u6570 <em>parse_report()<\/em> \u3092\u8ffd\u52a0\u3057\u305f\u3002\u65b0\u3057\u304f\u30aa\u30f3\u307e\u305f\u306f\u30aa\u30d5\u306b\u306a\u3063\u305f\u30ad\u30fc\u306eHID\u30ad\u30fc\u30b3\u30fc\u30c9(Usage ID) \u3068\u30aa\u30f3\u30aa\u30d5\u60c5\u5831\u306f <em>key_event()<\/em> \u3067\u30b7\u30ea\u30a2\u30eb\u30e2\u30cb\u30bf\u306b\u8868\u793a\u3059\u308b\u3088\u3046\u306b\u3057\u305f\u3002\u3053\u306e\u30b9\u30b1\u30c3\u30c1\u306e\u5fdc\u7528\u3068\u3057\u3066\u306f\u3001<em>key_event()<\/em> \u306b\u624b\u3092\u52a0\u3048\u305f\u308a\u5225\u306e\u95a2\u6570\u306b\u30b3\u30fc\u30c9\u3092\u6e21\u3057\u305f\u308a\u3059\u308b\u3053\u3068\u3092\u60f3\u5b9a\u3057\u3066\u3044\u308b\u3002<\/p>\n<p>\u5b9f\u884c\u3059\u308b\u3068\u30b7\u30ea\u30a2\u30eb\u30e2\u30cb\u30bf\u306bdata_frame\u306e\u5185\u5bb9\u3068\u3001\u30aa\u30f3\u306b\u306a\u3063\u305f\u30ad\u30fc\u3001\u30aa\u30d5\u306b\u306a\u3063\u305f\u30ad\u30fc\u306eHID\u30ad\u30fc\u30b3\u30fc\u30c9\u3092\u8868\u793a\u3059\u308b\u3002<\/p>\n<pre class=\"lang:default decode:true\">10 01 00 00 00 00 00 00 00 51 52  : E0 ON  (\u5de6Ctrl \u30aa\u30f3)\r\n10 01 00 04 00 00 00 00 00 52 57  : 04 ON  (A \u30aa\u30f3)\r\n10 01 00 04 16 00 00 00 00 53 6E  : 16 ON  (S \u30aa\u30f3)\r\n10 01 00 04 16 07 00 00 00 54 76  : 07 ON  (D \u30aa\u30f3)\r\n10 01 00 04 16 07 09 00 00 55 80  : 09 ON  (F \u30aa\u30f3)\r\n10 01 00 16 07 09 00 00 00 56 7D  : 04 OFF (A \u30aa\u30d5)\r\n10 01 00 07 09 00 00 00 00 57 68  : 16 OFF (S \u30aa\u30d5)\r\n10 01 00 09 00 00 00 00 00 58 62  : 07 OFF (D \u30aa\u30d5)\r\n10 01 00 00 00 00 00 00 00 59 5A  : 09 OFF (F \u30aa\u30d5)\r\n10 00 00 00 00 00 00 00 00 5A 5A  : E0 OFF (\u5de6Ctrl \u30aa\u30d5)\r\n<\/pre>\n<p>(\u30b9\u30b1\u30c3\u30c1\u306f\u30ab\u30c3\u30b3\u5185\u306e\u8868\u793a\u3092\u3057\u307e\u305b\u3093\u306e\u3067)\u3002<\/p>\n<p>Ctrl\u3084Shift\u306a\u3069\u306e\u4fee\u98fe\u30ad\u30fc\u306b\u3064\u3044\u3066\u3082\u4ed6\u306e\u30ad\u30fc\u3068\u540c\u69d8\u306b\u6271\u3046\u305f\u3081\u30010xE0\uff5e0xE7\u3068\u3044\u3046\u30b3\u30fc\u30c9\u3092\u4e0e\u3048\u3066\u3044\u308b(\u30b3\u30fc\u30c9\u3068\u30ad\u30fc\u306e\u95a2\u4fc2\u306f\u4ee5\u4e0b\u306e modifiers \u3092\u53c2\u7167)\u3002\u3053\u3046\u3059\u308b\u3053\u3068\u3067\u3001\u30ad\u30fc\u5165\u529b\u3092\u5229\u7528\u3059\u308b\u5074\u3067\u306f\u4fee\u98fe\u30ad\u30fc\u306e\u5404\u30d3\u30c3\u30c8\u3092\u610f\u8b58\u3059\u308b\u5fc5\u8981\u304c\u306a\u304f\u306a\u308b\u3057\u3001\u305f\u3068\u3048\u3070\u30ad\u30fc\u30b3\u30fc\u30c9\u306e\u5165\u308c\u66ff\u3048\u306a\u3069\u304c\u5bb9\u6613\u306b\u306a\u308b\u3002<\/p>\n<p>HID\u30ad\u30fc\u30b3\u30fc\u30c9\u3068\u6587\u5b57\u3068\u306e\u95a2\u4fc2\u306f\u3001<a href=\"https:\/\/usb.org\/sites\/default\/files\/hut1_3_0.pdf\" target=\"_blank\" rel=\"noopener\">usb.org \u306e HID Usage Tables 1.3<\/a> \u3092\u53c2\u7167\u3002\u7b2c10\u7ae0\u306e Keyboard\/Keypad Page (0x07) \u306b\u5bfe\u5fdc\u8868\u304c\u63b2\u8f09\u3055\u308c\u3066\u3044\u308b\u3002<\/p>\n<h4>HID\u5165\u529b\u30ec\u30dd\u30fc\u30c8\u306b\u3064\u3044\u3066<\/h4>\n<p>\u30ad\u30fc\u30dc\u30fc\u30c9\u304b\u3089\u306e\u5178\u578b\u7684\u306a\u5165\u529b\u30ec\u30dd\u30fc\u30c8\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u69cb\u9020\u306b\u306a\u3063\u3066\u3044\u308b\u3002<\/p>\n<pre class=\"lang:default decode:true\">typedef struct {\r\n  uint8_t modifiers;  \/\/ 8\u3064\u306e\u4fee\u98fe\u30ad\u30fc\u306e\u72b6\u614b\r\n  uint8_t reserved; \r\n  uint8_t keys[REPORT_COUNT];  \/\/ \u6700\u5927REPORT_COUNT\u30ad\u30fc\u306e\u72b6\u614b\r\n} report_t;\r\n<\/pre>\n<p>REPORT_COUNT == 6 \u3068\u306a\u3063\u3066\u3044\u308b\u30ad\u30fc\u30dc\u30fc\u30c9\u304c\u591a\u3044\u304c\u3001\u30ec\u30dd\u30fc\u30c8\u30c7\u30a3\u30b9\u30af\u30ea\u30d7\u30bf\u306e\u5185\u5bb9\u306b\u3088\u3063\u3066\u306f\u3055\u3089\u306b\u591a\u3044\u5834\u5408\u3082\u3042\u308b\u3002\u4eca\u56de\u306e\u30b9\u30b1\u30c3\u30c1\u3067\u306f10\u30ad\u30fc\u307e\u3067\u3068\u3057\u305f\u3002\u3055\u3089\u306b\u5927\u304d\u304f\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u306a\u3089\u3070\u3001\u30c7\u30fc\u30bf\u9577\u306b\u5fdc\u3058\u3066\u30b9\u30b1\u30c3\u30c1\u3092\u5909\u66f4\u3059\u308c\u3070\u3088\u3044\u3060\u308d\u3046\u3002<\/p>\n<p>\u8a73\u7d30\u306b\u3064\u3044\u3066\u306f\u3001<a href=\"https:\/\/usb.org\/sites\/default\/files\/hid1_11.pdf\" target=\"_blank\" rel=\"noopener\">USB Device Class Definition for Human Interface Devices (HID) Firmware Specification\u20146\/27\/01 Version 1.11<\/a> \u3092\u53c2\u7167\u306e\u3053\u3068\u3002<\/p>\n<h5>modifiers<\/h5>\n<p>\u5165\u529b\u30ec\u30dd\u30fc\u30c8\u306e modifiers \u306b\u306f\u3001\u30aa\u30f3\u306b\u306a\u3063\u3066\u3044\u308b\u4fee\u98fe\u30ad\u30fc\u306e\u60c5\u5831\u304c\u30d3\u30c3\u30c8\u5358\u4f4d\u306b\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u3002<\/p>\n<pre class=\"lang:default highlight:0 decode:true \">(MSB) bit7   6      5      4      3      2      1      0 (LSB)\r\n      \u53f3GUI  \u53f3Alt \u53f3Shift \u53f3Ctrl \u5de6GUI \u5de6Alt \u5de6Shift \u5de6Ctrl<\/pre>\n<p>\u524d\u56de\u53d7\u4fe1\u6642\u306emodifiers\u3068XOR\u3092\u3068\u308b\u3053\u3068\u3067\u5909\u5316\u306e\u3042\u3063\u305f\u30ad\u30fc\u3092\u691c\u51fa\u3059\u308b\u3002\u305d\u3057\u3066\u305d\u306e\u5909\u5316\u304c\u30010\u304b\u30891 (\u30aa\u30f3)\u306a\u306e\u304b\u30011\u304b\u30890 (\u30aa\u30d5)\u306a\u306e\u304b\u3092\u5224\u5b9a\u3057\u3066\u3044\u308b\u3002<\/p>\n<p>\u30b9\u30b1\u30c3\u30c1\u306e <em>parse_report()<\/em> \u3067\u306f\u3001\u5404\u4fee\u98fe\u30ad\u30fc\u306e\u30d3\u30c3\u30c8\u4f4d\u7f6e(0 .. 7 )\u30920xe0\u306b\u52a0\u3048\u305f\u30b3\u30fc\u30c9\u3092\u51fa\u529b\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u308b\u3002<\/p>\n<h5>keys[]<\/h5>\n<p>\u30ad\u30fc\u30dc\u30fc\u30c9\u3067\u73fe\u5728\u62bc\u3055\u308c\u3066\u3044\u308b\u30ad\u30fc\u306eHID\u30ad\u30fc\u30b3\u30fc\u30c9\u304c\u683c\u7d0d\u3055\u308c\u308b\u3002\u5bfe\u5fdc\u53ef\u80fd\u306a\u30ad\u30fc\u6570\u3092\u8d85\u3048\u308b\u3068\u3001keys[] \u306e\u5168\u8981\u7d20\u306b 0x01 \u304c\u683c\u7d0d\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u3063\u3066\u3044\u308b\u3002<\/p>\n<p>\u4e0a\u8a18\u306e\u30b7\u30ea\u30a2\u30eb\u30e2\u30cb\u30bf\u51fa\u529b\u3067\u306f\u3001\u62bc\u3057\u305f\u9806\u306b\u914d\u5217\u306e\u524d\u304b\u3089HID\u30ad\u30fc\u30b3\u30fc\u30c9\u304c\u5165\u308a\u3001\u30ad\u30fc\u3092\u96e2\u3057\u305f\u3068\u304d\u3082\u62bc\u4e0b\u4e2d\u306e\u30ad\u30fc\u306e\u30b3\u30fc\u30c9\u306f\u524d\u8a70\u3081\u3055\u308c\u3066\u3044\u308b\u3002HID\u898f\u683c\u3067\u306f\u30b3\u30fc\u30c9\u306e\u683c\u7d0d\u306e\u9806\u5e8f\u3084\u683c\u7d0d\u4f4d\u7f6e\u306f\u898f\u5b9a\u3055\u308c\u3066\u3044\u306a\u3044 (\u4e0a\u8a18HID\u4ed5\u69d8\u66f8\u306e <em><strong>Appendix C. Keyboard Implementation<\/strong><\/em> \u3092\u53c2\u7167)\u3002\u4ed6\u306eUSB\u30db\u30b9\u30c8\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3067\u306f\u3001\u304a\u305d\u3089\u304f\u9055\u3063\u305f\u52d5\u4f5c\u306b\u306a\u308b\u3060\u308d\u3046\u3002<\/p>\n<h2>USB\u30cf\u30d6\u3078\u306e\u5bfe\u5fdc\u306b\u3064\u3044\u3066<\/h2>\n<p>USB\u30cf\u30d6\u3092\u5185\u8535\u3057\u305f\u30ad\u30fc\u30dc\u30fc\u30c9(PFU HHKB Lite2)\u3092CH9350L\u306e\u30dd\u30fc\u30c81\u306b\u63a5\u7d9a\u3057\u305f\u5834\u5408\u3001\u4ed6\u306e\u30ad\u30fc\u30dc\u30fc\u30c9\u3068\u540c\u69d8\u306b\u30c7\u30fc\u30bf\u30d5\u30ec\u30fc\u30e0\u3092\u53d7\u3051\u53d6\u308b\u3053\u3068\u304c\u3067\u304d\u305f\u3002\u305f\u3060\u3001HHKB\u306e\u5185\u8535\u30c0\u30a6\u30f3\u30b9\u30c8\u30ea\u30fc\u30e0\u30dd\u30fc\u30c8\u306b\u3001\u30de\u30a6\u30b9\u3084\u30ad\u30fc\u30dc\u30fc\u30c9\u3092\u63a5\u7d9a\u3057\u3066\u30ea\u30bb\u30c3\u30c8\u3092\u304b\u3051\u3066\u3082\u3001\u305d\u308c\u3089\u306e\u30c7\u30d0\u30a4\u30b9\u304b\u3089\u306e\u5165\u529b\u306f\u53d7\u3051\u53d6\u308c\u306a\u304b\u3063\u305f\u3002<\/p>\n<p>CH9350L\u306e\u30dd\u30fc\u30c81\u306b\u3075\u3064\u3046\u306eUSB\u30cf\u30d6\u3092\u63a5\u7d9a\u3057\u3001\u30cf\u30d6\u306e\u30dd\u30fc\u30c8\u306b\u30ad\u30fc\u30dc\u30fc\u30c9\u3084\u30de\u30a6\u30b9\u3092\u63a5\u7d9a\u3057\u305f\u5834\u5408\u3082\u6709\u52b9\u306b\u306a\u308b\u306e\u306f1\u3064\u3060\u3051\u3060\u3063\u305f\u3002\u307e\u3068\u3081\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308b\u3002<\/p>\n<ul>\n<li>USB\u30cf\u30d6\u306f\u8a8d\u8b58\u3059\u308b\u304cCH9350L\u306e\u5404\u30dd\u30fc\u30c8\u304c\u8a8d\u8b58\u3067\u304d\u308bUSB\u30c7\u30d0\u30a4\u30b9\u306f1\u3064\u3002<\/li>\n<li>\u30ad\u30fc\u30dc\u30fc\u30c9\u3068\u30de\u30a6\u30b9\u3092\u3064\u306a\u3044\u3060USB\u30cf\u30d6\u3092\u63a5\u7d9a\u3057\u3066\u3082\u3001\u4f7f\u3048\u308b\u306e\u306f\u3044\u305a\u308c\u304b\u4e00\u65b9\u3060\u3051\u3002<\/li>\n<li>2\u53f0\u4f7f\u3046\u306a\u3089\u3070\u3001CH9350L\u306e2\u3064\u306e\u30dd\u30fc\u30c8\u306b\u304a\u306e\u304a\u306e\u63a5\u7d9a\u3057\u3066\u4f7f\u3046\u3002<\/li>\n<li>\u6d88\u8cbb\u96fb\u6d41\u7684\u306b\u53b3\u3057\u3044\u30c7\u30d0\u30a4\u30b9\u3092\u3064\u306a\u3050\u3088\u3046\u306a\u5834\u5408\u3001\u30bb\u30eb\u30d5\u30d1\u30ef\u30fc\u30cf\u30d6\u3092\u7d4c\u7531\u3059\u308b\u3088\u3046\u306a\u624b\u306f\u3042\u308b\u3002<\/li>\n<\/ul>\n<h1>\u304d\u3087\u3046\u306e\u307e\u3068\u3081<\/h1>\n<ul style=\"list-style-type: circle;\">\n<li>hoboNicola\u30a2\u30c0\u30d7\u30bf\u30fc\u3067\u4f7f\u3063\u3066\u304d\u305f USB \u30db\u30b9\u30c8\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc MAX3421E\u3092\u8f09\u305b\u305f mini USB Host Shield 2.0 \u304c\u307b\u307c\u5165\u624b\u4e0d\u80fd\u72b6\u614b\u306b\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u306e\u3067\u3001\u4ee3\u66ff\u54c1\u3068\u3057\u3066CH9350L\u304c\u4f7f\u3048\u306a\u3044\u3082\u306e\u304b\u3068\u601d\u3063\u3066\u8a66\u3057\u3066\u307f\u305f\u3089\u3001\u308f\u308a\u3068\u3042\u3063\u3055\u308a\u52d5\u3044\u305f\u3002<\/li>\n<li>\u4eca\u56de\u306e\u30b9\u30b1\u30c3\u30c1\u306f\u3001Pro Micro(5V\/16MHz)\u3068Seeeduino XIAO-m0 \u3067\u52d5\u4f5c\u3059\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u305f\u3002Serial1\u304c\u4f7f\u3048\u308c\u3070\u3001\u4ed6\u306eArduino\u30dc\u30fc\u30c9\u3067\u3082\u5927\u4e08\u592b\u3058\u3083\u306a\u304b\u308d\u3046\u304b\u3002<\/li>\n<li>\u6b21\u56de\u306f\u3001\u4eca\u56de\u306e\u30b9\u30b1\u30c3\u30c1\u3092\u767a\u5c55\u3055\u305b\u3066hoboNicola\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u5229\u7528\u53ef\u80fd\u306b\u3059\u308b\u8a71\u3068\u3001CH9350L\u3068Seeeduino XIAO-m0 \u3092\u4f7f\u3063\u305fhoboNicola\u30a2\u30c0\u30d7\u30bf\u30fc\u3092\u4f5c\u308b\u8a71\u306b\u306a\u308b\u4e88\u5b9a\u3067\u3059\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981 USB\u30ad\u30fc\u30dc\u30fc\u30c9\u3084\u30de\u30a6\u30b9\u3092\u8a8d\u8b58\u3057\u3001HID\u5165\u529b\u30ec\u30dd\u30fc\u30c8\u3092\u30b7\u30ea\u30a2\u30eb\u30c7\u30fc\u30bf\u3068\u3057\u3066\u51fa\u529b\u3057\u3066\u304f\u308c\u308b CH9350L\u3092\u4f7f\u3063\u3066USB\u30ad\u30fc\u30dc\u30fc\u30c9\u3092Arduino\u30dc\u30fc\u30c9\u306b\u63a5\u7d9a\u3057\u30ad\u30fc\u30dc\u30fc\u30c9\u5165\u529b\u3092\u5229\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u3002\u30b7\u30ea\u30a2\u30eb\u30dd\u30fc\u30c8(U &hellip; <a href=\"https:\/\/okiraku-camera.tokyo\/blog\/?p=14604\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">CH9350L\u3092\u4f7f\u3063\u3066Arduino\u30dc\u30fc\u30c9\u306bUSB\u30ad\u30fc\u30dc\u30fc\u30c9\u3092\u63a5\u7d9a\u3059\u308b<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[69],"tags":[65,204,151,103],"class_list":["post-14604","post","type-post","status-publish","format-standard","hentry","category-programming","tag-arduino","tag-ch9350","tag-hobonicola","tag-promicro"],"_links":{"self":[{"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=\/wp\/v2\/posts\/14604","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=14604"}],"version-history":[{"count":0,"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=\/wp\/v2\/posts\/14604\/revisions"}],"wp:attachment":[{"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=14604"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=14604"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=14604"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}