rabbit-slide-hasumikin-Euruko2023 2022.09.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +7 -0
  2. data/.rabbit +1 -0
  3. data/ABeginnersCompleteGuideToMicrocontrollerProgrammingWithRuby.rab +613 -0
  4. data/README.rd +24 -0
  5. data/Rakefile +17 -0
  6. data/config.yaml +24 -0
  7. data/images/QR_github-com-peripheral-interface-guide.png +0 -0
  8. data/images/QR_github-com-picoruby.png +0 -0
  9. data/images/R2D2_mosaic.png +0 -0
  10. data/images/assets/background-slide.png +0 -0
  11. data/images/assets/background-title.png +0 -0
  12. data/images/assets/bullet-point-24.png +0 -0
  13. data/images/assets/bullet-point-36.png +0 -0
  14. data/images/assets/bullet-point-48.png +0 -0
  15. data/images/assets/bullet-point.png +0 -0
  16. data/images/assets/community-1a0964e3.png +0 -0
  17. data/images/assets/logo-fc08516f.svg +14 -0
  18. data/images/assets/speakers-feb037e3.png +0 -0
  19. data/images/assets/sponsors-8011cff3.png +0 -0
  20. data/images/assets/tower-011484c8.png +0 -0
  21. data/images/assets/traveling-82513435.png +0 -0
  22. data/images/boot_button_1.png +0 -0
  23. data/images/crkbd_2.jpg +0 -0
  24. data/images/download-r2p2.png +0 -0
  25. data/images/drag-and-drop.png +0 -0
  26. data/images/hasumi.jpg +0 -0
  27. data/images/install-uf2.png +0 -0
  28. data/images/okinawa.jpg +0 -0
  29. data/images/rp2-resistor-led_bb.png +0 -0
  30. data/images/rp2-resistor-led_schem.png +0 -0
  31. data/images/rp2-resistor-thermistor_bb.png +0 -0
  32. data/images/rp2-resistor-thermistor_schem.png +0 -0
  33. data/images/rp2040-peripheral-demo_bb-trim.png +0 -0
  34. data/images/rpi_pico.jpg +0 -0
  35. data/images/teraterm-0.png +0 -0
  36. data/images/teraterm.png +0 -0
  37. data/pdf/Euruko2023-ABeginnersCompleteGuideToMicrocontrollerProgrammingWithRuby.rab.pdf +0 -0
  38. data/theme.rb +196 -0
  39. metadata +94 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2f29d48362b04d7c978efabf3b2760c24e3ac0288818f24674f0e3cb8e832962
4
+ data.tar.gz: 39da5117ca3149f8e2a0eb0cdd97b3d5b4e2a1ca43cd7375f65b4a155ff65760
5
+ SHA512:
6
+ metadata.gz: ca75b1e2fa1ea5de762128e20846883009ad45285f5b295662cabad41ecd2d8c15d90555bbd088c8b44f728e56dea70cccefe6ddfb2e1fb5b27c165eafdc5d9c
7
+ data.tar.gz: af8917f672b2b0bc5d3f494e59ecd8ef141cc39ce711cc7ddbf6380a6e782b7b227bedd76aa230bcc49faffbdc0564cb940c23ffd25236db7d73860504044965
data/.rabbit ADDED
@@ -0,0 +1 @@
1
+ ABeginnersCompleteGuideToMicrocontrollerProgrammingWithRuby.rab
@@ -0,0 +1,613 @@
1
+ = A Beginner's Complete Guide to Microcontroller Programming with Ruby
2
+
3
+ : author
4
+ hasumikin
5
+ : content-source
6
+ Euruko 2023
7
+ : place
8
+ Vilnius, Lithuania
9
+ : date
10
+ 21st - 23rd September 2023
11
+ : allotted-time
12
+ 35m
13
+ : theme
14
+ theme
15
+
16
+ = Today's content
17
+ (('tag:center'))
18
+ (('tag:x-small:Part 1'))\n
19
+ Preparation
20
+ \n\n
21
+ (('tag:x-small:Part 2'))\n
22
+ Getting Started with Microcontroller
23
+ \n\n
24
+ (('tag:x-small:Part 3'))\n
25
+ Exploring PicoRuby Further
26
+ \n\n
27
+ (('tag:x-small:Part 4'))\n
28
+ PicoRuby Under the Hood
29
+ == prop
30
+ : hide-title
31
+ true
32
+
33
+ = self.inspect
34
+
35
+ * Hitoshi HASUMI
36
+ * hasumikin (('tag:small:(GitHub ,ex-Twitter, Bluesky and Threads)'))
37
+ * Creator of PicoRuby and PRK Firmware
38
+ * Committer of CRuby's IRB and Reline
39
+ * First prize of Fukuoka Ruby Award\n(2020 and 2022✌️)
40
+ * A final nominee of Ruby Prize 2021
41
+
42
+ # image
43
+ # src = images/hasumi.jpg
44
+ # align = right
45
+ # relative-height = 95
46
+ # relative_margin_top = 50
47
+ # relative_margin_left = 25
48
+
49
+ = chapter
50
+ Part 1\n
51
+ (('tag:xx-large:Preparation'))
52
+ == prop
53
+ : hide-title
54
+ true
55
+
56
+ = Setup (minimal)
57
+ * Raspberry Pi Pico
58
+ * Or other ((*RP2040*))-based controller
59
+ * USB cable
60
+ * Terminal emulator on laptop
61
+
62
+ # image
63
+ # src = images/rpi_pico.jpg
64
+ # align = right
65
+ # relative-height = 95
66
+ # relative_margin_top = 0
67
+ # relative_margin_left = 0
68
+ # draw0 = [rectangle, false, 0.3, 0.41, 0.37, 0.2, {color: red, line_width: 8}]
69
+ # draw1 = [text, RP2040, 0.12, 0.61, {color: red, size: 70, font_family: 'Courier Prime', weight: bold}]
70
+
71
+ = Raspberry Pi Pico
72
+ * Raspberry Pi Pico: Microcontroller board
73
+ * MCU: RP2040
74
+ * Cortex-Mzero+ (dual)
75
+ * 264 KB RAM
76
+ * 2 MB flash ROM
77
+ * It generally runs without an OS (bere metal)
78
+ * ref) Raspberry Pi: Single-board computer
79
+ * It generally needs an OS like Raspberry Pi OS or Windows for Arm
80
+
81
+ = Terminal emulator
82
+ * Linux -> GTKTerm👍
83
+ * Windows -> Tera Term🙆
84
+ * macOS -> PuTTY (I'm not sure🤞)
85
+ * Traditional CUI/TUI tools may have CR/LF trouble
86
+ * cu
87
+ * screen
88
+ * minicom
89
+
90
+ = Let's begin 1/4
91
+ * Download the latest\n`R2P2-*.uf2`\nfrom GitHub
92
+
93
+ # image
94
+ # align = right
95
+ # src = images/download-r2p2.png
96
+ # relative-height = 90
97
+ # relative_margin_left = 20
98
+ # relative_margin_top = 0
99
+
100
+ (('tag:x-small'))\n\n\n\n
101
+ https://github.com/picoruby/R2P2/releases
102
+
103
+ = Let's begin 1/4
104
+ \n\n
105
+ BTW, R2P2 stands for
106
+ \n\n
107
+ (('tag:large:((*R*))uby on ((*R*))aspberry ((*P*))i ((*P*))ico'))
108
+
109
+ # image
110
+ # align = right
111
+ # src = images/R2D2_mosaic.png
112
+ # relative-height = 90
113
+ # relative_margin_left = 10
114
+ # relative_margin_top = 0
115
+
116
+ = Let's begin 2/4
117
+ * Connect Pi Pico and PC while\npressing the BOOTSEL button
118
+ * You'll find "RPI-RP2" drive in file manager
119
+
120
+ # image
121
+ # align = right
122
+ # src = images/boot_button_1.png
123
+ # relative-height = 80
124
+ # relative_margin_left = 20
125
+ # relative_margin_top = 0
126
+
127
+ (('tag:right'))
128
+ (('tag:xx-small'))\n\n\n\n\n\n\n\n\n
129
+ https://www.raspberrypi.org/documentation/rp2040/getting-started
130
+
131
+ = Let's begin 3/4
132
+
133
+ * Drag & drop `R2P2-*.uf2` into RPI-RP2 drive
134
+
135
+ # image
136
+ # align = bottom
137
+ # src = images/install-uf2.png
138
+ # relative-height = 90
139
+ # relative_margin_left = 0
140
+ # relative_margin_top = 1
141
+
142
+ = Let's begin 4/4
143
+ * Open a proper\nserial port on\nterminal emulator
144
+
145
+ # image
146
+ # align = right
147
+ # src = images/teraterm-0.png
148
+ # relative-height = 90
149
+ # relative_margin_left = 22
150
+ # relative_margin_top = 0
151
+
152
+ = R2P2 Shell should start [Demo]
153
+ * Unix-like shell running on Raspberry Pi Pico
154
+ * You can use some\ncommands like `cd`,\n`ls`, `mkdir`, and `((*irb*))`
155
+
156
+ # image
157
+ # align = right
158
+ # src = images/teraterm.png
159
+ # relative-height = 75
160
+ # relative_margin_left = 28
161
+ # relative_margin_top = 5
162
+
163
+ = PicoIRB [Demo]
164
+ * PicoRuby's IRB is running within the R2P2 shell on Raspberry Pi Pico
165
+ * Your Ruby snippet is compiled into mruby VM code and executed ((*on the fly*))
166
+ * It means PicoRuby contains an mruby compiler which can run on a one-chip microcontroller (will be mentioned later)
167
+
168
+ = chapter
169
+ Part 2\n
170
+ (('tag:xx-large:Getting Started with Microcontroller'))
171
+ == prop
172
+ : hide-title
173
+ true
174
+
175
+ = GPIO (General Purpose Input/Output)
176
+ * Fundamental digital I/O
177
+ * Variety of uses:
178
+ * Input: Detects on-off state of switch and button
179
+ * Output: Makes a voltage
180
+ * You can even implement a communication protocol by controlling GPIO in milli/micro sec
181
+
182
+ = GPIO --- Blinking LED [Demo]
183
+ irb> led = GPIO.new(25, GPIO::OUT)
184
+ irb> 5.times do
185
+ irb* led.write 1
186
+ irb* sleep 1
187
+ irb* led.write 0
188
+ irb* sleep 1
189
+ irb* end
190
+
191
+ (('tag:small'))
192
+ (('tag:center'))
193
+ GPIO25 internally connects to on-board LED through a resistor
194
+
195
+ = GPIO --- Blinking LED by discrete parts
196
+ * Parts list:
197
+ * LED (RED)
198
+ * Resistor (1kΩ)
199
+
200
+ # image
201
+ # align = right
202
+ # src = images/rp2-resistor-led_bb.png
203
+ # relative-height = 90
204
+ # relative_margin_left = 10
205
+ # relative_margin_top = 0
206
+
207
+ = GPIO --- Blinking LED by discrete parts
208
+ irb> pin = GPIO.new(15, GPIO::OUT)
209
+
210
+ # image
211
+ # align = bottom
212
+ # src = images/rp2-resistor-led_bb.png
213
+ # relative-height = 100
214
+ # relative_margin_left = 0
215
+ # relative_margin_top = 0
216
+
217
+ = GPIO --- Blinking LED by discrete parts
218
+ GPIO15 ===> 1kΩ ===> LED ===> GND
219
+ <----- 1.5V -----><--- 1.8V ---->
220
+ <------------ 3.3V ------------->
221
+ * RP2040's logic level: 3.3V
222
+ * LED voltage drop: ((*1.8V*))\n(according to LED's datasheet)
223
+ * Current: (3.3V - 1.8V) / 1kΩ = ((*1.5mA*))\n(calculated by Ohm's Law)
224
+
225
+ # image
226
+ # align = right
227
+ # src = images/rp2-resistor-led_schem.png
228
+ # relative-height = 100
229
+ # relative_margin_left = 5
230
+ # relative_margin_top = 0
231
+
232
+ = 🏫Study time: Physics
233
+ * Ohm's Law
234
+ * V = I * R ⇔ I = V / R ⇔ R = V / I
235
+ * Kirchhoff's Circuit Laws
236
+ * Current law: The algebraic sum of currents in a network of conductors meeting at a point is zero
237
+ * Voltage law: The directed sum of the potential differences (voltages) around any closed loop is zero
238
+
239
+ = ADC (Analog to Digital Converter)
240
+ * ADC handles values in-between by converting an analog voltage to a digital value
241
+ * e.g. RP2040's ADC has ((*12 bits*)) depth and accordingly takes a raw value from ((*0 (0 V)*)) to ((*4095 (3.3 V)*))
242
+ * Typical usage:
243
+ * Temperature sensor
244
+ * Joystick
245
+
246
+ = ADC --- Temperature [Demo]
247
+ irb> require 'adc'
248
+ irb> adc = ADC.new(:temperature)
249
+ irb> adc.read_raw
250
+ irb> while true
251
+ irb* voltage = adc.read_voltage
252
+ irb* puts 27 - (voltage - 0.706) / 0.001721
253
+ irb* sleep 1
254
+ irb* end
255
+
256
+ (('tag:center'))
257
+ RP2040 has an in-chip temperature sensor that connects to an ADC channel
258
+
259
+ = ADC --- Temperature by discrete parts
260
+ * Parts list:
261
+ * Resistor
262
+ * Rref: 10kΩ
263
+ * Thermistor
264
+ * 10kΩ (at 25℃ = 298.15K)
265
+ * B const: 3950
266
+ * T0: 298.15 (kelvin)
267
+
268
+ # image
269
+ # align = right
270
+ # src = images/rp2-resistor-thermistor_bb.png
271
+ # relative-height = 90
272
+ # relative_margin_left = 13
273
+ # relative_margin_top = 0
274
+
275
+ = ADC --- Temperature by discrete parts
276
+ * Parts list:
277
+ * Resistor
278
+ * Rref: 10kΩ
279
+ * Thermistor
280
+ * 10kΩ (at 25℃ = 298.15K)
281
+ * B const: 3950
282
+ * T0: 298.15 (kelvin)
283
+
284
+ # image
285
+ # align = right
286
+ # src = images/rp2-resistor-thermistor_schem.png
287
+ # relative-height = 90
288
+ # relative_margin_left = -10
289
+ # relative_margin_top = 0
290
+
291
+ = ADC --- Temperature by discrete parts
292
+ irb> require 'adc'
293
+ irb> Rref = 10000.0
294
+ irb> B = 3950.0
295
+ irb> T0 = 298.15
296
+ irb> def kelvin_temp(rth)
297
+ irb* temp_inverse = 1 / B * Math.log(rth / Rref) + (1 / T0)
298
+ irb* 1 / temp_inverse
299
+ irb* end
300
+ irb> rth = (3.3 / adc.read_voltage - 1) * Rref
301
+ irb> puts "#{kelvin_temp(rth) - 273.15} C"
302
+ => 28.1234 C
303
+
304
+ = chapter
305
+ Part 3\n
306
+ (('tag:xx-large:Exploring PicoRuby Further'))
307
+ == prop
308
+ : hide-title
309
+ true
310
+
311
+ = PicoRuby applications
312
+ * R2P2
313
+ * Unix-like shell system written in PicoRuby
314
+ * You may want to say an Operating System in Ruby
315
+ * PRK Firmware
316
+ * Keyboard firmware framework for DIY keyboard
317
+ * You can write your keymap and keyboard's behavior with Ruby
318
+
319
+ = R2P2 (again)
320
+ * IRB
321
+ * Multiple-line editor
322
+ * Built-in commands and executables (all written in Ruby)
323
+ * You can write your own external command
324
+
325
+ = Executables in R2P2
326
+ # enscript ruby
327
+ # date
328
+ puts Time.now.to_s
329
+
330
+ # mkdir
331
+ Dir.mkdir(ARGV[0])
332
+
333
+ = Write a Ruby script file [Demo]
334
+ # enscript sh
335
+ $> vim hello.rb
336
+
337
+ (('tag:center'))Edit the file and save it.
338
+
339
+ # enscript ruby
340
+ puts "Hello World!"
341
+
342
+ (('tag:center'))Then run it.
343
+
344
+ # enscript sh
345
+ $> ./hello.rb
346
+
347
+ = Or just drag and drop [Demo]
348
+
349
+ # image
350
+ # align = bottom
351
+ # src = images/drag-and-drop.png
352
+ # relative-height = 90
353
+ # relative_margin_left = 0
354
+ # relative_margin_top = 3
355
+
356
+ = GPIO and ADC work together [Demo]
357
+ # enscript ruby
358
+ require 'adc'
359
+ def calc_temp(volt)
360
+ 27 - (volt - 0.706) / 0.001721
361
+ end
362
+ adc = ADC.new(:temperature)
363
+ led = GPIO.new(25, GPIO::OUT)
364
+ while true
365
+ temp = calc_temp(adc.read_voltage)
366
+ puts "temp: #{temp} C"
367
+ led.write(30 < temp ? 1 : 0)
368
+ sleep 1
369
+ end
370
+
371
+ = R2P2 [Demo]
372
+ * `/home/app.rb` automatically runs on start up
373
+
374
+ # enscript ruby
375
+ # You can stop by Ctrl-C
376
+ led = GPIO.new(25, GPIO::OUT)
377
+ while true
378
+ led.write 1
379
+ puts "Hello World!"
380
+ sleep 1
381
+ led.write 0
382
+ sleep 1
383
+ end
384
+
385
+ = Serial communication protocols
386
+ * SPI: High speed, full duplex. e.g. Acceleration sensor, Color display, etc.
387
+ * I2C: Low speed, Addressing network with fewer wires. e.g. RTC, Temperature sensor and Charactor display, etc.
388
+ * UART: Buffered asyncronous communication. e.g. Terminal emulator, Wireless module like BLE and LTE/5G, etc.
389
+
390
+ = I2C and UART
391
+ * Parts list:
392
+ * PCF8523 RTC module
393
+ * FTDI USB to TTL Serial\nAdapter Cable (3.3V)
394
+
395
+ # image
396
+ # align = right
397
+ # src = images/rp2040-peripheral-demo_bb-trim.png
398
+ # relative-height = 90
399
+ # relative_margin_left = 30
400
+ # relative_margin_top = 0
401
+
402
+ = I2C and UART
403
+ * github.com/picoruby/rp2040-peripheral-demo
404
+ * Example of I2C (RTC)\nand UART (USB serial)
405
+ * Watch the demo video\nin README.md
406
+ * Also an example of\nhow to build your own app
407
+
408
+ # image
409
+ # align = right
410
+ # src = images/rp2040-peripheral-demo_bb-trim.png
411
+ # relative-height = 80
412
+ # relative_margin_left = 30
413
+ # relative_margin_top = 5
414
+
415
+ = PRK Firmware - Corne (CRKBD)
416
+ # image
417
+ # src = images/crkbd_2.jpg
418
+ # relative_height = 95
419
+
420
+ = PRK Firmware - Meishi2
421
+ # enscript ruby
422
+ require "consumer_key"
423
+ kbd = Keyboard.new
424
+ kbd.init_pins(
425
+ [ 6, 7 ], # row0, row1
426
+ [ 28, 27 ] # col0, col1
427
+ )
428
+ kbd.add_layer :default, %i[ RAISE KC_2 KC_A KC_4 ]
429
+ kbd.add_layer :raise, %i[ RAISE
430
+ KC_AUDIO_VOL_UP
431
+ KC_AUDIO_VOL_DOWN
432
+ KC_AUDIO_MUTE ]
433
+ kbd.define_mode_key :RAISE, [ :KC_SPACE, :raise, 200, 200 ]
434
+ kbd.start!
435
+
436
+ = chapter
437
+ Part 4\n
438
+ (('tag:xx-large:PicoRuby Under the Hood'))
439
+ == prop
440
+ : hide-title
441
+ true
442
+
443
+ = mruby and PicoRuby
444
+ * mruby
445
+ * General purpose embedded Ruby implementation written by Matz
446
+ * PicoRuby
447
+ * Another implementation of murby targeting on one-chip microcontroller (((*smaller foot print*)))
448
+ * Based on the mruby's VM code standard
449
+
450
+ = Small foot print
451
+
452
+ # enscript sh
453
+ $ valgrind \
454
+ --tool=massif \
455
+ --stacks=yes \
456
+ path/to/(mruby|picoruby) \
457
+ -e 'puts "Hello World!"'
458
+
459
+ (('tag:center'))`massif.out.[pid]` file will be created. Then,
460
+
461
+ $ ms_print massif.out.1234 | less
462
+
463
+ = Small foot print
464
+
465
+ --------------------------------------------------------------------------------
466
+ Command: mruby -e 'puts "Hello World!"'
467
+ Massif arguments: --stacks=yes
468
+ ms_print arguments: massif.out.18391
469
+ --------------------------------------------------------------------------------
470
+ KB
471
+ 168.3^ #
472
+ | #
473
+ | #
474
+ | #
475
+ | #
476
+ | #
477
+ | #
478
+ | :@@:::@:@#
479
+ | @:@@@:::::@ :: @:@#
480
+ | @@@::@:@@ ::: :@ :: @:@#
481
+ | ::::::::::@@:@@ : @:@@ ::: :@ :: @:@#
482
+ | @:::::@::@@:: : :: :::@ :@@ : @:@@ ::: :@ :: @:@#
483
+ | @:::@::@:: : @: @ :: : :: :::@ :@@ : @:@@ ::: :@ :: @:@#
484
+ | @:::::::@@: :@: @:: : @: @ :: : :: :::@ :@@ : @:@@ ::: :@ :: @:@#
485
+ | @:: :: :@@: :@: @:: : @: @ :: : :: :::@ :@@ : @:@@ ::: :@ :: @:@#
486
+ | @:: :: :@@: :@: @:: : @: @ :: : :: :::@ :@@ : @:@@ ::: :@ :: @:@#
487
+ | @:: :: :@@: :@: @:: : @: @ :: : :: :::@ :@@ : @:@@ ::: :@ :: @:@#
488
+ | @:: :: :@@: :@: @:: : @: @ :: : :: :::@ :@@ : @:@@ ::: :@ :: @:@#
489
+ | @:: :: :@@: :@: @:: : @: @ :: : :: :::@ :@@ : @:@@ ::: :@ :: @:@#
490
+ | @:: :: :@@: :@: @:: : @: @ :: : :: :::@ :@@ : @:@@ ::: :@ :: @:@#
491
+ 0 +----------------------------------------------------------------------->Mi
492
+ 0 3.663
493
+ # Note: Measured in 64 bit Ubuntu
494
+
495
+ = Small foot print
496
+
497
+ --------------------------------------------------------------------------------
498
+ Command: picoruby -e 'puts "Hello World!"'
499
+ Massif arguments: --stacks=yes
500
+ ms_print arguments: massif.out.21752
501
+ --------------------------------------------------------------------------------
502
+ KB
503
+ 9.820^ #
504
+ | @:#:::
505
+ | @:#:::::
506
+ | @:#:::::
507
+ | @:#:::::
508
+ | @ @:#:::::
509
+ | @ @:#:::::
510
+ | @ : @:#:::::
511
+ | @ ::: @:#:::::
512
+ | @ : ::: @:#:::::
513
+ | @ ::@::::@:#:::::@
514
+ | @ ::@::::@:#:::::@
515
+ | @: :::::@::::@:#:::::@
516
+ | @::: :: :::@::::@:#:::::@
517
+ | @:: ::: :::@::::@:#:::::@
518
+ | @:: : ::: :::@::::@:#:::::@
519
+ | @:: : ::: :::@::::@:#:::::@
520
+ | :@:: : : :: :@:@: : :@@: ::@::::: ::: :::@::::@:#:::::@
521
+ | :@:: :::::::::::::::@:@:@:::::@ ::: @:: : :::: :::@::::@:#:::::@
522
+ |::::::@::@:: ::: ::: :::::@:@:@:: ::@ : : @:: : :::: :::@::::@:#:::::@
523
+ 0 +----------------------------------------------------------------------->ki
524
+ 0 324.5
525
+ # Note: Measured in 64 bit Ubuntu
526
+
527
+ = Small foot print
528
+ * RAM consumption of `puts "Hello World!"`
529
+ * mruby: 168.3 KB (on 64 bit)
530
+ * PicoRuby: 9.82 KB (on 64 bit)
531
+ * RP2040 (32 bit) has 264 KB RAM
532
+ * Only small applications written in mruby should work
533
+ * R2P2 and PRK Firmware should be written in PicoRuby
534
+
535
+ = PicoRuby ecosystem
536
+ * Picogems
537
+ * PRK Firmware is also a Picogem
538
+ * Peripheral gems
539
+ * picoruby-gpio
540
+ * picoruby-adc
541
+ * picoruby-i2c
542
+ * picoruby-spi
543
+ * picoruby-uart
544
+ * Peripheral interface guide
545
+ * https://github.com/mruby/microcontroller-peripheral-interface-guide
546
+
547
+ # image
548
+ # src = images/QR_github-com-peripheral-interface-guide.png
549
+ # align = right
550
+ # relative-height = 70
551
+ # relative_margin_top = 0
552
+ # relative_margin_left = 18
553
+
554
+ = PicoRuby ecosystem
555
+ * Build system forked from mruby
556
+ * You can build your application in a similar way to mruby
557
+ * You can also write your gem and host it on your GitHub
558
+ * RP2040 is the only target as of now though,
559
+ * Carefully designed to keep portability
560
+
561
+ = Restriction of PicoRuby
562
+ * Minimum built-in classes and methods
563
+ * Doesn't support
564
+ * Some syntax like heredoc and numbered parameters
565
+ * Module due to VM implementation
566
+ * No strict distinction between instance methods and singleton methods
567
+ * Some bugs (because I'm lazy🥺).\nSee github.com/picoruby/picoruby/issues
568
+
569
+ = Conclusion
570
+ * PicoRuby is a Ruby implementaiton targeting on one-chip microcontroller
571
+ * You can develop your microcontroller application step by step using the R2P2 and IRB
572
+ * You need only R2P2 to run small applications
573
+ * Future work
574
+ * BLE and WiFi with Raspberry Pi Pico ((*W*)) (soon)
575
+ * Porting to microcontrollers other than RP2040 (someday)
576
+
577
+ = RubyKaigi 2024 [AD]
578
+ # image
579
+ # src = images/okinawa.jpg
580
+ # align = center
581
+ # relative-height = 140
582
+ # relative_margin_top = -10
583
+ # relative_margin_left = 0
584
+ # draw1 = [text, RubyKaigi 2024, 0.10, 0.15, {color: white, size: 100, font_family: 'Montserrat', weight: bold}]
585
+ # draw2 = [text, "[ad]", 0.60, 0.21, {color: white, size: 30, font_family: 'Montserrat', weight: normal}]
586
+ # draw3 = [text, "In Okinawa🏝️ May 15th - 17th ", 0.10, 0.26, {color: white, size: 60, font_family: 'Montserrat', weight: normal}]
587
+ # draw4 = [text, "1000+ attendees, tons of tech talks", 0.10, 0.33, {color: white, size: 60, font_family: 'Montserrat', weight: normal}]
588
+ # draw5 = [text, "and various parties🍻", 0.10, 0.40, {color: white, size: 60, font_family: 'Montserrat', weight: normal}]
589
+ # draw6 = [text, https://098free.com/photos/14262/, 0.68, 0.78, {color: white, size: 22, font_family: 'Montserrat', weight: normal}]
590
+
591
+ == prop
592
+ : hide-title
593
+ true
594
+
595
+ = That's all! Visit repos and stargaze🌟
596
+
597
+ (('tag:small'))
598
+ \n\n
599
+ github.com/picoruby/picoruby
600
+ \n\n
601
+ github.com/picoruby/R2P2
602
+ \n\n
603
+ github.com/picoruby/prk_firmware
604
+ \n\n
605
+ github.com/picoruby/rp2040-peripheral-demo
606
+
607
+ # image
608
+ # src = images/QR_github-com-picoruby.png
609
+ # align = right
610
+ # relative-height = 65
611
+ # relative_margin_top = -10
612
+ # relative_margin_left = 18
613
+
data/README.rd ADDED
@@ -0,0 +1,24 @@
1
+ = A Beginner's Complete Guide to Microcontroller Programming with Ruby
2
+
3
+ Presentation slide for Euruko 2023
4
+
5
+ == For author
6
+
7
+ === Show
8
+
9
+ rake
10
+
11
+ === Publish
12
+
13
+ rake publish
14
+
15
+ == For viewers
16
+
17
+ === Install
18
+
19
+ gem install rabbit-slide-hasumikin-Euruko2023
20
+
21
+ === Show
22
+
23
+ rabbit rabbit-slide-hasumikin-Euruko2023.gem
24
+
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ require "rabbit/task/slide"
2
+
3
+ # Edit ./config.yaml to customize meta data
4
+
5
+ spec = nil
6
+ Rabbit::Task::Slide.new do |task|
7
+ spec = task.spec
8
+ # spec.files += Dir.glob("doc/**/*.*")
9
+ # spec.files -= Dir.glob("private/**/*.*")
10
+ # spec.add_runtime_dependency("rabbit-theme-YOUR-THEME")
11
+ end
12
+
13
+ desc "Tag #{spec.version}"
14
+ task :tag do
15
+ sh("git", "tag", "-a", spec.version.to_s, "-m", "Publish #{spec.version}")
16
+ sh("git", "push", "--tags")
17
+ end
data/config.yaml ADDED
@@ -0,0 +1,24 @@
1
+ ---
2
+ id: Euruko2023
3
+ base_name: ABeginnersCompleteGuideToMicrocontrollerProgrammingWithRuby.rab
4
+ tags:
5
+ - PicoRuby
6
+ - Microcontroller
7
+ - RP2040
8
+ presentation_date: '2023-09-21'
9
+ presentation_start_time:
10
+ presentation_end_time:
11
+ version: 2022.09.21.0
12
+ licenses: ["MIT License"]
13
+ slideshare_id:
14
+ speaker_deck_id:
15
+ ustream_id:
16
+ vimeo_id:
17
+ youtube_id:
18
+ author:
19
+ markup_language: :rd
20
+ name: HASUMI Hitoshi
21
+ email: hasumikin@gmail.com
22
+ rubygems_user: hasumikin
23
+ slideshare_user:
24
+ speaker_deck_user:
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,14 @@
1
+ <svg width="215" height="40" viewBox="0 0 215 40" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M28.4249 8.01146V2.55532H0.130249V36.3544H28.4249V30.8983H6.74521V22.0139H26.8798V17.6201H6.74521V8.01146H28.4249Z" fill="#0499da"/>
3
+ <path d="M54.5852 2.55532V25.1524C54.5852 29.836 51.5916 32.8296 46.9563 32.8296C42.2727 32.8296 38.7962 30.5603 38.7962 25.1524V2.55532H31.6019V24.1867C31.6019 30.8017 35.1749 37.0787 46.7149 37.0787C57.9169 37.0787 61.7796 30.4637 61.7796 24.1867V2.55532H54.5852Z" fill="#0499da"/>
4
+ <path d="M67.6699 36.3544H74.2849V22.9796H91.4259L86.6457 36.451H100.696V30.9466H95.2403C96.2543 24.7661 97.22 20.6137 92.7295 20.324V18.7306C97.1234 18.0546 100.358 15.5438 100.358 10.812C100.358 4.43841 94.5161 2.6036 87.8528 2.6036H67.6699V36.3544ZM74.2849 7.96318H87.8045C90.9913 7.96318 93.7918 9.55656 93.7918 12.9365C93.7918 16.2198 90.9913 17.958 87.708 17.9098L74.2849 17.8132V7.96318Z" fill="#0499da"/>
5
+ <path d="M126.369 2.55532V25.1524C126.369 29.836 123.375 32.8296 118.74 32.8296C114.056 32.8296 110.58 30.5603 110.58 25.1524V2.55532H103.385V24.1867C103.385 30.8017 106.958 37.0787 118.498 37.0787C129.7 37.0787 133.563 30.4637 133.563 24.1867V2.55532H126.369Z" fill="#0499da"/>
6
+ <path d="M166.879 20.7103C165.961 19.31 162.823 18.4892 159.298 18.4892C157.608 18.4892 155.822 18.6823 154.132 19.1169C152.732 19.5031 150.752 20.2757 149.593 20.6137L149.641 19.0686C153.456 18.296 158.043 16.9924 160.505 14.0953L172.721 2.55532H164.61L148.434 17.3304H146.068V2.55532H139.453V36.3544H146.068V22.9796H163.209L158.429 36.451H172.48V30.9466H167.024C167.893 25.249 169.1 21.8208 166.879 20.7103Z" fill="#0499da"/>
7
+ <path d="M201.841 27.4625C197.301 32.0023 192.38 35.2668 188.11 36.8869C183.793 38.5252 180.346 38.4165 178.512 36.5829C176.678 34.7492 176.57 31.3022 178.208 26.9844C179.828 22.7148 183.092 17.7933 187.632 13.2534C192.172 8.71347 197.094 5.44898 201.363 3.82893C205.681 2.19061 209.128 2.29929 210.962 4.13294C212.795 5.9666 212.904 9.41366 211.266 13.7314C209.646 18.001 206.381 22.9226 201.841 27.4625Z" stroke="#0499da"/>
8
+ <mask id="mask0_200_117" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="169" y="-1" width="44" height="40">
9
+ <path d="M202.196 27.8157C193.04 36.9718 181.948 40.7247 177.421 36.1981C172.895 31.6715 163.916 14.6875 173.072 5.53142C182.228 -3.62465 206.052 -1.48558 210.578 3.04103C215.105 7.56764 211.352 18.6596 202.196 27.8157Z" fill="#FF6161"/>
10
+ </mask>
11
+ <g mask="url(#mask0_200_117)">
12
+ <path d="M192.776 1.64502C181.381 1.64502 172.4 9.41881 172.4 19.3171C172.4 29.4086 181.14 36.9409 192.776 36.9409C204.461 36.9409 213.201 29.4086 213.201 19.3171C213.152 9.17739 204.461 1.64502 192.776 1.64502ZM192.776 31.8228C185.63 31.8228 179.884 27.3806 179.884 19.5103C179.884 11.7365 185.63 6.90802 193.066 7.00459C200.743 7.10116 205.861 11.6399 205.861 19.5103C205.861 27.284 200.019 31.8228 192.776 31.8228Z" fill="#0499da"/>
13
+ </g>
14
+ </svg>
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
data/images/hasumi.jpg ADDED
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
data/theme.rb ADDED
@@ -0,0 +1,196 @@
1
+ # puts font_families.sort
2
+ @xxx_large_font_size = screen_size(9 * Pango::SCALE)
3
+ @xx_large_font_size = screen_size(8 * Pango::SCALE)
4
+ @x_large_font_size = screen_size(7 * Pango::SCALE)
5
+ @large_font_size = screen_size(6 * Pango::SCALE)
6
+ @normal_font_size = screen_size(5 * Pango::SCALE)
7
+ @small_font_size = screen_size(4 * Pango::SCALE)
8
+ @x_small_font_size = screen_size(3 * Pango::SCALE)
9
+ @xx_small_font_size = screen_size(2.5 * Pango::SCALE)
10
+
11
+ @font_family = find_font_family('Syne')
12
+ @monospace_font_family = 'Courier Prime'
13
+ @title_font_family = find_font_family('Syne')
14
+
15
+ # colors
16
+ foreground = "#111111"
17
+ red = "#ff74bd"
18
+ green = "#2bba7e"
19
+ blue = "#0499da"
20
+ black = "#000000"
21
+ dark_gray = "#333333"
22
+ light_gray = "#a9a7ad"
23
+ preformatted_foreground = "#00ffc2"
24
+
25
+ @default_headline_line_color = light_gray
26
+ @default_headline_line_width = 2
27
+ @default_headline_line_expand = true
28
+
29
+ @default_emphasis_color = red
30
+ @default_emphasis_level2_color = "#ffffff"
31
+
32
+ set_graffiti_color red
33
+ set_graffiti_line_width 5
34
+
35
+ #@table_frame_color = "#ffffff"
36
+ #@table_fill_color = "#0f0428"
37
+ #@table_body_frame_color = "#ffffff"
38
+ #@table_body_fill_color = "#3f3468"
39
+ #@table_head_frame_color = "#ffffff"
40
+ #@table_head_fill_color = "#rf0428"
41
+
42
+ @preformatted_fill_color = black
43
+ @preformatted_frame_color = red
44
+ @preformatted_frame_width = 5
45
+ # @preformatted_centering = true
46
+
47
+ @space = screen_y(1)
48
+
49
+ @image_slide_number_start_flag_color = green
50
+ @image_slide_number_goal_flag_color = red
51
+
52
+ #@slide_headline_hide = true
53
+
54
+ @slide_background_image = 'images/assets/background-slide.png'
55
+ include_theme("slide-background-image")
56
+
57
+ @title_slide_background_image = 'images/assets/background-title.png'
58
+ include_theme("title-slide-background-image")
59
+
60
+ include_theme('default')
61
+
62
+ match(Slide, HeadLine) do |heads|
63
+ heads.margin_top = 20
64
+ heads.prop_set("weight", "normal")
65
+ heads.prop_set "size", @large_font_size
66
+ set_font_family(heads)
67
+ end
68
+ match(Slide) do |slides|
69
+ slides.margin_left = 100
70
+ slides.margin_right = 100
71
+ slides.prop_set("foreground", foreground)
72
+ end
73
+
74
+ match TitleSlide do |slides|
75
+ # slides.margin_left = 770
76
+ slides.prop_set("foreground", foreground)
77
+ slides.prop_set "style", "normal"
78
+ end
79
+ match TitleSlide, Title do |title|
80
+ title.margin_top = 10
81
+ title.prop_set "size", @xxx_large_font_size
82
+ title.prop_set "font-family", @title_font_family
83
+ title.prop_set "weight", "bold"
84
+ end
85
+ match TitleSlide, Subtitle do |subtitle|
86
+ subtitle.prop_set "size", @xxx_large_font_size
87
+ subtitle.prop_set "font-family", @title_font_family
88
+ subtitle.prop_set "weight", "bold"
89
+ end
90
+ match TitleSlide, Author do |authors|
91
+ authors.margin_top = 50
92
+ authors.prop_set "size", @large_font_size
93
+ end
94
+ match TitleSlide, ContentSource do |cs|
95
+ cs.margin_top = 10
96
+ cs.prop_set "size", @small_font_size
97
+ cs.prop_set "weight", "bold"
98
+ cs.prop_set "foreground", red
99
+ end
100
+ match TitleSlide, Place do |cs|
101
+ cs.margin_top = 20
102
+ cs.prop_set "size", @x_small_font_size
103
+ end
104
+ match TitleSlide, Date do |date|
105
+ date.prop_set "size", @x_small_font_size
106
+ end
107
+ match TitleSlide, Institution do |i|
108
+ i.prop_set "size", @x_small_font_size
109
+ end
110
+
111
+ #@slide_logo_image = 'images/mark_g.png'
112
+ #include_theme('slide-logo')
113
+
114
+ @item_image_1 = 'images/assets/bullet-point-36.png'
115
+ @item_image_2 = 'images/assets/bullet-point-36.png'
116
+ @item_image_3 = 'images/assets/bullet-point-24.png'
117
+
118
+ include_theme("default-item-mark")
119
+
120
+ add_image_path("rabbit-images")
121
+
122
+ slide_body = [Slide, Body]
123
+ item_list_item = [ItemList, ItemListItem]
124
+
125
+ indent = 50
126
+
127
+ match(*(slide_body + (item_list_item * 1))) do |items|
128
+ name = "item1"
129
+ items.delete_pre_draw_proc_by_name(name)
130
+ items.delete_post_draw_proc_by_name(name)
131
+ draw_image_mark(items, @item_image_1, name, indent: indent)
132
+ end
133
+
134
+ match(*(slide_body + (item_list_item * 2))) do |items|
135
+ name = "item2"
136
+ items.delete_pre_draw_proc_by_name(name)
137
+ items.delete_post_draw_proc_by_name(name)
138
+ draw_image_mark(items, @item_image_2, name, indent: indent)
139
+ end
140
+
141
+ match(*(slide_body + (item_list_item * 3))) do |items|
142
+ name = "item3"
143
+ items.delete_pre_draw_proc_by_name(name)
144
+ items.delete_post_draw_proc_by_name(name)
145
+ draw_image_mark(items, @item_image_3, name, indent: indent)
146
+ end
147
+
148
+ enum_list_item = [EnumList, EnumListItem]
149
+
150
+ match(*(slide_body + enum_list_item + item_list_item)) do |items|
151
+ name = "enum-item1"
152
+ items.delete_pre_draw_proc_by_name(name)
153
+ items.delete_post_draw_proc_by_name(name)
154
+ draw_image_mark(items, @item_image_1, name, indent: indent)
155
+ end
156
+
157
+ match(*(slide_body + enum_list_item + (item_list_item * 2))) do |items|
158
+ name = "enum-item2"
159
+ items.delete_pre_draw_proc_by_name(name)
160
+ items.delete_post_draw_proc_by_name(name)
161
+ draw_image_mark(items, @item_image_2, name, indent: indent)
162
+ end
163
+
164
+ # table
165
+ all_table = ["**", Table]
166
+ match(*(all_table + [TableBody, TableRow, TableCell])) do |cells|
167
+ set_font_family(cells, @monospace_font_family)
168
+ end
169
+ match(*(all_table + [TableHead, TableRow, TableHeader])) do |headers|
170
+ set_font_family(headers, @monospace_font_family)
171
+ end
172
+
173
+ match("**", Emphasis) do |texts|
174
+ texts.prop_set("foreground", "#ff0000")
175
+ texts.prop_set("weight", "normal")
176
+ end
177
+
178
+ # Chapter
179
+ match Slide do |slides|
180
+ slides.each do |slide|
181
+ if slide.match?(/sub_chapter/)
182
+ slide.horizontal_centering = true
183
+ elsif slide.match?(/chapter/)
184
+ set_font_family slide, @title_font_family
185
+ slide.horizontal_centering = true
186
+ elsif slide.match?(/cite/)
187
+ slide.prop_set "foreground", foreground
188
+ slide.horizontal_centering = true
189
+ end
190
+ end
191
+ end
192
+
193
+ match("**", PreformattedBlock) do |block|
194
+ block.prop_set("foreground", preformatted_foreground)
195
+ # block.prop_set("fill", dark_gray)
196
+ end
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rabbit-slide-hasumikin-Euruko2023
3
+ version: !ruby/object:Gem::Version
4
+ version: 2022.09.21.0
5
+ platform: ruby
6
+ authors:
7
+ - HASUMI Hitoshi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-10-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rabbit
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 2.0.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 2.0.2
27
+ description: Presentation slide for Euruko 2023
28
+ email:
29
+ - hasumikin@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".rabbit"
35
+ - ABeginnersCompleteGuideToMicrocontrollerProgrammingWithRuby.rab
36
+ - README.rd
37
+ - Rakefile
38
+ - config.yaml
39
+ - images/QR_github-com-peripheral-interface-guide.png
40
+ - images/QR_github-com-picoruby.png
41
+ - images/R2D2_mosaic.png
42
+ - images/assets/background-slide.png
43
+ - images/assets/background-title.png
44
+ - images/assets/bullet-point-24.png
45
+ - images/assets/bullet-point-36.png
46
+ - images/assets/bullet-point-48.png
47
+ - images/assets/bullet-point.png
48
+ - images/assets/community-1a0964e3.png
49
+ - images/assets/logo-fc08516f.svg
50
+ - images/assets/speakers-feb037e3.png
51
+ - images/assets/sponsors-8011cff3.png
52
+ - images/assets/tower-011484c8.png
53
+ - images/assets/traveling-82513435.png
54
+ - images/boot_button_1.png
55
+ - images/crkbd_2.jpg
56
+ - images/download-r2p2.png
57
+ - images/drag-and-drop.png
58
+ - images/hasumi.jpg
59
+ - images/install-uf2.png
60
+ - images/okinawa.jpg
61
+ - images/rp2-resistor-led_bb.png
62
+ - images/rp2-resistor-led_schem.png
63
+ - images/rp2-resistor-thermistor_bb.png
64
+ - images/rp2-resistor-thermistor_schem.png
65
+ - images/rp2040-peripheral-demo_bb-trim.png
66
+ - images/rpi_pico.jpg
67
+ - images/teraterm-0.png
68
+ - images/teraterm.png
69
+ - pdf/Euruko2023-ABeginnersCompleteGuideToMicrocontrollerProgrammingWithRuby.rab.pdf
70
+ - theme.rb
71
+ homepage: https://slide.rabbit-shocker.org/authors/hasumikin/Euruko2023/
72
+ licenses:
73
+ - MIT License
74
+ metadata: {}
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubygems_version: 3.4.13
91
+ signing_key:
92
+ specification_version: 4
93
+ summary: A Beginner's Complete Guide to Microcontroller Programming with Ruby
94
+ test_files: []