Skip to content

Commit d489724

Browse files
committed
Add RH2 rev2 strobe
1 parent ed31507 commit d489724

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

src/devices/rh2.toit

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ class RtkHandheld2Rev2 extends LightbugDevice:
2222
static I2C-SDA := 0
2323
static I2C-SCL := 1
2424
constructor:
25-
super "RtkHandheld2 rev2" I2C-SDA I2C-SCL
26-
strobe -> Strobe:
27-
return NoStrobe // Probably didnt have a strobe, and probably doesnt matter
25+
super "RtkHandheld2 rev2" I2C-SDA I2C-SCL --strobe=LegacyStrobe
2826
messages-supported -> List:
2927
return RtkHandheld2-MESSAGES

src/devices/strobe.toit

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,26 @@ class StandardStrobe implements Strobe:
2424
available -> bool:
2525
return true
2626

27+
set r/bool g/bool b/bool:
28+
pinR.set (if r: 1 else: 0)
29+
pinG.set (if g: 1 else: 0)
30+
pinB.set (if b: 1 else: 0)
31+
32+
// Used on RH2 rev2 (only?)
33+
class LegacyStrobe implements Strobe:
34+
35+
pinR/ gpio.Pin
36+
pinG/ gpio.Pin
37+
pinB/ gpio.Pin
38+
39+
constructor:
40+
pinR = gpio.Pin 18 --output=true
41+
pinG = gpio.Pin 19 --output=true
42+
pinB = gpio.Pin 20 --output=true
43+
44+
available -> bool:
45+
return true
46+
2747
set r/bool g/bool b/bool:
2848
pinR.set (if r: 1 else: 0)
2949
pinG.set (if g: 1 else: 0)

0 commit comments

Comments
 (0)