tinderfridge 0.7.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tinderfridge/device.rb +44 -3
  3. data/lib/tinderfridge/device_collection.rb +3 -1
  4. data/lib/tinderfridge/devices/brick_master/brick_master.json +11 -0
  5. data/lib/tinderfridge/devices/brick_master/brick_master.rb +11 -0
  6. data/lib/tinderfridge/devices/bricklet_accelerometer_v2/bricklet_accelerometer_v2.json +11 -0
  7. data/lib/tinderfridge/devices/bricklet_air_quality/bricklet_air_quality.json +2 -1
  8. data/lib/tinderfridge/devices/bricklet_air_quality/bricklet_air_quality.rb +15 -0
  9. data/lib/tinderfridge/devices/bricklet_ambient_light_v3/bricklet_ambient_light_v3.json +2 -1
  10. data/lib/tinderfridge/devices/bricklet_analog_in_v3/bricklet_analog_in_v3.json +2 -1
  11. data/lib/tinderfridge/devices/bricklet_analog_out_v3/bricklet_analog_out_v3.json +2 -1
  12. data/lib/tinderfridge/devices/bricklet_barometer_v2/bricklet_barometer_v2.json +2 -1
  13. data/lib/tinderfridge/devices/bricklet_co2_v2/bricklet_co2_v2.json +2 -1
  14. data/lib/tinderfridge/devices/bricklet_co2_v2/bricklet_co2_v2.rb +19 -0
  15. data/lib/tinderfridge/devices/bricklet_color_v2/bricklet_color_v2.json +2 -1
  16. data/lib/tinderfridge/devices/bricklet_compass/bricklet_compass.json +2 -1
  17. data/lib/tinderfridge/devices/bricklet_distance_ir_v2/bricklet_distance_ir_v2.json +11 -0
  18. data/lib/tinderfridge/devices/bricklet_distance_us_v2/bricklet_distance_us_v2.json +2 -1
  19. data/lib/tinderfridge/devices/bricklet_dmx/bricklet_dmx.json +2 -1
  20. data/lib/tinderfridge/devices/bricklet_dual_button_v2/bricklet_dual_button_v2.json +11 -0
  21. data/lib/tinderfridge/devices/bricklet_e_paper_296x128/bricklet_e_paper_296x128.json +2 -1
  22. data/lib/tinderfridge/devices/bricklet_energy_monitor/bricklet_energy_monitor.json +2 -1
  23. data/lib/tinderfridge/devices/bricklet_gps_v2/bricklet_gps_v2.json +2 -1
  24. data/lib/tinderfridge/devices/bricklet_gps_v2/bricklet_gps_v2.rb +21 -1
  25. data/lib/tinderfridge/devices/bricklet_hall_effect_v2/bricklet_hall_effect_v2.json +2 -1
  26. data/lib/tinderfridge/devices/bricklet_hall_effect_v2/bricklet_hall_effect_v2.rb +16 -0
  27. data/lib/tinderfridge/devices/bricklet_humidity_v2/bricklet_humidity_v2.json +2 -1
  28. data/lib/tinderfridge/devices/bricklet_imu_v3/bricklet_imu_v3.json +2 -1
  29. data/lib/tinderfridge/devices/bricklet_industrial_analog_out_v2/bricklet_industrial_analog_out_v2.json +11 -0
  30. data/lib/tinderfridge/devices/bricklet_industrial_dual_0_20ma_v2/bricklet_industrial_dual_0_20ma_v2.json +11 -0
  31. data/lib/tinderfridge/devices/bricklet_industrial_dual_ac_relay/bricklet_industrial_dual_ac_relay.json +11 -0
  32. data/lib/tinderfridge/devices/bricklet_industrial_dual_analog_in_v2/bricklet_industrial_dual_analog_in_v2.json +11 -0
  33. data/lib/tinderfridge/devices/bricklet_industrial_dual_relay/bricklet_industrial_dual_relay.json +2 -1
  34. data/lib/tinderfridge/devices/bricklet_io16_v2/bricklet_io16_v2.json +11 -0
  35. data/lib/tinderfridge/devices/bricklet_io4_v2/bricklet_io4_v2.json +11 -0
  36. data/lib/tinderfridge/devices/bricklet_isolator/bricklet_isolator.json +2 -1
  37. data/lib/tinderfridge/devices/bricklet_joystick_v2/bricklet_joystick_v2.json +2 -1
  38. data/lib/tinderfridge/devices/bricklet_laser_range_finder_v2/bricklet_laser_range_finder_v2.json +2 -1
  39. data/lib/tinderfridge/devices/bricklet_lcd_128x64/bricklet_lcd_128x64.json +2 -1
  40. data/lib/tinderfridge/devices/bricklet_lcd_128x64/bricklet_lcd_128x64.rb +46 -0
  41. data/lib/tinderfridge/devices/bricklet_led_strip_v2/bricklet_led_strip_v2.json +2 -1
  42. data/lib/tinderfridge/devices/bricklet_linear_poti_v2/bricklet_linear_poti_v2.json +2 -1
  43. data/lib/tinderfridge/devices/bricklet_load_cell_v2/bricklet_load_cell_v2.json +11 -0
  44. data/lib/tinderfridge/devices/bricklet_motion_detector_v2/bricklet_motion_detector_v2.json +2 -1
  45. data/lib/tinderfridge/devices/bricklet_motorized_linear_poti/bricklet_motorized_linear_poti.json +2 -1
  46. data/lib/tinderfridge/devices/bricklet_multi_touch_v2/bricklet_multi_touch_v2.json +2 -1
  47. data/lib/tinderfridge/devices/bricklet_nfc/bricklet_nfc.json +2 -1
  48. data/lib/tinderfridge/devices/bricklet_oled_128x64_v2/bricklet_oled_128x64_v2.rb +79 -0
  49. data/lib/tinderfridge/devices/bricklet_one_wire/bricklet_one_wire.json +11 -0
  50. data/lib/tinderfridge/devices/bricklet_outdoor_weather/bricklet_outdoor_weather.json +2 -1
  51. data/lib/tinderfridge/devices/bricklet_particulate_matter/bricklet_particulate_matter.json +11 -0
  52. data/lib/tinderfridge/devices/bricklet_piezo_speaker_v2/bricklet_piezo_speaker_v2.json +2 -1
  53. data/lib/tinderfridge/devices/bricklet_ptc_v2/bricklet_ptc_v2.json +11 -0
  54. data/lib/tinderfridge/devices/bricklet_real_time_clock_v2/bricklet_real_time_clock_v2.json +2 -1
  55. data/lib/tinderfridge/devices/bricklet_remote_switch_v2/bricklet_remote_switch_v2.json +2 -1
  56. data/lib/tinderfridge/devices/bricklet_rgb_led_button/bricklet_rgb_led_button.json +2 -1
  57. data/lib/tinderfridge/devices/bricklet_rgb_led_v2/bricklet_rgb_led_v2.json +2 -1
  58. data/lib/tinderfridge/devices/bricklet_rotary_encoder_v2/bricklet_rotary_encoder_v2.json +2 -1
  59. data/lib/tinderfridge/devices/bricklet_rotary_poti_v2/bricklet_rotary_poti_v2.json +2 -1
  60. data/lib/tinderfridge/devices/bricklet_segment_display_4x7_v2/bricklet_segment_display_4x7_v2.json +2 -1
  61. data/lib/tinderfridge/devices/bricklet_segment_display_4x7_v2/bricklet_segment_display_4x7_v2.rb +25 -1
  62. data/lib/tinderfridge/devices/bricklet_solid_state_relay_v2/bricklet_solid_state_relay_v2.json +11 -0
  63. data/lib/tinderfridge/devices/bricklet_sound_pressure_level/bricklet_sound_pressure_level.json +2 -1
  64. data/lib/tinderfridge/devices/bricklet_sound_pressure_level/bricklet_sound_pressure_level.rb +20 -0
  65. data/lib/tinderfridge/devices/bricklet_temperature_ir_v2/bricklet_temperature_ir_v2.json +2 -1
  66. data/lib/tinderfridge/devices/bricklet_temperature_ir_v2/bricklet_temperature_ir_v2.rb +14 -0
  67. data/lib/tinderfridge/devices/bricklet_temperature_v2/bricklet_temperature_v2.json +2 -1
  68. data/lib/tinderfridge/devices/bricklet_thermal_imaging/bricklet_thermal_imaging.json +2 -1
  69. data/lib/tinderfridge/devices/bricklet_thermocouple_v2/bricklet_thermocouple_v2.json +2 -1
  70. data/lib/tinderfridge/devices/bricklet_uv_light_v2/bricklet_uv_light_v2.json +2 -1
  71. data/lib/tinderfridge/devices/bricklet_voltage_current_v2/bricklet_voltage_current_v2.json +2 -1
  72. data/lib/tinderfridge/devices/bricklet_xmc1400_breakout/bricklet_xmc1400_breakout.json +2 -1
  73. data/lib/tinderfridge/ip_connection.rb +19 -11
  74. data/lib/tinderfridge/shared/display_ibm437_encoding.rb +41 -0
  75. data/lib/tinderfridge/tinkerforge.rb +24 -9
  76. data/lib/tinderfridge/version.rb +1 -1
  77. metadata +27 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 61c196b035feb056ef219545b4fb18b0d31143ec45dce191fd24abba736c6c06
4
- data.tar.gz: b8f7e262293e0c1f42648f57360818bc160bef744d3bf4e1424c31f81658fe84
3
+ metadata.gz: a38ff1936a5557806bbd57e497dedda5b7d244b0e5cc4773d89d38265343affa
4
+ data.tar.gz: 45b04a762c008a25d5bfc02d61cc254b4b655eaacc460e9f99b7308c47734ea7
5
5
  SHA512:
6
- metadata.gz: 68b64abcf925c879f4962b505c4ae06b9cdf3d4fad9964c34e1d33cbe1dc72fffee805a7a1651fe9b4d0cdc3c2c93a53a593dafdc0ad28f8fea93e20a3fc2c0b
7
- data.tar.gz: b3a2980b1f8d21b9044b59b8e40b62bf148fc5a18505b3391f1c7047796df5139e2782e50872cac01acf1a29bb8b52cfe14fea0fca8b706c9a6fb3d120ebbfc5
6
+ metadata.gz: 2ab3a4497bfb859e8b4a82e37edbad2ebee17c1b9c830a5cda9030c206f7a4188987cef28f5420299555568b682e93ad48daec128d18190ec435b02b2a64a1d7
7
+ data.tar.gz: 7209808acb2f9bc4f7ef0ad9770f57f6e66837962f19480d88b91def64a15b3af6f19e761c47ed1623a38852efbb0de6aa5ad8348c5b08c65336f9e955e83a18
@@ -109,7 +109,13 @@ module Tinkerforge
109
109
  [ 'ipcon' , { 'host' => ipcon.host , 'port' => ipcon.port } ],
110
110
 
111
111
  respond_to?('get_chip_temperature' ) ? [ 'chip_temperature' , get_chip_temperature ] : nil,
112
- respond_to?('get_spitfp_error_count') ? [ 'spitfp_error_count', get_spitfp_error_count ] : nil,
112
+
113
+ if respond_to?('get_spitfp_error_count') and (method(:get_spitfp_error_count).arity == 0)
114
+ [ 'spitfp_error_count', get_spitfp_error_count ]
115
+ else
116
+ nil
117
+ end,
118
+
113
119
  respond_to?('get_status_led_config' ) ? [ 'status_led_config' , get_status_led_config ] : nil,
114
120
 
115
121
  ].compact.to_h
@@ -131,9 +137,30 @@ module Tinkerforge
131
137
 
132
138
  # Identifies a Tinkerforge device by blinking its status led.
133
139
  #
134
- # Supports recent devices. When invoked on older devices, does nothing.
140
+ # Supports recent devices. When invoked on some older devices, does nothing.
135
141
  def identify(seconds=10)
136
- if (respond_to? 'get_status_led_config') and (respond_to? 'set_status_led_config')
142
+ case status_led_api_variety
143
+ when 1
144
+ seconds = seconds.to_i
145
+ state = is_status_led_enabled
146
+
147
+ (seconds*2).times do |n|
148
+ if n.even?
149
+ disable_status_led
150
+ else
151
+ enable_status_led
152
+ end
153
+ sleep 0.5
154
+ end
155
+
156
+ if state
157
+ enable_status_led
158
+ else
159
+ disable_status_led
160
+ end
161
+
162
+ seconds
163
+ when 2
137
164
  seconds = seconds.to_i
138
165
  state = get_status_led_config
139
166
 
@@ -175,6 +202,20 @@ module Tinkerforge
175
202
  end
176
203
  end
177
204
 
205
+ def status_led_api_variety
206
+ @status_led_api_variety ||=
207
+ if ( respond_to?('get_status_led_config') &&
208
+ respond_to?('set_status_led_config') )
209
+ 2
210
+ elsif ( respond_to?('is_status_led_enabled') &&
211
+ respond_to?('enable_status_led') &&
212
+ respond_to?('disable_status_led') )
213
+ 1
214
+ else
215
+ nil
216
+ end
217
+ end
218
+
178
219
  end
179
220
 
180
221
  end
@@ -5,6 +5,8 @@ module Tinkerforge
5
5
  # Returns the temperatures as measured inside the microcontrollers of devices in the collection.
6
6
  #
7
7
  # Nil for devices that do not support the get_chip_temperature method.
8
+ #
9
+ # Note: most devices return temperature in °C, but a few return temperature in 1/10 °C.
8
10
  def get_chip_temperature
9
11
  smap 'get_chip_temperature'
10
12
  end
@@ -135,7 +137,7 @@ module Tinkerforge
135
137
  private
136
138
 
137
139
  def smap(m)
138
- map { |k,d| [ k, d.respond_to?(m) ? d.send(m) : nil ] }.to_h
140
+ map { |k,d| [ k, ( d.respond_to?(m) and (d.method(m).arity == 0) ) ? d.send(m) : nil ] }.to_h
139
141
  end
140
142
 
141
143
  end
@@ -0,0 +1,11 @@
1
+ {
2
+ "dimensions": [
3
+ 40,
4
+ 40,
5
+ 16
6
+ ],
7
+ "weight": 12,
8
+ "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricks/Master_Brick.html",
9
+ "versions_identifier": "bricks:master",
10
+ "released": ""
11
+ }
@@ -0,0 +1,11 @@
1
+ module Tinkerforge
2
+
3
+ class BrickMaster
4
+
5
+ # Unit returned by #get_chip_temperature. Master Bricks return temperature as 1/10 °C.
6
+ CHIP_TEMPERATURE_UNIT = 0.1
7
+ # REVIEW: This should ideally be part of base Tinkerforge.
8
+
9
+ end
10
+
11
+ end
@@ -0,0 +1,11 @@
1
+ {
2
+ "dimensions": [
3
+ 25,
4
+ 20,
5
+ 5
6
+ ],
7
+ "weight": 2,
8
+ "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Accelerometer_V2.html",
9
+ "versions_identifier": "bricklets:accelerometer_v2",
10
+ "released": "2019-01-29"
11
+ }
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 2.1,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Air_Quality.html",
9
- "versions_identifier": "bricklets:air_quality"
9
+ "versions_identifier": "bricklets:air_quality",
10
+ "released": "2018-09-27"
10
11
  }
@@ -15,6 +15,21 @@ module Tinkerforge
15
15
  )
16
16
  end
17
17
 
18
+ # Returns the derived air pressure at sea level.
19
+ #
20
+ # Air pressure is derived from:
21
+ # - air pressure as measured by the Bricklet itself
22
+ # - temperature as measured by the Bricklet itself
23
+ # - altitude of the Bricklet's location (meter)
24
+ #
25
+ # With help from:
26
+ # - https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Barometer_V2.html
27
+ # - https://keisan.casio.com/exec/system/1224575267
28
+ def qff(altitude)
29
+ # QFE / [1 - Tg * H / (273.15 + Tfe + Tg * H)] ^ (0.034163 / Tg)
30
+ (get_air_pressure / (1 - 0.0065 * altitude / (273.15 + (get_temperature * 0.01) + 0.0065 * altitude)) ** (0.034163 / 0.0065)).round
31
+ end
32
+
18
33
  end
19
34
 
20
35
  end
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 2,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Ambient_Light_V3.html",
9
- "versions_identifier": "bricklets:ambient_light_v3"
9
+ "versions_identifier": "bricklets:ambient_light_v3",
10
+ "released": "2019-01-29"
10
11
  }
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 8,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Analog_In_V3.html",
9
- "versions_identifier": "bricklets:analog_in_v3"
9
+ "versions_identifier": "bricklets:analog_in_v3",
10
+ "released": "2018-02-26"
10
11
  }
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 8,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Analog_Out_V3.html",
9
- "versions_identifier": "bricklets:analog_out_v3"
9
+ "versions_identifier": "bricklets:analog_out_v3",
10
+ "released": "2018-09-27"
10
11
  }
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 1.6,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Barometer_V2.html",
9
- "versions_identifier": "bricklets:barometer_v2"
9
+ "versions_identifier": "bricklets:barometer_v2",
10
+ "released": "2018-09-27"
10
11
  }
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 9,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/CO2_V2.html",
9
- "versions_identifier": "bricklets:co2_v2"
9
+ "versions_identifier": "bricklets:co2_v2",
10
+ "released": "2019-05-20"
10
11
  }
@@ -0,0 +1,19 @@
1
+ module Tinkerforge
2
+
3
+ class BrickletCO2V2
4
+
5
+ # Returns the device's state.
6
+ def state
7
+ av = get_all_values
8
+ super.merge(
9
+ 'co2_concentration' => av[0],
10
+ 'temperature' => av[1],
11
+ 'temperature_offset' => get_temperature_offset,
12
+ 'humidity' => av[2],
13
+ 'air_pressure' => get_air_pressure,
14
+ )
15
+ end
16
+
17
+ end
18
+
19
+ end
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 2,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Color_V2.html",
9
- "versions_identifier": "bricklets:color_v2"
9
+ "versions_identifier": "bricklets:color_v2",
10
+ "released": "2019-08-22"
10
11
  }
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 2,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Compass.html",
9
- "versions_identifier": "bricklets:compass"
9
+ "versions_identifier": "bricklets:compass",
10
+ "released": "2019-08-22"
10
11
  }
@@ -0,0 +1,11 @@
1
+ {
2
+ "dimensions": [
3
+ 45,
4
+ 13,
5
+ 5
6
+ ],
7
+ "weight": 8,
8
+ "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Distance_IR_V2.html",
9
+ "versions_identifier": "bricklets:distance_ir_v2",
10
+ "released": "2018-09-27"
11
+ }
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 9,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Distance_US_V2.html",
9
- "versions_identifier": "bricklets:distance_us_v2"
9
+ "versions_identifier": "bricklets:distance_us_v2",
10
+ "released": "2019-08-22"
10
11
  }
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 30,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/DMX.html",
9
- "versions_identifier": "bricklets:dmx"
9
+ "versions_identifier": "bricklets:dmx",
10
+ "released": "2017-11-17"
10
11
  }
@@ -0,0 +1,11 @@
1
+ {
2
+ "dimensions": [
3
+ 45,
4
+ 20,
5
+ 10
6
+ ],
7
+ "weight": 5.5,
8
+ "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Dual_Button_V2.html",
9
+ "versions_identifier": "bricklets:dual_button_v2",
10
+ "released": "2018-09-27"
11
+ }
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 20,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/EPaper_296x128.html",
9
- "versions_identifier": "bricklets:e_paper_296x128"
9
+ "versions_identifier": "bricklets:e_paper_296x128",
10
+ "released": "2019-05-20"
10
11
  }
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 7,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Energy_Monitor.html",
9
- "versions_identifier": "bricklets:energy_monitor"
9
+ "versions_identifier": "bricklets:energy_monitor",
10
+ "released": "2019-08-22"
10
11
  }
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 20,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/GPS_V2.html",
9
- "versions_identifier": "bricklets:gps_v2"
9
+ "versions_identifier": "bricklets:gps_v2",
10
+ "released": "2017-05-11"
10
11
  }
@@ -2,11 +2,24 @@ module Tinkerforge
2
2
 
3
3
  class BrickletGPSV2
4
4
 
5
+ # Returns the device's state.
6
+ def state
7
+ super.merge(
8
+ 'fix_led_config' => get_fix_led_config,
9
+ 'fix' => fix?,
10
+ )
11
+ end
12
+
13
+ # Returns true if a fix is available.
14
+ def fix?
15
+ get_status[0]
16
+ end
17
+
5
18
  # Returns latitude and longitude as reported by the GPS Bricklet.
6
19
  #
7
20
  # Nil when there is no fix (position not determined).
8
21
  def coordinates
9
- if get_status[0]
22
+ if fix?
10
23
  c = get_coordinates
11
24
  [
12
25
  c[0] / (c[1] == 'N' ? 1000000.0 : -1000000.0),
@@ -26,6 +39,13 @@ module Tinkerforge
26
39
  Time.gm *dt.map(&:to_i)
27
40
  end
28
41
 
42
+ # Returns a URL for viewing the current coordinates on OpenStreetMap.
43
+ def openstreetmap_marker_url(zoom=12)
44
+ if c = coordinates
45
+ "https://www.openstreetmap.org/?mlat=%f&mlon=%f&zoom=%d" % [c, zoom].flatten
46
+ end
47
+ end
48
+
29
49
  end
30
50
 
31
51
  end
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 2,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Hall_Effect_V2.html",
9
- "versions_identifier": "bricklets:hall_effect_v2"
9
+ "versions_identifier": "bricklets:hall_effect_v2",
10
+ "released": "2019-05-20"
10
11
  }
@@ -0,0 +1,16 @@
1
+ module Tinkerforge
2
+
3
+ class BrickletHallEffectV2
4
+
5
+ # Returns the device's state.
6
+ def state
7
+ super.merge(
8
+ 'magnetic_flux_density' => get_magnetic_flux_density,
9
+ 'counter' => get_counter(false),
10
+ 'counter_config' => get_counter_config,
11
+ )
12
+ end
13
+
14
+ end
15
+
16
+ end
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 3,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Humidity_V2.html",
9
- "versions_identifier": "bricklets:humidity_v2"
9
+ "versions_identifier": "bricklets:humidity_v2",
10
+ "released": "2017-11-17"
10
11
  }
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 3,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/IMU_V3.html",
9
- "versions_identifier": "bricklets:imu_v3"
9
+ "versions_identifier": "bricklets:imu_v3",
10
+ "released": "2020-10-27"
10
11
  }
@@ -0,0 +1,11 @@
1
+ {
2
+ "dimensions": [
3
+ 40,
4
+ 40,
5
+ 11
6
+ ],
7
+ "weight": 9,
8
+ "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Industrial_Analog_Out_V2.html",
9
+ "versions_identifier": "bricklets:industrial_analog_out_v2",
10
+ "released": "2018-09-27"
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "dimensions": [
3
+ 40,
4
+ 40,
5
+ 11
6
+ ],
7
+ "weight": 8,
8
+ "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Industrial_Dual_020mA_V2.html",
9
+ "versions_identifier": "bricklets:industrial_dual_0_20ma_v2",
10
+ "released": "2018-09-27"
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "dimensions": [
3
+ 40,
4
+ 40,
5
+ 16
6
+ ],
7
+ "weight": 11,
8
+ "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Industrial_Dual_AC_Relay.html",
9
+ "versions_identifier": "bricklets:industrial_dual_ac_relay",
10
+ "released": "2020-10-27"
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "dimensions": [
3
+ 40,
4
+ 40,
5
+ 11
6
+ ],
7
+ "weight": 9,
8
+ "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Industrial_Dual_Analog_In_V2.html",
9
+ "versions_identifier": "bricklets:industrial_dual_analog_in_v2",
10
+ "released": "2018-09-27"
11
+ }
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 29.4,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Industrial_Dual_Relay.html",
9
- "versions_identifier": "bricklets:industrial_dual_relay"
9
+ "versions_identifier": "bricklets:industrial_dual_relay",
10
+ "released": "2018-06-07"
10
11
  }
@@ -0,0 +1,11 @@
1
+ {
2
+ "dimensions": [
3
+ 35,
4
+ 75,
5
+ 14
6
+ ],
7
+ "weight": 30,
8
+ "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/IO16_V2.html",
9
+ "versions_identifier": "bricklets:io16_v2",
10
+ "released": "2018-09-27"
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "dimensions": [
3
+ 35,
4
+ 35,
5
+ 14
6
+ ],
7
+ "weight": 15,
8
+ "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/IO4_V2.html",
9
+ "versions_identifier": "bricklets:io4_v2",
10
+ "released": "2018-06-07"
11
+ }
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 7.1,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Isolator.html",
9
- "versions_identifier": "bricklets:isolator"
9
+ "versions_identifier": "bricklets:isolator",
10
+ "released": "2018-09-10"
10
11
  }
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 15,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Joystick_V2.html",
9
- "versions_identifier": "bricklets:joystick_v2"
9
+ "versions_identifier": "bricklets:joystick_v2",
10
+ "released": "2019-05-20"
10
11
  }
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 30,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Laser_Range_Finder_V2.html",
9
- "versions_identifier": "bricklets:laser_range_finder_v2"
9
+ "versions_identifier": "bricklets:laser_range_finder_v2",
10
+ "released": "2019-05-20"
10
11
  }
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 55,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/LCD_128x64.html",
9
- "versions_identifier": "bricklets:lcd_128x64"
9
+ "versions_identifier": "bricklets:lcd_128x64",
10
+ "released": "2018-09-27"
10
11
  }
@@ -1,7 +1,21 @@
1
+ require 'tinderfridge/shared/display_ibm437_encoding'
2
+
1
3
  module Tinkerforge
2
4
 
3
5
  class BrickletLCD128x64
4
6
 
7
+ include Tinkerforge::Shared::IBM437_encoding
8
+
9
+ # Encodes a string in the IBM437 character set used by some displays.
10
+ #
11
+ # Characters that can not be encoded are replaced with '?'.
12
+ #
13
+ # See:
14
+ # - https://en.wikipedia.org/wiki/Code_page_437
15
+ def encode(string)
16
+ ibm437_encode(string)
17
+ end
18
+
5
19
  # Returns the current setting for the backlight (0..100).
6
20
  def backlight
7
21
  get_display_configuration[1]
@@ -20,12 +34,44 @@ module Tinkerforge
20
34
  true
21
35
  end
22
36
 
37
+ # Returns the current contrast setting (0..63).
38
+ def contrast
39
+ get_display_configuration[0]
40
+ end
41
+
42
+ # Sets the contrast (0..63).
43
+ def contrast=(value)
44
+ state = get_display_configuration
45
+ state[0] = value.to_i
46
+ set_display_configuration *state
47
+ end
48
+
23
49
  # Clears the display, including the GUI.
24
50
  def clear
25
51
  clear_display
26
52
  remove_all_gui
27
53
  end
28
54
 
55
+ # Returns true if automatic draw is set to false.
56
+ def buffered?
57
+ ! get_display_configuration[3]
58
+ end
59
+
60
+ # Draws the currently buffered frame.
61
+ def redraw(force_complete_redraw=false)
62
+ draw_buffered_frame force_complete_redraw
63
+ end
64
+
65
+ alias flush redraw
66
+
67
+ # Returns the device's state.
68
+ def state
69
+ super.merge(
70
+ 'touch_led_config' => get_touch_led_config,
71
+ 'display_configuration' => get_display_configuration,
72
+ )
73
+ end
74
+
29
75
  end
30
76
 
31
77
  end
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 8.1,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/LED_Strip_V2.html",
9
- "versions_identifier": "bricklets:led_strip_v2"
9
+ "versions_identifier": "bricklets:led_strip_v2",
10
+ "released": "2018-06-07"
10
11
  }
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 14,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Linear_Poti_V2.html",
9
- "versions_identifier": "bricklets:linear_poti_v2"
9
+ "versions_identifier": "bricklets:linear_poti_v2",
10
+ "released": "2019-05-20"
10
11
  }
@@ -0,0 +1,11 @@
1
+ {
2
+ "dimensions": [
3
+ 30,
4
+ 30,
5
+ 14
6
+ ],
7
+ "weight": 7.3,
8
+ "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Load_Cell_V2.html",
9
+ "versions_identifier": "bricklets:load_cell_v2",
10
+ "released": "2018-06-07"
11
+ }
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 6,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Motion_Detector_V2.html",
9
- "versions_identifier": "bricklets:motion_detector_v2"
9
+ "versions_identifier": "bricklets:motion_detector_v2",
10
+ "released": "2018-02-26"
10
11
  }
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 67,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Motorized_Linear_Poti.html",
9
- "versions_identifier": "bricklets:motorized_linear_poti"
9
+ "versions_identifier": "bricklets:motorized_linear_poti",
10
+ "released": "2017-11-17"
10
11
  }