Device driver for Atlas Scientific pH OEM Sensor with SMBus/I2C interface. More...

Detailed Description

Device driver for Atlas Scientific pH OEM Sensor with SMBus/I2C interface.

Author
Igor Knippenberg igor..nosp@m.knip.nosp@m.penbe.nosp@m.rg@g.nosp@m.mail..nosp@m.com

Definition in file ph_oem.h.

#include "periph/i2c.h"
#include "periph/gpio.h"
+ Include dependency graph for ph_oem.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ph_oem_params
 pH OEM sensor params More...
 
struct  ph_oem
 pH OEM device descriptor More...
 

Typedefs

typedef struct ph_oem_params ph_oem_params_t
 pH OEM sensor params
 
typedef void(* ph_oem_interrupt_pin_cb_t) (void *)
 pH OEM interrupt pin callback
 
typedef struct ph_oem ph_oem_t
 pH OEM device descriptor
 

Enumerations

enum  ph_oem_named_returns_t {
  PH_OEM_OK = 0, PH_OEM_NODEV = -1, PH_OEM_READ_ERR = -2, PH_OEM_WRITE_ERR = -3,
  PH_OEM_NOT_PH = -4, PH_OEM_INTERRUPT_GPIO_UNDEF = -5, PH_OEM_GPIO_INIT_ERR = -6, PH_OEM_TEMP_OUT_OF_RANGE = -7
}
 Named return values. More...
 
enum  ph_oem_led_state_t { PH_OEM_LED_ON = 0x01, PH_OEM_LED_OFF = 0x00 }
 LED state values. More...
 
enum  ph_oem_device_state_t { PH_OEM_TAKE_READINGS = 0x01, PH_OEM_STOP_READINGS = 0x00 }
 Device state values. More...
 
enum  ph_oem_irq_option_t { PH_OEM_IRQ_RISING = 0x02, PH_OEM_IRQ_FALLING = 0x04, PH_OEM_IRQ_BOTH = 0x08 }
 Interrupt pin option values. More...
 
enum  ph_oem_calibration_option_t { PH_OEM_CALIBRATE_LOW_POINT = 0x02, PH_OEM_CALIBRATE_MID_POINT = 0x03, PH_OEM_CALIBRATE_HIGH_POINT = 0x04 }
 Calibration option values. More...
 

Functions

int ph_oem_init (ph_oem_t *dev, const ph_oem_params_t *params)
 Initialize a pH OEM sensor. More...
 
int ph_oem_set_i2c_address (ph_oem_t *dev, uint8_t addr)
 Sets a new address to the pH OEM device by unlocking the PH_OEM_REG_UNLOCK register and writing a new address to the PH_OEM_REG_ADDRESS register. More...
 
int ph_oem_enable_interrupt (ph_oem_t *dev, ph_oem_interrupt_pin_cb_t cb, void *arg)
 Enable the pH OEM interrupt pin if ph_oem_params_t::interrupt_pin is defined. More...
 
int ph_oem_reset_interrupt_pin (const ph_oem_t *dev)
 The interrupt pin will not auto reset on option PH_OEM_IRQ_RISING and PH_OEM_IRQ_FALLING after interrupt fires, so call this function again to reset the pin state. More...
 
int ph_oem_set_led_state (const ph_oem_t *dev, ph_oem_led_state_t state)
 Set the LED state of the pH OEM sensor by writing to the PH_OEM_REG_LED register. More...
 
int ph_oem_set_device_state (const ph_oem_t *dev, ph_oem_device_state_t state)
 Sets the device state (active/hibernate) of the pH OEM sensor by writing to the PH_OEM_REG_HIBERNATE register. More...
 
int ph_oem_start_new_reading (const ph_oem_t *dev)
 Starts a new reading by setting the device state to PH_OEM_TAKE_READINGS. More...
 
int ph_oem_clear_calibration (const ph_oem_t *dev)
 Clears all calibrations previously done. More...
 
int ph_oem_set_calibration (const ph_oem_t *dev, uint16_t calibration_value, ph_oem_calibration_option_t option)
 Sets the PH_OEM_REG_CALIBRATION_BASE register to the calibration_value which the pH OEM sensor will be calibrated to. More...
 
int ph_oem_read_calibration_state (const ph_oem_t *dev, uint16_t *calibration_state)
 Read the PH_OEM_REG_CALIBRATION_CONFIRM register. More...
 
int ph_oem_set_compensation (const ph_oem_t *dev, uint16_t temperature_compensation)
 Sets the PH_OEM_REG_TEMP_COMPENSATION_BASE register to the temperature_compensation value which the pH OEM sensor will use to compensate the reading error. More...
 
int ph_oem_read_compensation (const ph_oem_t *dev, uint16_t *temperature_compensation)
 Reads the PH_OEM_REG_TEMP_CONFIRMATION_BASE register to verify the temperature compensation value that was used to take the pH reading is set to the correct temperature. More...
 
int ph_oem_read_ph (const ph_oem_t *dev, uint16_t *ph_value)
 Reads the PH_OEM_REG_PH_READING_BASE register to get the current pH reading. More...