denko 0.13.3 → 0.13.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -27,7 +27,7 @@ void Denko::pulseRead(){
27
27
  uint16_t resetTime = (auxMsg[1] << 8) | auxMsg[0];
28
28
  pinMode(pin, OUTPUT);
29
29
  digitalWrite(pin, bitRead(val, 1));
30
- delayMicroseconds(resetTime);
30
+ microDelay(resetTime);
31
31
  }
32
32
  pinMode(pin, INPUT);
33
33
  byte state = digitalRead(pin);
@@ -55,3 +55,34 @@ void Denko::pulseRead(){
55
55
  }
56
56
  if (pulseCount == 0) stream->print('\n');
57
57
  }
58
+
59
+ // CMD = 20
60
+ //
61
+ // pin : echo pin
62
+ // val (lower 8 bits) : trigger pin
63
+ //
64
+ void Denko::hcsr04Read(){
65
+ // Store number of microseconds to return.
66
+ uint32_t us;
67
+
68
+ // Ensure pins are correct direction.
69
+ // This is handled by modeling the sensor as a multipin component instead.
70
+ // pinMode(pin, INPUT);
71
+ // pinMode(val, OUTPUT);
72
+
73
+ // Initial pulse on the triger pin.
74
+ digitalWrite(val, LOW);
75
+ microDelay(2);
76
+ digitalWrite(val,HIGH);
77
+ microDelay(10);
78
+ digitalWrite(val,LOW);
79
+
80
+ // Wait for the echo, up to 25,000 microseconds.
81
+ us = pulseIn(pin, HIGH, 25000);
82
+
83
+ // Send value.
84
+ stream->print(pin);
85
+ stream->print(':');
86
+ stream->print(us);
87
+ stream->print('\n');
88
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: denko
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.3
4
+ version: 0.13.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - vickash, Austinbv
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-14 00:00:00.000000000 Z
11
+ date: 2024-02-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyserial
@@ -113,6 +113,7 @@ files:
113
113
  - bin/denko
114
114
  - build
115
115
  - denko.gemspec
116
+ - examples/advanced/m5_env.rb
116
117
  - examples/advanced/rotary_encoder_mac_volume.rb
117
118
  - examples/advanced/ssd1306_time_temp_rh.rb
118
119
  - examples/analog_io/ads1115.rb
@@ -120,6 +121,7 @@ files:
120
121
  - examples/analog_io/dac_loopback.rb
121
122
  - examples/analog_io/input.rb
122
123
  - examples/connection/tcp.rb
124
+ - examples/digital_io/button.rb
123
125
  - examples/digital_io/rotary_encoder.rb
124
126
  - examples/display/hd44780.png
125
127
  - examples/display/hd44780.rb
@@ -143,10 +145,17 @@ files:
143
145
  - examples/sensor/aht10.rb
144
146
  - examples/sensor/aht20.rb
145
147
  - examples/sensor/bme280.rb
148
+ - examples/sensor/bmp180.rb
146
149
  - examples/sensor/dht.rb
147
150
  - examples/sensor/ds18b20.rb
151
+ - examples/sensor/generic_pir.rb
152
+ - examples/sensor/hcsr04.rb
148
153
  - examples/sensor/htu21d.rb
149
154
  - examples/sensor/htu31d.rb
155
+ - examples/sensor/neat_tph_readings.rb
156
+ - examples/sensor/qmp6988.rb
157
+ - examples/sensor/rcwl9620.rb
158
+ - examples/sensor/sht3x.rb
150
159
  - examples/spi/input_register.rb
151
160
  - examples/spi/output_register.rb
152
161
  - examples/spi/ssd_through_register.rb
@@ -247,10 +256,16 @@ files:
247
256
  - lib/denko/sensor.rb
248
257
  - lib/denko/sensor/aht.rb
249
258
  - lib/denko/sensor/bme280.rb
259
+ - lib/denko/sensor/bmp180.rb
250
260
  - lib/denko/sensor/dht.rb
251
261
  - lib/denko/sensor/ds18b20.rb
262
+ - lib/denko/sensor/generic_pir.rb
263
+ - lib/denko/sensor/hcsr04.rb
252
264
  - lib/denko/sensor/htu21d.rb
253
265
  - lib/denko/sensor/htu31d.rb
266
+ - lib/denko/sensor/qmp6988.rb
267
+ - lib/denko/sensor/rcwl9620.rb
268
+ - lib/denko/sensor/sht3x.rb
254
269
  - lib/denko/sensor/virtual.rb
255
270
  - lib/denko/spi.rb
256
271
  - lib/denko/spi/base_register.rb