no-OS
Macros | Enumerations | Functions
max14906.h File Reference

Header file of MAX14906 Driver. More...

#include <stdint.h>
#include <stdbool.h>
#include "max149x6-base.h"
#include "no_os_gpio.h"
#include "no_os_spi.h"
#include "no_os_util.h"
Include dependency graph for max14906.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MAX14906_CHANNELS   4
 
#define MAX14906_SETOUT_REG   0x0
 
#define MAX14906_SETLED_REG   0x1
 
#define MAX14906_DOILEVEL_REG   0x2
 
#define MAX14906_INT_REG   0x3
 
#define MAX14906_OVR_LD_REG   0x4
 
#define MAX14906_OPN_WIR_FLT_REG   0x5
 
#define MAX14906_SHD_VDD_FLT_REG   0x6
 
#define MAX14906_GLOBAL_FLT_REG   0x7
 
#define MAX14906_CONFIG1_REG   0xA
 
#define MAX14906_CONFIG2_REG   0xB
 
#define MAX14906_CONFIG_DI_REG   0xC
 
#define MAX14906_CONFIG_DO_REG   0xD
 
#define MAX14906_CONFIG_CURR_LIM   0xE
 
#define MAX14906_CONFIG_MASK   0xF
 
#define MAX14906_DOI_LEVEL_MASK(x)   NO_OS_BIT(x)
 
#define MAX14906_HIGHO_MASK(x)   NO_OS_BIT(x)
 
#define MAX14906_DO_MASK(x)   (NO_OS_GENMASK(1, 0) << (2 * (x)))
 
#define MAX14906_CH_DIR_MASK(x)   NO_OS_BIT((x) + 4)
 
#define MAX14906_CH(x)   (x)
 
#define MAX14906_IEC_TYPE_MASK   NO_OS_BIT(7)
 
#define MAX14906_CL_MASK(x)   (NO_OS_GENMASK(1, 0) << (2 * (x)))
 
#define MAX14906_SLED_MASK   NO_OS_BIT(1)
 
#define MAX14906_FLED_MASK   NO_OS_BIT(0)
 

Enumerations

enum  max14906_iec_type {
  MAX14906_TYPE_1_3,
  MAX14906_TYPE_2
}
 
enum  max14906_function {
  MAX14906_OUT,
  MAX14906_IN,
  MAX14906_HIGH_Z
}
 Channel configuration options. More...
 
enum  max14906_do_mode {
  MAX14906_HIGH_SIDE,
  MAX14906_HIGH_SIDE_INRUSH,
  MAX14906_PUSH_PULL_CLAMP,
  MAX14906_PUSH_PULL
}
 Configuration options for the output driver (on each channel). More...
 
enum  max14906_climit {
  MAX14906_CL_600,
  MAX14906_CL_130,
  MAX14906_CL_300,
  MAX14906_CL_1200
}
 Current limit options for output channels. More...
 

Functions

int max14906_ch_get (struct max149x6_desc *, uint32_t, uint32_t *)
 Read the (voltage) state of a channel (works for both input or output). More...
 
int max14906_ch_set (struct max149x6_desc *, uint32_t, uint32_t)
 Write the (logic) state of a channel (only for output channels). More...
 
int max14906_ch_func (struct max149x6_desc *, uint32_t, enum max14906_function)
 Configure a channel's function. More...
 
int max14906_climit_set (struct max149x6_desc *, uint32_t, enum max14906_climit)
 Configure the current limit for output channels. More...
 
int max14906_climit_get (struct max149x6_desc *, uint32_t, enum max14906_climit *)
 Read an output channel's current limit. More...
 
int max14906_init (struct max149x6_desc **, struct max149x6_init_param *)
 Initialize and configure the MAX14906 device. More...
 
int max14906_remove (struct max149x6_desc *)
 Free the resources allocated during init and place all the channels in high-z. More...
 

Detailed Description

Header file of MAX14906 Driver.

Author
Ciprian Regus (cipri.nosp@m.an.r.nosp@m.egus@.nosp@m.anal.nosp@m.og.co.nosp@m.m)

Copyright 2023(c) Analog Devices, Inc.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Macro Definition Documentation

◆ MAX14906_CH

#define MAX14906_CH (   x)    (x)

◆ MAX14906_CH_DIR_MASK

#define MAX14906_CH_DIR_MASK (   x)    NO_OS_BIT((x) + 4)

◆ MAX14906_CHANNELS

#define MAX14906_CHANNELS   4

◆ MAX14906_CL_MASK

#define MAX14906_CL_MASK (   x)    (NO_OS_GENMASK(1, 0) << (2 * (x)))

◆ MAX14906_CONFIG1_REG

#define MAX14906_CONFIG1_REG   0xA

◆ MAX14906_CONFIG2_REG

#define MAX14906_CONFIG2_REG   0xB

◆ MAX14906_CONFIG_CURR_LIM

#define MAX14906_CONFIG_CURR_LIM   0xE

◆ MAX14906_CONFIG_DI_REG

#define MAX14906_CONFIG_DI_REG   0xC

◆ MAX14906_CONFIG_DO_REG

#define MAX14906_CONFIG_DO_REG   0xD

◆ MAX14906_CONFIG_MASK

#define MAX14906_CONFIG_MASK   0xF

◆ MAX14906_DO_MASK

#define MAX14906_DO_MASK (   x)    (NO_OS_GENMASK(1, 0) << (2 * (x)))

◆ MAX14906_DOI_LEVEL_MASK

#define MAX14906_DOI_LEVEL_MASK (   x)    NO_OS_BIT(x)

◆ MAX14906_DOILEVEL_REG

#define MAX14906_DOILEVEL_REG   0x2

◆ MAX14906_FLED_MASK

#define MAX14906_FLED_MASK   NO_OS_BIT(0)

◆ MAX14906_GLOBAL_FLT_REG

#define MAX14906_GLOBAL_FLT_REG   0x7

◆ MAX14906_HIGHO_MASK

#define MAX14906_HIGHO_MASK (   x)    NO_OS_BIT(x)

◆ MAX14906_IEC_TYPE_MASK

#define MAX14906_IEC_TYPE_MASK   NO_OS_BIT(7)

◆ MAX14906_INT_REG

#define MAX14906_INT_REG   0x3

◆ MAX14906_OPN_WIR_FLT_REG

#define MAX14906_OPN_WIR_FLT_REG   0x5

◆ MAX14906_OVR_LD_REG

#define MAX14906_OVR_LD_REG   0x4

◆ MAX14906_SETLED_REG

#define MAX14906_SETLED_REG   0x1

◆ MAX14906_SETOUT_REG

#define MAX14906_SETOUT_REG   0x0

◆ MAX14906_SHD_VDD_FLT_REG

#define MAX14906_SHD_VDD_FLT_REG   0x6

◆ MAX14906_SLED_MASK

#define MAX14906_SLED_MASK   NO_OS_BIT(1)

Enumeration Type Documentation

◆ max14906_climit

Current limit options for output channels.

Enumerator
MAX14906_CL_600 
MAX14906_CL_130 
MAX14906_CL_300 
MAX14906_CL_1200 

◆ max14906_do_mode

Configuration options for the output driver (on each channel).

Enumerator
MAX14906_HIGH_SIDE 
MAX14906_HIGH_SIDE_INRUSH 
MAX14906_PUSH_PULL_CLAMP 
MAX14906_PUSH_PULL 

◆ max14906_function

Channel configuration options.

Enumerator
MAX14906_OUT 
MAX14906_IN 
MAX14906_HIGH_Z 

◆ max14906_iec_type

Enumerator
MAX14906_TYPE_1_3 
MAX14906_TYPE_2 

Function Documentation

◆ max14906_ch_func()

int max14906_ch_func ( struct max149x6_desc desc,
uint32_t  ch,
enum max14906_function  function 
)

Configure a channel's function.

Configure a channel's function

Parameters
desc- device descriptor for the MAX14906
ch- channel index (0 based).
function- channel configuration (input, output or high-z).
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ max14906_ch_get()

int max14906_ch_get ( struct max149x6_desc desc,
uint32_t  ch,
uint32_t *  val 
)

Read the (voltage) state of a channel (works for both input or output).

Read the state of a channel

Parameters
desc- device descriptor for the MAX14906
ch- channel index (0 based).
val- binary value representing a channel's voltage level (0 or 1).
Returns
0 in case of success, negative error code otherwise

◆ max14906_ch_set()

int max14906_ch_set ( struct max149x6_desc desc,
uint32_t  ch,
uint32_t  val 
)

Write the (logic) state of a channel (only for output channels).

Set the state of a channel

Parameters
desc- device descriptor for the MAX14906
ch- channel index (0 based).
val- binary value representing a channel's voltage level (0 or 1).
Returns
0 in case of success, negative error code otherwise

◆ max14906_climit_get()

int max14906_climit_get ( struct max149x6_desc desc,
uint32_t  ch,
enum max14906_climit climit 
)

Read an output channel's current limit.

Read an output channel's current limit

Parameters
desc- device descriptor for the MAX14906
ch- channel index (0 based).
climit- current limit value.
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ max14906_climit_set()

int max14906_climit_set ( struct max149x6_desc desc,
uint32_t  ch,
enum max14906_climit  climit 
)

Configure the current limit for output channels.

Configure the current limit for output channels

Parameters
desc- device descriptor for the MAX14906
ch- channel index (0 based).
climit- current limit value.
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ max14906_init()

int max14906_init ( struct max149x6_desc **  desc,
struct max149x6_init_param param 
)

Initialize and configure the MAX14906 device.

Initialize and configure the MAX14906 device

Parameters
desc- device descriptor for the MAX14906 that will be initialized.
param- initialization parameter for the device.
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ max14906_remove()

int max14906_remove ( struct max149x6_desc desc)

Free the resources allocated during init and place all the channels in high-z.

Free the resources allocated during init and place all the channels in high-z.

Parameters
desc- device descriptor for the MAX14906 that will be initialized.
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function: