Struct pcf8591::PCF8591
[−]
[src]
pub struct PCF8591 { /* fields omitted */ }
A struct to handle PCF8591 converter
Allow user to read from given input pin and write to output pin
Methods
impl PCF8591
[src]
fn new<P: AsRef<Path>>(path: P, address: u16, v_ref: f64) -> Result<PCF8591>
Creates a new connection given i2c path and address
path
: device slave path (0x48 per default)address
: has to be defined as per Table 5.v_ref
: is the board voltage (e.g. typically 3.3V on raspberry pi)
fn analog_read_byte(&mut self, pin: Pin) -> Result<u8>
Reads analog values out of input pin and output digital byte
The conversion with board voltage is left to the user.
For automatic conversion, use analog_read
fn analog_read(&mut self, pin: Pin) -> Result<f64>
Reads analog values out of input pin and output corresponding input voltage
Returns analog_read_byte * v_ref / 255 (suppose Vagnd == 0)
fn analog_write_byte(&mut self, value: u8) -> Result<()>
Writes analog values, as byte, in the output pin
The conversion with board voltage is left to the user
For automatic conversion, use analog_write
fn analog_write(&mut self, v_out: f64) -> Result<()>
Writes analog values in the output pin