Skip to content

Commit 335bebc

Browse files
committed
Fixes issue #7 whereby the read method should be renamed to raw_uv
1 parent dbdec4c commit 335bebc

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Usage Example
4545
4646
# take 10 readings
4747
for j in range(10):
48-
uv_raw = uv.read
48+
uv_raw = uv.raw_uv
4949
risk_level = uv.get_index(uv_raw)
5050
print('Reading: {0} | Risk Level: {1}'.format(uv_raw, risk_level))
5151
time.sleep(1)

adafruit_veml6070.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class VEML6070:
105105
106106
# take 10 readings
107107
for j in range(10):
108-
uv_raw = uv.read
108+
uv_raw = uv.raw_uv
109109
risk_level = uv.get_index(uv_raw)
110110
print('Reading: ', uv_raw, ' | Risk Level: ', risk_level)
111111
time.sleep(1)
@@ -145,18 +145,18 @@ def __init__(self, i2c_bus, _veml6070_it="VEML6070_1_T", ack=False):
145145

146146

147147
@property
148-
def read(self):
148+
def raw_uv(self):
149149
"""
150150
Reads and returns the value of the UV intensity.
151151
"""
152-
read_buf = bytearray(2)
152+
uv_buf = bytearray(2)
153153
with self.i2c_low as i2c_low:
154-
i2c_low.readinto(read_buf, end=1)
154+
i2c_low.readinto(uv_buf, end=1)
155155

156156
with self.i2c_high as i2c_high:
157-
i2c_high.readinto(read_buf, start=1)
157+
i2c_high.readinto(uv_buf, start=1)
158158

159-
uvi = read_buf[1] << 8 | read_buf[0]
159+
uvi = uv_buf[1] << 8 | uv_buf[0]
160160

161161
return uvi
162162

@@ -231,7 +231,7 @@ def sleep(self):
231231

232232
def wake(self):
233233
"""
234-
Wakes the VEML6070 from sleep. ``[veml6070].read`` will also wake from sleep.
234+
Wakes the VEML6070 from sleep. ``[veml6070].raw_uv`` will also wake from sleep.
235235
"""
236236
self.buf[0] = (self._ack << 5 | self._ack_thd << 4 |
237237
_VEML6070_INTEGRATION_TIME[self._it][0] << 2 | 0x02)
@@ -241,7 +241,7 @@ def wake(self):
241241
def get_index(self, _raw):
242242
"""
243243
Calculates the UV Risk Level based on the captured UV reading. Requres the ``_raw``
244-
argument (from ``veml6070.read``). Risk level is available for Integration Times (IT)
244+
argument (from ``veml6070.raw_uv``). Risk level is available for Integration Times (IT)
245245
1, 2, & 4. The result is automatically scaled to the current IT setting.
246246
247247
LEVEL* UV Index

examples/veml6070_simpletest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
# take 10 readings
1515
for j in range(10):
16-
uv_raw = uv.read
16+
uv_raw = uv.raw_uv
1717
risk_level = uv.get_index(uv_raw)
1818
print('Reading: {0} | Risk Level: {1}'.format(uv_raw, risk_level))
1919
time.sleep(1)

0 commit comments

Comments
 (0)