Library for interfacing with the MAX4822 relay driver.

Dependents:   MAXREFDES130_131_Demo MAXREFDES130_Demo

Embed: (wiki syntax)

« Back to documentation index

MAX4822 Class Reference

MAX4822 Class Reference

MAX4822 - +3.3V/+5V, 8-Channel, Relay Drivers with Fast Recovery Time and Power-Save Mode. More...

#include <MAX4822.h>

Public Member Functions

 MAX4822 (SPI &spi_bus, PinName cs=D10, uint8_t num_devices=0)
 MAX4822 Constructor.
 ~MAX4822 ()
 MAX4822 Destructor.
CmdResult set_all_relays (DigitalOut &set, uint8_t device=0)
 Sets all relays of device connected to set.
CmdResult reset_all_relays (DigitalOut &reset, uint8_t device=0)
 Resets all relays of device connected to reset.
CmdResult set_relay (RelayChannel r, bool send_data=true, uint8_t n=0)
 Sets private relay state and sends it if 'send_data' is true.
CmdResult reset_relay (RelayChannel r, bool send_data=true, uint8_t n=0)
 Clears private relay state and sends it if 'send_data' is true.
CmdResult set_pwr_save (PowerSave pwr_save, bool send_data=true, uint8_t n=0)
 Sets private power save value nd sends it if 'send_data' is true.

Detailed Description

MAX4822 - +3.3V/+5V, 8-Channel, Relay Drivers with Fast Recovery Time and Power-Save Mode.

The MAX4822–MAX4825 8-channel relay drivers offer built-in kickback protection and drive +3V/+5V nonlatching or dual-coil-latching relays. Each independent open-drain output features a 2.7Ω (typ) on-resistance and is guaranteed to sink 70mA (min) of load current. These devices consume less than 300µA (max) quiescent current and have 1µA output off-leakage current. A Zener-kickback-protection circuit significantly reduces recovery time in applications where switching speed is critical.

Definition at line 52 of file MAX4822.h.


Constructor & Destructor Documentation

MAX4822 ( SPI &  spi_bus,
PinName  cs = D10,
uint8_t  num_devices = 0 
)

MAX4822 Constructor.

Parameters:
[in]spi_bus- reference to SPI bus for this device
[in]cs- Pin connected to chip select of this device
[in]num_devices- Number of daisychained devices; defaults to 0.

Definition at line 36 of file MAX4822.cpp.

~MAX4822 (  )

MAX4822 Destructor.

Definition at line 55 of file MAX4822.cpp.


Member Function Documentation

MAX4822::CmdResult reset_all_relays ( DigitalOut &  reset,
uint8_t  device = 0 
)

Resets all relays of device connected to reset.

Parameters:
[in]reset- Pin connected to RESET pin of device
[in]device- Device number in daisychain mode, defaults to 0
Returns:
Result of operation.

Definition at line 78 of file MAX4822.cpp.

MAX4822::CmdResult reset_relay ( RelayChannel  r,
bool  send_data = true,
uint8_t  n = 0 
)

Clears private relay state and sends it if 'send_data' is true.

Parameters:
[in]r- Relay to reset
[in]send_data- Default value is true. If false, private array is updated appropriately. This allows the user to update the data array and then send all data on last update.
[in]n- MAX4822 device in daisychained mode; defaults to 0.
Returns:
Result of operation.

Definition at line 125 of file MAX4822.cpp.

MAX4822::CmdResult set_all_relays ( DigitalOut &  set,
uint8_t  device = 0 
)

Sets all relays of device connected to set.

Parameters:
[in]set- Pin connected to SET pin of device
[in]device- Device number in daisychain mode, defaults to 0
Returns:
Result of operation.

Definition at line 60 of file MAX4822.cpp.

MAX4822::CmdResult set_pwr_save ( PowerSave  pwr_save,
bool  send_data = true,
uint8_t  n = 0 
)

Sets private power save value nd sends it if 'send_data' is true.

Parameters:
[in]pwr_save- Power save value
[in]send_data- Default value is true. If false, private array is updated appropriately. This allows the user to update the data array and then send all data on last update.
[in]n- MAX4822 device in daisychained mode; defaults to 0.
Returns:
Result of operation.

Definition at line 153 of file MAX4822.cpp.

MAX4822::CmdResult set_relay ( RelayChannel  r,
bool  send_data = true,
uint8_t  n = 0 
)

Sets private relay state and sends it if 'send_data' is true.

Parameters:
[in]r- Relay to set
[in]send_data- Default value is true. If false, private array is updated appropriately. This allows the user to update the data array and then send all data on last update.
[in]n- MAX4822 device in daisychained mode; defaults to 0.
Returns:
Result of operation.

Definition at line 97 of file MAX4822.cpp.