no-OS
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
max14916.h
Go to the documentation of this file.
1/***************************************************************************/
33#ifndef _MAX14916_H
34#define _MAX14916_H
35
36#include <stdint.h>
37#include <stdbool.h>
38#include "max149x6-base.h"
39#include "no_os_gpio.h"
40#include "no_os_spi.h"
41#include "no_os_util.h"
42
43#define MAX14916_CHANNELS 8
44
45#define MAX14916_SETOUT_REG 0x0
46#define MAX14916_SET_FLED_REG 0x1
47#define MAX14916_SET_SLED_REG 0x2
48#define MAX14916_INT_REG 0x3
49#define MAX14916_OVR_LD_REG 0x4
50#define MAX14916_CURR_LIM_REG 0x5
51#define MAX14916_OW_OFF_FAULT_REG 0x6
52#define MAX14916_OW_ON_FAULT_REG 0x7
53#define MAX14916_SHD_VDD_FAULT_REG 0x8
54#define MAX14916_GLOB_ERR_REG 0x9
55#define MAX14916_OW_OFF_EN_REG 0xA
56#define MAX14916_OW_ON_EN_REG 0xB
57#define MAX14916_SHD_VDD_EN_REG 0xC
58#define MAX14916_CONFIG1_REG 0xD
59#define MAX14916_CONFIG2_REG 0xE
60#define MAX14916_MASK_REG 0xF
61
62#define MAX14916_SETOUT_MASK(x) NO_OS_BIT(x)
63#define MAX14916_SLED_CH_MASK(x) NO_OS_BIT(x)
64#define MAX14916_SLED_MASK NO_OS_BIT(1)
65#define MAX14916_FLED_MASK NO_OS_BIT(0)
66#define MAX14916_FLED_STRETCH_MASK NO_OS_GENMASK(2, 1)
67#define MAX14916_WD_MASK NO_OS_GENMASK(7, 6)
68#define MAX14916_OW_OFF_CS_MASK NO_OS_GENMASK(5, 4)
69#define MAX14916_SHT_VDD_THR_MASK NO_OS_GENMASK(3, 2)
70
77
82
89
96
103
105int max14916_ch_get(struct max149x6_desc *, uint32_t, uint32_t *);
106
108int max14916_ch_set(struct max149x6_desc *, uint32_t, uint32_t);
109
111int max14916_sled_set(struct max149x6_desc *, uint32_t,
113
116
118int max14916_set_wd(struct max149x6_desc *, enum max14916_wd);
119
122
125
127int max14916_init(struct max149x6_desc **, struct max149x6_init_param *);
128
130int max14916_remove(struct max149x6_desc *);
131
132#endif
max14916_ow_off_cs
Definition max14916.h:90
@ MAX14916_OW_OFF_CS_600UA
Definition max14916.h:94
@ MAX14916_OW_OFF_CS_300UA
Definition max14916.h:93
@ MAX14916_OW_OFF_CS_20UA
Definition max14916.h:91
@ MAX14916_OW_OFF_CS_100UA
Definition max14916.h:92
int max14916_ch_get(struct max149x6_desc *, uint32_t, uint32_t *)
Read the high-side state of a channel's switch.
Definition max14916.c:47
int max14916_ch_set(struct max149x6_desc *, uint32_t, uint32_t)
Write the (logic) state of a channel (on/off).
Definition max14916.c:70
int max14916_sled_set(struct max149x6_desc *, uint32_t, enum max14916_sled_state)
Read an output channel's current limit.
Definition max14916.c:90
int max14916_set_sht_vdd_thr(struct max149x6_desc *, enum max14916_sht_vdd_thr)
Set short to vdd threshold in the config2 register.
Definition max14916.c:185
int max14916_init(struct max149x6_desc **, struct max149x6_init_param *)
Initialize and configure the MAX14916 device.
Definition max14916.c:203
max14916_wd
Definition max14916.h:83
@ MAX14916_WD_600MS
Definition max14916.h:86
@ MAX14916_WD_1200MS
Definition max14916.h:87
@ MAX14916_WD_DISABLED
Definition max14916.h:84
@ MAX14916_WD_200MS
Definition max14916.h:85
int max14916_fled_time_set(struct max149x6_desc *, enum max14916_fled_time)
Set FLEDs minimum on-time to requested value.
Definition max14916.c:118
int max14916_remove(struct max149x6_desc *)
Free the resources allocated during init.
Definition max14916.c:315
max14916_fled_time
Definition max14916.h:71
@ MAX14916_FLED_TIME_2S
Definition max14916.h:74
@ MAX14916_FLED_TIME_1S
Definition max14916.h:73
@ MAX14916_FLED_TIME_DISABLED
Definition max14916.h:72
@ MAX14916_FLED_TIME_3S
Definition max14916.h:75
int max14916_set_wd(struct max149x6_desc *, enum max14916_wd)
Set watchdog timeout in the config2 register.
Definition max14916.c:152
max14916_sled_state
Definition max14916.h:78
@ MAX14916_SLED_ON
Definition max14916.h:80
@ MAX14916_SLED_OFF
Definition max14916.h:79
max14916_sht_vdd_thr
Definition max14916.h:97
@ MAX14916_SHT_VDD_THR_12V
Definition max14916.h:100
@ MAX14916_SHT_VDD_THR_10V
Definition max14916.h:99
@ MAX14916_SHT_VDD_THR_9V
Definition max14916.h:98
@ MAX14916_SHT_VDD_THR_14V
Definition max14916.h:101
int max14916_set_ow_off(struct max149x6_desc *, enum max14916_ow_off_cs)
Set current magnitude for the ow off in the config2 register.
Definition max14916.c:167
Header file of MAX149X6 Base Driver.
Header file of GPIO Interface.
Header file of SPI Interface.
Header file of utility functions.
Device descriptor for MAX149X6.
Definition max149x6-base.h:67
Initialization parameter for the MAX149X6 device.
Definition max149x6-base.h:54