Commit 0a392210 authored by Arnaud WATLET's avatar Arnaud WATLET
Browse files

test pulse

Showing with 2 additions and 25 deletions
+2 -25
import datetime
import time
import adafruit_ads1x15.ads1115 as ads # noqa
from adafruit_ads1x15.analog_in import AnalogIn # noqa
from adafruit_ads1x15.ads1x15 import Mode # noqa
......@@ -81,29 +80,6 @@ class Tx(Tx_mb_2023):
Tx_mb_2023.inject(self, polarity=polarity, injection_duration=injection_duration)
self.pin6.value = False
@property
def polarity(self):
return self._polarity
@polarity.setter
def polarity(self, polarity):
print(polarity)
assert polarity in [-1, 0, 1]
print(f'asserted polarity: {self.polarity}')
self._polarity = polarity
if polarity == 1:
self.pin0.value = True
self.pin1.value = False
time.sleep(self._activation_delay)
elif polarity == -1:
self.pin0.value = False
self.pin1.value = True
time.sleep(self._activation_delay)
else:
self.pin0.value = False
self.pin1.value = False
time.sleep(self._release_delay)
class Rx(Rx_mb_2023):
def __init__(self, **kwargs):
......
......@@ -123,7 +123,7 @@ class OhmPiHardware:
ctl_mod = importlib.import_module(f'ohmpi.hardware_components.{ctl_mod}')
HARDWARE_CONFIG['tx']['ctl'] = ctl_mod.Ctl(**HARDWARE_CONFIG['tx']['ctl'])
HARDWARE_CONFIG['tx'].update({'connection': HARDWARE_CONFIG['tx'].pop('connection',
HARDWARE_CONFIG['rx']['ctl'].interfaces[
HARDWARE_CONFIG['tx']['ctl'].interfaces[
HARDWARE_CONFIG['tx'].pop(
'interface_name', 'i2c')])})
HARDWARE_CONFIG['tx'].pop('ctl', None)
......@@ -204,6 +204,7 @@ class OhmPiHardware:
def _inject(self, polarity=1, injection_duration=None): # TODO: deal with voltage or current pulse
self.exec_logger.event(f'OhmPiHardware\tinject\tbegin\t{datetime.datetime.utcnow()}')
print('inject')
self.tx.voltage_pulse(length=injection_duration, polarity=polarity)
self.exec_logger.event(f'OhmPiHardware\tinject\tend\t{datetime.datetime.utcnow()}')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment