Library for MAX5387 dual channel digi pot

Dependents:   MAX14871_Shield

Embed: (wiki syntax)

« Back to documentation index

Max5387 Class Reference

Max5387 Class Reference

Dual, 256-Tap, Volatile, Low-Voltage Linear Taper Digital Potentiometer. More...

#include <max5387.h>

Public Types

enum  max5387_i2c_adrs_t
 

Valid 7-bit I2C addresses.

More...

Public Member Functions

 Max5387 (I2C *i2c_bus, max5387_i2c_adrs_t i2c_adrs)
 Constructor for Max5387 Class.
 Max5387 (PinName sda, PinName scl, max5387_i2c_adrs_t i2c_adrs)
 Constructor for Max5387 Class.
 ~Max5387 ()
 Default destructor for Max5387 Class.
int16_t write_ch_A (uint8_t val)
 Write channel A.
int16_t write_ch_B (uint8_t val)
 Write channel B.
int16_t write_ch_AB (uint8_t val)
 Write channel A&B.

Detailed Description

Dual, 256-Tap, Volatile, Low-Voltage Linear Taper Digital Potentiometer.

The MAX5387 dual, 256-tap, volatile, low-voltage linear taper digital potentiometer offers three end-to-end resistance values of 10kΩ, 50kΩ, and 100kΩ. Operating from a single +2.6V to +5.5V power supply, the device provides a low 35ppm/°C end-to-end temperature coefficient. The device features an I2C interface.

 #include "mbed.h"
 #include "max5387.h"
 
 int main (void)
 {
      Max5387 digiPot(D14, D15, Max5387::MAX5387_I2C_ADRS0);
      uint8_t data;
      
      //set data...

      digiPot.write_ch_A(data);
      
      //... rest of application
 }

Definition at line 68 of file max5387.h.


Member Enumeration Documentation

Valid 7-bit I2C addresses.

The 8 valid I2C addresses set via A0, A1, and A2 pins of the MAX5387

Definition at line 77 of file max5387.h.


Constructor & Destructor Documentation

Max5387 ( I2C *  i2c_bus,
max5387_i2c_adrs_t  i2c_adrs 
)

Constructor for Max5387 Class.

Allows user to use existing I2C object

On Entry:

Parameters:
[in]i2c_bus- pointer to existing I2C object
[in]i2c_adrs- 7-bit slave address of MAX5387

On Exit:

Returns:
None

Definition at line 44 of file max5387.cpp.

Max5387 ( PinName  sda,
PinName  scl,
max5387_i2c_adrs_t  i2c_adrs 
)

Constructor for Max5387 Class.

Allows user to create a new I2C object if not already using one

On Entry:

Parameters:
[in]sda- sda pin of I2C bus
[in]scl- scl pin of I2C bus
[in]i2c_adrs- 7-bit slave address of MAX5387

On Exit:

Returns:
None

Definition at line 53 of file max5387.cpp.

~Max5387 (  )

Default destructor for Max5387 Class.

Destroys I2C object if owner

On Entry:

On Exit:

Returns:
None

Definition at line 63 of file max5387.cpp.


Member Function Documentation

int16_t write_ch_A ( uint8_t  val )

Write channel A.

On Entry:

Parameters:
[in]val- wiper position of channel A

On Exit:

Returns:
0 on success, non-0 on failure

Definition at line 73 of file max5387.cpp.

int16_t write_ch_AB ( uint8_t  val )

Write channel A&B.

On Entry:

Parameters:
[in]val- wiper position of channel A&B

On Exit:

Returns:
0 on success, non-0 on failure

Definition at line 91 of file max5387.cpp.

int16_t write_ch_B ( uint8_t  val )

Write channel B.

On Entry:

Parameters:
[in]val- wiper position of channel B

On Exit:

Returns:
0 on success, non-0 on failure

Definition at line 82 of file max5387.cpp.