An error occurred while loading the file. Please try again.
-
Olivier Kaufmann authored46ced919
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from OhmPi.config import HARDWARE_CONFIG
import numpy as np
import os
from OhmPi.hardware import RxAbstract
RX_CONFIG = HARDWARE_CONFIG['rx']
# hardware limits
voltage_min = 10. # mV
voltage_max = 4500.
RX_CONFIG['voltage_min'] = voltage_min # mV
RX_CONFIG['voltage_max'] = voltage_max
class Rx(RxAbstract):
def __init__(self, **kwargs):
kwargs.update({'board_name': os.path.basename(__file__).rstrip('.py')})
super().__init__(**kwargs)
self._adc_gain = 1.
@property
def adc_gain(self):
return self._adc_gain
@adc_gain.setter
def adc_gain(self, value):
self.exec_logger.debug(f'Setting RX ADC gain to {value}')
def adc_gain_auto(self):
gain = 1
self.exec_logger.debug(f'Setting TX ADC gain automatically to {gain}')
self.adc_gain = gain
@property
def voltage(self):
""" Gets the voltage VMN in Volts
"""
u = np.random.uniform(-.200,.200) # gets the max between u0 & u2 and set the sign
self.exec_logger.debug(f'Reading random voltage on RX. Returning {u} V')
return u