no-OS
Loading...
Searching...
No Matches
max14916.h File Reference

Header file of MAX14916 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 max14916.h:

Macros

#define MAX14916_CHANNELS   8
 
#define MAX14916_SETOUT_REG   0x0
 
#define MAX14916_SET_FLED_REG   0x1
 
#define MAX14916_SET_SLED_REG   0x2
 
#define MAX14916_INT_REG   0x3
 
#define MAX14916_OVR_LD_REG   0x4
 
#define MAX14916_CURR_LIM_REG   0x5
 
#define MAX14916_OW_OFF_FAULT_REG   0x6
 
#define MAX14916_OW_ON_FAULT_REG   0x7
 
#define MAX14916_SHD_VDD_FAULT_REG   0x8
 
#define MAX14916_GLOB_ERR_REG   0x9
 
#define MAX14916_OW_OFF_EN_REG   0xA
 
#define MAX14916_OW_ON_EN_REG   0xB
 
#define MAX14916_SHD_VDD_EN_REG   0xC
 
#define MAX14916_CONFIG1_REG   0xD
 
#define MAX14916_CONFIG2_REG   0xE
 
#define MAX14916_MASK_REG   0xF
 
#define MAX14916_SETOUT_MASK(x)
 
#define MAX14916_SLED_CH_MASK(x)
 
#define MAX14916_SLED_MASK   NO_OS_BIT(1)
 
#define MAX14916_FLED_MASK   NO_OS_BIT(0)
 
#define MAX14916_FLED_STRETCH_MASK   NO_OS_GENMASK(2, 1)
 
#define MAX14916_WD_MASK   NO_OS_GENMASK(7, 6)
 
#define MAX14916_OW_OFF_CS_MASK   NO_OS_GENMASK(5, 4)
 
#define MAX14916_SHT_VDD_THR_MASK   NO_OS_GENMASK(3, 2)
 

Enumerations

enum  max14916_fled_time {
  MAX14916_FLED_TIME_DISABLED ,
  MAX14916_FLED_TIME_1S ,
  MAX14916_FLED_TIME_2S ,
  MAX14916_FLED_TIME_3S
}
 
enum  max14916_sled_state {
  MAX14916_SLED_OFF ,
  MAX14916_SLED_ON
}
 
enum  max14916_wd {
  MAX14916_WD_DISABLED ,
  MAX14916_WD_200MS ,
  MAX14916_WD_600MS ,
  MAX14916_WD_1200MS
}
 
enum  max14916_ow_off_cs {
  MAX14916_OW_OFF_CS_20UA ,
  MAX14916_OW_OFF_CS_100UA ,
  MAX14916_OW_OFF_CS_300UA ,
  MAX14916_OW_OFF_CS_600UA
}
 
enum  max14916_sht_vdd_thr {
  MAX14916_SHT_VDD_THR_9V ,
  MAX14916_SHT_VDD_THR_10V ,
  MAX14916_SHT_VDD_THR_12V ,
  MAX14916_SHT_VDD_THR_14V
}
 

Functions

int max14916_ch_get (struct max149x6_desc *, uint32_t, uint32_t *)
 Read the high-side state of a channel's switch.
 
int max14916_ch_set (struct max149x6_desc *, uint32_t, uint32_t)
 Write the (logic) state of a channel (on/off).
 
int max14916_sled_set (struct max149x6_desc *, uint32_t, enum max14916_sled_state)
 Read an output channel's current limit.
 
int max14916_fled_time_set (struct max149x6_desc *, enum max14916_fled_time)
 Set FLEDs minimum on-time to requested value.
 
int max14916_set_wd (struct max149x6_desc *, enum max14916_wd)
 Set watchdog timeout in the config2 register.
 
int max14916_set_ow_off (struct max149x6_desc *, enum max14916_ow_off_cs)
 Set current magnitude for the ow off in the config2 register.
 
int max14916_set_sht_vdd_thr (struct max149x6_desc *, enum max14916_sht_vdd_thr)
 Set short to vdd threshold in the config2 register.
 
int max14916_init (struct max149x6_desc **, struct max149x6_init_param *)
 Initialize and configure the MAX14916 device.
 
int max14916_remove (struct max149x6_desc *)
 Free the resources allocated during init.
 

Detailed Description

Header file of MAX14916 Driver.

Author
Radu Sabau (radu..nosp@m.saba.nosp@m.u@ana.nosp@m.log..nosp@m.com)

Copyright 2023(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ MAX14916_CHANNELS

#define MAX14916_CHANNELS   8

◆ MAX14916_CONFIG1_REG

#define MAX14916_CONFIG1_REG   0xD

◆ MAX14916_CONFIG2_REG

#define MAX14916_CONFIG2_REG   0xE

◆ MAX14916_CURR_LIM_REG

#define MAX14916_CURR_LIM_REG   0x5

◆ MAX14916_FLED_MASK

#define MAX14916_FLED_MASK   NO_OS_BIT(0)

◆ MAX14916_FLED_STRETCH_MASK

#define MAX14916_FLED_STRETCH_MASK   NO_OS_GENMASK(2, 1)

◆ MAX14916_GLOB_ERR_REG

#define MAX14916_GLOB_ERR_REG   0x9

◆ MAX14916_INT_REG

#define MAX14916_INT_REG   0x3

◆ MAX14916_MASK_REG

#define MAX14916_MASK_REG   0xF

◆ MAX14916_OVR_LD_REG

#define MAX14916_OVR_LD_REG   0x4

◆ MAX14916_OW_OFF_CS_MASK

#define MAX14916_OW_OFF_CS_MASK   NO_OS_GENMASK(5, 4)

◆ MAX14916_OW_OFF_EN_REG

#define MAX14916_OW_OFF_EN_REG   0xA

◆ MAX14916_OW_OFF_FAULT_REG

#define MAX14916_OW_OFF_FAULT_REG   0x6

◆ MAX14916_OW_ON_EN_REG

#define MAX14916_OW_ON_EN_REG   0xB

◆ MAX14916_OW_ON_FAULT_REG

#define MAX14916_OW_ON_FAULT_REG   0x7

◆ MAX14916_SET_FLED_REG

#define MAX14916_SET_FLED_REG   0x1

◆ MAX14916_SET_SLED_REG

#define MAX14916_SET_SLED_REG   0x2

◆ MAX14916_SETOUT_MASK

#define MAX14916_SETOUT_MASK ( x)
Value:
#define NO_OS_BIT(x)
Definition no_os_util.h:23

◆ MAX14916_SETOUT_REG

#define MAX14916_SETOUT_REG   0x0

◆ MAX14916_SHD_VDD_EN_REG

#define MAX14916_SHD_VDD_EN_REG   0xC

◆ MAX14916_SHD_VDD_FAULT_REG

#define MAX14916_SHD_VDD_FAULT_REG   0x8

◆ MAX14916_SHT_VDD_THR_MASK

#define MAX14916_SHT_VDD_THR_MASK   NO_OS_GENMASK(3, 2)

◆ MAX14916_SLED_CH_MASK

#define MAX14916_SLED_CH_MASK ( x)
Value:

◆ MAX14916_SLED_MASK

#define MAX14916_SLED_MASK   NO_OS_BIT(1)

◆ MAX14916_WD_MASK

#define MAX14916_WD_MASK   NO_OS_GENMASK(7, 6)

Enumeration Type Documentation

◆ max14916_fled_time

Enumerator
MAX14916_FLED_TIME_DISABLED 
MAX14916_FLED_TIME_1S 
MAX14916_FLED_TIME_2S 
MAX14916_FLED_TIME_3S 

◆ max14916_ow_off_cs

Enumerator
MAX14916_OW_OFF_CS_20UA 
MAX14916_OW_OFF_CS_100UA 
MAX14916_OW_OFF_CS_300UA 
MAX14916_OW_OFF_CS_600UA 

◆ max14916_sht_vdd_thr

Enumerator
MAX14916_SHT_VDD_THR_9V 
MAX14916_SHT_VDD_THR_10V 
MAX14916_SHT_VDD_THR_12V 
MAX14916_SHT_VDD_THR_14V 

◆ max14916_sled_state

Enumerator
MAX14916_SLED_OFF 
MAX14916_SLED_ON 

◆ max14916_wd

Enumerator
MAX14916_WD_DISABLED 
MAX14916_WD_200MS 
MAX14916_WD_600MS 
MAX14916_WD_1200MS 

Function Documentation

◆ max14916_ch_get()

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

Read the high-side state of a channel's switch.

Read the state of a channel

Parameters
desc- device descriptor for the MAX14916.
ch- channel index (0 based).
val- binary value representing a channel's high-side switc state.
Returns
0 in case of success, negative error code otherwise.

◆ max14916_ch_set()

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

Write the (logic) state of a channel (on/off).

Set the state of a channel

Parameters
desc- device descriptor for the MAX14916.
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.

◆ max14916_fled_time_set()

int max14916_fled_time_set ( struct max149x6_desc * desc,
enum max14916_fled_time fled_time )

Set FLEDs minimum on-time to requested value.

Set minimum on-time for the fault LEDs.

Parameters
desc- device descriptor for the MAX14916.
fled_time- minimum on-time for the FLEDs to be set.
Returns
0 in case of succes, negative error code otherwise.

◆ max14916_init()

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

Initialize and configure the MAX14916 device.

Initialize and configure the MAX14916 device

Parameters
desc- device descriptor for the MAX14916 that will be initialized.
param- initialization parameter for the device.
Returns
0 in case of success, negative error code otherwise.

◆ max14916_remove()

int max14916_remove ( struct max149x6_desc * desc)

Free the resources allocated during init.

Free the resources allocated during init.

Parameters
desc- device descriptor for the MAX14916 that will be initialized.
Returns
0 in case of success, negative error code otherwise.

◆ max14916_set_ow_off()

int max14916_set_ow_off ( struct max149x6_desc * desc,
enum max14916_ow_off_cs ow_off_cs )

Set current magnitude for the ow off in the config2 register.

Set current magnitude for the MAX14916 device current source.

Parameters
desc- device descriptor for the MAX14916.
ow_off_cs- current magnitude to be set.
Returns
0 in case of succes, negative error code otherwise.

◆ max14916_set_sht_vdd_thr()

int max14916_set_sht_vdd_thr ( struct max149x6_desc * desc,
enum max14916_sht_vdd_thr sht_vdd_thr )

Set short to vdd threshold in the config2 register.

Set threshold for short to vdd for the MAX14916 device.

Parameters
desc- device descriptor for the MAX14916.
sht_vdd_thr- threshold to be set.
Returns
0 in case of succes, negative error code otherwise.

◆ max14916_set_wd()

int max14916_set_wd ( struct max149x6_desc * desc,
enum max14916_wd wd )

Set watchdog timeout in the config2 register.

Set watchdog timeout for the MAX14916 device.

Parameters
desc- device descriptor for the MAX14916.
wd- watchdog timer to be selected.
Returns
0 in case of succes, negative error code otherwise.

◆ max14916_sled_set()

int max14916_sled_set ( struct max149x6_desc * desc,
uint32_t ch,
enum max14916_sled_state state )

Read an output channel's current limit.

Set SLED to on/off

Parameters
desc- device descriptor for the MAX14916.
ch- channel index (0 based).
state- status led state.
Returns
0 in case of success, negative error code otherwise.

SLEDSet bit needs to be set to 1 in config1 register in order to change the SLED state.