Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Raw HID とOLEDで広げるキーボードの可能性/Expanding Keyboard P...
Search
hachi (Hayao Kimura)
December 07, 2024
230
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Raw HID とOLEDで広げるキーボードの可能性/Expanding Keyboard Possibilities with Raw HID and OLED
hachi (Hayao Kimura)
December 07, 2024
More Decks by hachi (Hayao Kimura)
See All by hachi (Hayao Kimura)
転職を「転機」にする/Turning a job change into a turning point
hayaokimura
2
210
Integration of PRK Firmware and R2P2
hayaokimura
1
400
PicoRuby で拓く電子工作の世界/The World of Electronics Projects Opened by PicoRuby
hayaokimura
2
1.6k
RISC-V CPU emulator made with Ruby
hayaokimura
2
120
Ruby で作る RISC-V CPU エミュレーター / RISC-V CPU emulator made with Ruby
hayaokimura
5
2.3k
Fiber Scheduler vs. General-Purpose Parallel Client
hayaokimura
1
1k
社内でGemを読む会をして捗っている/Progressing Well: A Gem Reading Session at Work
hayaokimura
1
96
freee請求書プロダクトにおけるFiber活用/Utilization of Fiber in the freee Invoice Product
hayaokimura
1
210
いいチームでいるためにやっていること/Things we are doing to remain a good team
hayaokimura
2
800
Featured
See All Featured
Building the Perfect Custom Keyboard
takai
2
910
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Thoughts on Productivity
jonyablonski
76
5.4k
The Invisible Side of Design
smashingmag
301
52k
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
BBQ
matthewcrist
90
10k
Building Adaptive Systems
keathley
44
3.3k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
490
Transcript
Raw HID とOLEDで広げる キーボードの可能性 hachi 2024/12/07
目次 • 大阪府交野市在住 Rubyist • freee のエンジニアです • Corne Cherry
V3 愛用 • Kyobashi.rb Cofounder • Kaigi on Rails Organizer • PicoRuby でたまによく遊びます hachi (@hachiblog)
目次 • 大阪府交野市在住 Rubyist • freee のエンジニアです • Corne Cherry
V3 愛用 • Kyobashi.rb Cofounder • Kaigi on Rails Organizer • PicoRuby でたまによく遊びます hachi (@hachiblog)
目次 • 大阪府交野市在住 Rubyist • freee のエンジニアです • Corne Cherry
V3 愛用 • Kyobashi.rb Cofounder • Kaigi on Rails Organizer • PicoRuby でたまによく遊びます hachi (@hachiblog)
目次 • 大阪府交野市在住 Rubyist • freee のエンジニアです • Corne Cherry
V3 愛用 • Kyobashi.rb Cofounder • Kaigi on Rails Organizer • PicoRuby でたまによく遊びます hachi (@hachiblog)
hasumi san ありがとうございます!
キーボードのOLED活用してますか?
外して使ってないです?
天気でキーボードの 色変えたい人もいましたね
Wifi を待たずとも OLED とか LED で遊びませんか
ある日……
仕事いそがしいなぁ
タスクが山積みだなぁ
完了したタスクが可視化されると モチベーションになっていいのでは?
ついでにミーティング5分前通知に 気づかない問題も解決したいな
せや!キーボードに実装したらいいんや!
でもどうやってキーボードに情報を送ろう 🤔
None
None
VIA の通信に使っている仕組みを利用したら キーボードに書き込みができそう
picoruby-prk-via を読む • どうやら USB.get_last_received_raw_hid_report という API を使って 情報を受け取っているらしい •
通信するときは Vendor ID と Product ID が必要らしい • hid report id というものがあって Raw HID は 5 らしい
Raw HID ってなんじゃ
Raw HID ってなに • HID: USBデバイスクラスの一つ。マウスとか、キーボードとかまさに HID ◦ 他には MSC(マスストレージクラス)とかがある
• Raw って? ◦ 多分初出は QMK firmware ? で、HIDでキーボードとホスト間の自由に使える通信
ということで実装じゃ!
概要 Markdown を用意 HID 送信プロセス 読み取り PRK Firmware 送信
ホスト側 • node-hid を使うと簡単にキーボードと hid で通信ができる ◦ (Ruby 使いたかったんだけど mac
だとうまく行かんかったので要研究) • HID で接続して、メッセージを送信する ◦ 簡単に書くと下記の様な感じ
キーボード側(PRK Firmware) • PRK Firmware にちょっと細工する ◦ Keyboard#start! method 内の
while ループの中で色々できるように after_input_proc メソッドを定 義し、keymap.rb からいじれるようにする ▪ こうしておくと開発が楽 ◦ @via&.task は使わないのでコメントアウト
キーボード側(rgb.rb) • Led もループ内で制御したいのでちょっと変更 ◦ on/off の状態を持つ offed インスタンス変数を外から使いたいので attr_reader
に追加 ◦ send_key method で 分割キーボードの partner に LED の点灯状態を伝えるために、 message_to_partner をローカル変数 → インスタンス変数に
キーボード側(keymap.rb)
完成!
None
まとめ • Raw HID を使うことで PC からキーボードにいろいろ送れる • OLED にいろいろ表示したり、LED
をいい感じにピカピカしたりしよう! ◦ (ちなみに時間のかかるタスクをやらせると動作が安定しなくなるので可能な限り処理を軽くすると いいです。あとメモリを使わないコードを心がけましょう) ▪ Pico の別コアとか使えたらいいのでは?とかちょっと考えたりしている • しばらく PC 繋いで展示するので見てくれると嬉しいです。今日の予定を入れてい るので講演5分前からピカピカします
おわり!