MAXREFDES89#, MAX14871 MBED Shield  version: 0.0
MBED Shield for evaluating the MAX14871
 All Classes Files Functions Variables Enumerations Enumerator Macros
Max7300 Class Reference

#include <max7300.h>

Public Types

enum  max7300_i2c_adrs_t {
  MAX7300_I2C_ADRS0 = 0x40, MAX7300_I2C_ADRS1, MAX7300_I2C_ADRS2, MAX7300_I2C_ADRS3,
  MAX7300_I2C_ADRS4, MAX7300_I2C_ADRS5, MAX7300_I2C_ADRS6, MAX7300_I2C_ADRS7,
  MAX7300_I2C_ADRS8, MAX7300_I2C_ADRS9, MAX7300_I2C_ADRS10, MAX7300_I2C_ADRS11,
  MAX7300_I2C_ADRS12, MAX7300_I2C_ADRS13, MAX7300_I2C_ADRS14, MAX7300_I2C_ADRS15
}
 
enum  max7300_port_type_t { MAX7300_PORT_OUTPUT = 1, MAX7300_PORT_INPUT, MAX7300_PORT_INPUT_PULLUP }
 
enum  max7300_port_number_t {
  MAX7300_PORT_04 = 4, MAX7300_PORT_05, MAX7300_PORT_06, MAX7300_PORT_07,
  MAX7300_PORT_08, MAX7300_PORT_09, MAX7300_PORT_10, MAX7300_PORT_11,
  MAX7300_PORT_12, MAX7300_PORT_13, MAX7300_PORT_14, MAX7300_PORT_15,
  MAX7300_PORT_16, MAX7300_PORT_17, MAX7300_PORT_18, MAX7300_PORT_19,
  MAX7300_PORT_20, MAX7300_PORT_21, MAX7300_PORT_22, MAX7300_PORT_23,
  MAX7300_PORT_24, MAX7300_PORT_25, MAX7300_PORT_26, MAX7300_PORT_27,
  MAX7300_PORT_28, MAX7300_PORT_29, MAX7300_PORT_30, MAX7300_PORT_31
}
 

Public Member Functions

 Max7300 (I2C *i2c_bus, max7300_i2c_adrs_t i2c_adrs)
 Constructor for Max7300 Class. More...
 
 Max7300 (PinName sda, PinName scl, max7300_i2c_adrs_t i2c_adrs)
 Constructor for Max7300 Class. More...
 
 ~Max7300 ()
 Default destructor for Max7300 Class. More...
 
int16_t enable_ports (void)
 Enables MAX7300 GPIO Ports. More...
 
int16_t disable_ports (void)
 Disables MAX7300 GPIO Ports. More...
 
int16_t enable_transition_detection (void)
 Enables Transition Detection. More...
 
int16_t disable_transition_detection (void)
 Disables Transition Detection. More...
 
int16_t config_port (max7300_port_number_t port_num, max7300_port_type_t port_type)
 Configures a single MAX7300 GPIO port. More...
 
int16_t config_4_ports (max7300_port_number_t low_port, uint8_t data)
 Configure 4 MAX7300 GPIO ports. More...
 
int16_t config_all_ports (max7300_port_type_t port_type)
 Configures all MAX7300 GPIO ports. More...
 
int16_t read_port (max7300_port_number_t port_num)
 Read a single MAX7300 GPIO port. More...
 
int16_t write_port (max7300_port_number_t port_num, uint8_t data)
 Write a single MAX7300 GPIO port. More...
 
int16_t read_8_ports (max7300_port_number_t low_port)
 Read 8 MAX7300 GPIO ports. More...
 
int16_t write_8_ports (max7300_port_number_t low_port, uint8_t data)
 Write 8 MAX7300 GPIO ports. More...
 
int16_t read_mask_register (bool enable_snapshot)
 Read transition detection mask register. More...
 
int16_t write_mask_register (uint8_t data)
 Write transition detection mask register. More...
 

Member Enumeration Documentation

Enumerator
MAX7300_I2C_ADRS0 
MAX7300_I2C_ADRS1 
MAX7300_I2C_ADRS2 
MAX7300_I2C_ADRS3 
MAX7300_I2C_ADRS4 
MAX7300_I2C_ADRS5 
MAX7300_I2C_ADRS6 
MAX7300_I2C_ADRS7 
MAX7300_I2C_ADRS8 
MAX7300_I2C_ADRS9 
MAX7300_I2C_ADRS10 
MAX7300_I2C_ADRS11 
MAX7300_I2C_ADRS12 
MAX7300_I2C_ADRS13 
MAX7300_I2C_ADRS14 
MAX7300_I2C_ADRS15 
Enumerator
MAX7300_PORT_04 
MAX7300_PORT_05 
MAX7300_PORT_06 
MAX7300_PORT_07 
MAX7300_PORT_08 
MAX7300_PORT_09 
MAX7300_PORT_10 
MAX7300_PORT_11 
MAX7300_PORT_12 
MAX7300_PORT_13 
MAX7300_PORT_14 
MAX7300_PORT_15 
MAX7300_PORT_16 
MAX7300_PORT_17 
MAX7300_PORT_18 
MAX7300_PORT_19 
MAX7300_PORT_20 
MAX7300_PORT_21 
MAX7300_PORT_22 
MAX7300_PORT_23 
MAX7300_PORT_24 
MAX7300_PORT_25 
MAX7300_PORT_26 
MAX7300_PORT_27 
MAX7300_PORT_28 
MAX7300_PORT_29 
MAX7300_PORT_30 
MAX7300_PORT_31 
Enumerator
MAX7300_PORT_OUTPUT 
MAX7300_PORT_INPUT 
MAX7300_PORT_INPUT_PULLUP 

Constructor & Destructor Documentation

Max7300::Max7300 ( I2C *  i2c_bus,
max7300_i2c_adrs_t  i2c_adrs 
)

Constructor for Max7300 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 MAX7300

On Exit:

Returns
none
Max7300::Max7300 ( PinName  sda,
PinName  scl,
max7300_i2c_adrs_t  i2c_adrs 
)

Constructor for Max7300 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 MAX7300

On Exit:

Returns
none
Max7300::~Max7300 ( )

Default destructor for Max7300 Class.

Destroys I2C object if owner

On Entry:

On Exit:

Returns
none

Member Function Documentation

int16_t Max7300::config_4_ports ( max7300_port_number_t  low_port,
uint8_t  data 
)

Configure 4 MAX7300 GPIO ports.

Allows user to configure 4 ports at a time

On Entry:

Parameters
[in]low_port- lowest of 4 ports to configure, on 4 port boundaries as in datasheet
[in]data- Byte with each ports desired type with the following format - xx|xx|xx|xx

On Exit:

Returns
0 on success, non-0 on failure
int16_t Max7300::config_all_ports ( max7300_port_type_t  port_type)

Configures all MAX7300 GPIO ports.

Allows user to configure all ports to a single type

On Entry:

Parameters
[in]port_type- One of the following port types MAX7300_PORT_OUTPUT MAX7300_PORT_INPUT MAX7300_PORT_INPUT_PULLUP

On Exit:

Returns
0 on success, non-0 on failure
int16_t Max7300::config_port ( max7300_port_number_t  port_num,
max7300_port_type_t  port_type 
)

Configures a single MAX7300 GPIO port.

Configures MAX7300 GPIO port as either an output, input, or input with pullup.

On Entry:

Parameters
[in]port_num- GPIO port to configure
[in]port_type- One of the following port types MAX7300_PORT_OUTPUT MAX7300_PORT_INPUT MAX7300_PORT_INPUT_PULLUP

On Exit:

Returns
0 on success, non-0 on failure
int16_t Max7300::disable_ports ( void  )

Disables MAX7300 GPIO Ports.

Clears 'S' bit of configuration register

On Entry:

On Exit:

Returns
0 on success, non-0 on failure
int16_t Max7300::disable_transition_detection ( void  )

Disables Transition Detection.

Clears 'M' bit of configuration register

On Entry:

On Exit:

Returns
0 on success, non-0 on failure
int16_t Max7300::enable_ports ( void  )

Enables MAX7300 GPIO Ports.

Sets 'S' bit of configuration register

On Entry:

On Exit:

Returns
0 on success, non-0 on failure
int16_t Max7300::enable_transition_detection ( void  )

Enables Transition Detection.

Sets 'M' bit of configuration register

On Entry:

On Exit:

Returns
0 on success, non-0 on failure
int16_t Max7300::read_8_ports ( max7300_port_number_t  low_port)

Read 8 MAX7300 GPIO ports.

On Entry:

Parameters
[in]low_port- lowest port of 8 ports to read, on 8 port boundaries as in datasheet. Max is port 24

On Exit:

Returns
state of ports, or -1 on failure
int16_t Max7300::read_mask_register ( bool  enable_snapshot)

Read transition detection mask register.

See page 11 of DS, right hand side column, paragraph 2 for details on one-shot event.

On Entry:

Parameters
[in]enable_snapshot- true to re-enable transition detection

On Exit:

Returns
contents of mask register, or -1 on failure
int16_t Max7300::read_port ( max7300_port_number_t  port_num)

Read a single MAX7300 GPIO port.

On Entry:

Parameters
[in]port_num- MAX7300 port number to read

On Exit:

Returns
state of port, or -1 on failure
int16_t Max7300::write_8_ports ( max7300_port_number_t  low_port,
uint8_t  data 
)

Write 8 MAX7300 GPIO ports.

On Entry:

Parameters
[in]low_port- lowest port of 8 ports to write, on 8 port boundaries as in datasheet. Max is port 24
[in]data- Data is written to ports

On Exit:

Returns
0 on success, non-0 on failure
int16_t Max7300::write_mask_register ( uint8_t  data)

Write transition detection mask register.

Enables transition detection on Ports 30-24

On Entry:

Parameters
[in]data- Bits to set

On Exit:

Returns
0 on success, non-0 on failure
int16_t Max7300::write_port ( max7300_port_number_t  port_num,
uint8_t  data 
)

Write a single MAX7300 GPIO port.

On Entry:

Parameters
[in]port_num- MAX7300 port to write
[in]data- lsb of byte is written to port

On Exit:

Returns
0 on success, non-0 on failure

The documentation for this class was generated from the following files: