summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--si7021d7
1 files changed, 6 insertions, 1 deletions
diff --git a/si7021d b/si7021d
index 77b3970..123fc39 100644
--- a/si7021d
+++ b/si7021d
@@ -9,11 +9,12 @@ import logging
logger = logging.getLogger(__name__)
bus = None
lock = asyncio.Lock()
+delay = 0.01
async def si7021_read():
async with lock:
- await asyncio.sleep(0.01)
+ await asyncio.sleep(delay)
# these are still blocking... meh
raw = bus.read_i2c_block_data(0x40, 0xE3, 2)
@@ -61,8 +62,12 @@ if __name__ == '__main__':
parser.add_argument('--port', type=int, default=8306)
parser.add_argument('--bus', type=int, default=0,
help='Bus number (X for /dev/i2c-X)')
+ parser.add_argument('--delay', type=float, default=delay,
+ help='Delay before reading')
args = parser.parse_args()
+
+ delay = args.delay
logging.basicConfig(level=logging.INFO)
bus = smbus.SMBus(args.bus)