Go to the documentation of this file.
42 #define MAX22190_FRAME_SIZE 2
43 #define MAX22190_CHANNELS 8
44 #define MAX22190_FAULT2_ENABLES 5
46 #define MAX22190_WIRE_BREAK_REG 0x0
47 #define MAX22190_DIGITAL_INPUT_REG 0x2
48 #define MAX22190_FAULT1_REG 0x4
49 #define MAX22190_FILTER_IN_REG(x) (0x6 + (2 * (x)))
50 #define MAX22190_CONFIG_REG 0x18
51 #define MAX22190_INPUT_EN_REG 0x1A
52 #define MAX22190_FAULT2_REG 0x1C
53 #define MAX22190_FAULT2_EN_REG 0x1E
54 #define MAX22190_GPO_REG 0x22
55 #define MAX22190_FAULT1_EN_REG 0x24
57 #define MAX22190_NO_OP_REG 0x26
59 #define MAX22190_CH_STATE_MASK(x) NO_OS_BIT(x)
60 #define MAX22190_DELAY_MASK NO_OS_GENMASK(2, 0)
61 #define MAX22190_FBP_MASK NO_OS_BIT(3)
62 #define MAX22190_WBE_MASK NO_OS_BIT(4)
63 #define MAX22190_RW_MASK NO_OS_BIT(7)
64 #define MAX22190_ADDR_MASK NO_OS_GENMASK(6, 0)
65 #define MAX22190_ALARM_MASK NO_OS_GENMASK(4, 3)
66 #define MAX22190_POR_MASK NO_OS_BIT(6)
68 #define MAX22190_FAULT_MASK(x) NO_OS_BIT(x)
69 #define MAX22190_FAULT2_WBE_MASK NO_OS_BIT(4)
71 #define MAX22190_FAULT2_EN_MASK NO_OS_GENMASK(5, 0)
73 #define MAX22190_CFG_REFDI_MASK NO_OS_BIT(0)
74 #define MAX22190_CFG_CLRF_MASK NO_OS_BIT(3)
75 #define MAX22190_CFG_24VF_MASK NO_OS_BIT(4)
int max22190_reg_update(struct max22190_desc *, uint32_t, uint32_t, uint32_t)
Register update function for MAX22190.
Definition: max22190.c:405
@ MAX22190_FAULT2_RFDIOE
Definition: max22190.h:118
#define MAX22190_FAULT2_WBE_MASK
Definition: max22190.h:69
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
#define MAX22190_CFG_CLRF_MASK
Definition: max22190.h:74
int max22190_filter_get(struct max22190_desc *, uint32_t, uint32_t *, uint32_t *, enum max22190_delay *)
Get filter delay, wite break detection and if the filter is used or bypassed.
Definition: max22190.c:125
@ MAX22190_FAULT1_24VLE
Definition: max22190.h:111
#define MAX22190_CONFIG_REG
Definition: max22190.h:50
bool crc_en
Definition: max22190.h:85
int max22190_reg_read(struct max22190_desc *desc, uint32_t addr, uint32_t *val)
Register read function for MAX22190.
Definition: max22190.c:332
@ MAX22190_FAULT2_FAULT8CKE
Definition: max22190.h:120
int max22190_remove(struct max22190_desc *)
Free the resources allocated by initialization.
Definition: max22190.c:485
Header file of SPI Interface.
Definition: max22190.h:88
struct no_os_spi_init_param * comm_param
Definition: max22190.h:83
@ MAX22190_FAULT1_WBGE
Definition: max22190.h:109
@ MAX22190_DELAY_400US
Definition: max22190.h:100
int max22190_chan_state(struct max22190_desc *, uint32_t, enum max22190_ch_state)
Switch selected channel's state to disabled or enabled.
Definition: max22190.c:157
int max22190_fault_enable_get(struct max22190_desc *desc, enum max22190_fault_enable fault_enable, bool *enabled)
Get fault enable from the fault registers.
Definition: max22190.c:225
uint8_t buff[MAX22190_FRAME_SIZE+1]
Definition: max22190.h:91
int max22190_fault_enable_set(struct max22190_desc *desc, enum max22190_fault_enable fault_enable, bool enabled)
Set fault enable in the fault registers.
Definition: max22190.c:273
#define MAX22190_CFG_24VF_MASK
Definition: max22190.h:75
@ MAX22190_DELAY_1800US
Definition: max22190.h:102
Definition: no_os_spi.h:100
int max22190_wbe_get(struct max22190_desc *, uint32_t, bool *)
Get Wire Break detection for requested channel.
Definition: max22190.c:183
bool crc_en
Definition: max22190.h:94
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:117
@ MAX22190_DELAY_50US
Definition: max22190.h:98
#define MAX22190_ADDR_MASK
Definition: max22190.h:64
struct no_os_spi_desc * comm_desc
Definition: max22190.h:89
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
#define MAX22190_RW_MASK
Definition: max22190.h:63
int max22190_chan_state(struct max22190_desc *desc, uint32_t ch, enum max22190_ch_state state)
Switch selected channel's state to disabled or enabled.
Definition: max22190.c:157
#define MAX22190_FAULT_MASK(x)
Definition: max22190.h:68
uint8_t * tx_buff
Definition: no_os_spi.h:102
@ MAX22190_DELAY_3200US
Definition: max22190.h:103
int max22190_wbe_get(struct max22190_desc *desc, uint32_t ch, bool *enabled)
Get Wire Break detection for requested channel.
Definition: max22190.c:183
#define MAX22190_POR_MASK
Definition: max22190.h:66
@ MAX22190_FAULT1_ALRMT1E
Definition: max22190.h:112
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
int max22190_init(struct max22190_desc **, struct max22190_init_param *)
MAX22190 Initialization function.
Definition: max22190.c:427
@ MAX22190_DELAY_100US
Definition: max22190.h:99
@ MAX22190_FAULT2_RFWBSE
Definition: max22190.h:115
max22190_fault_enable
Definition: max22190.h:108
@ MAX22190_DELAY_20MS
Definition: max22190.h:105
@ MAX22190_CH_OFF
Definition: max22190.h:78
#define MAX22190_FRAME_SIZE
Definition: max22190.h:42
#define MAX22190_INPUT_EN_REG
Definition: max22190.h:51
int max22190_filter_set(struct max22190_desc *desc, uint32_t ch, uint32_t clrf, uint32_t fbp, enum max22190_delay delay)
Set filter delay, wite break detection and if the filter is used or bypassed.
Definition: max22190.c:93
int max22190_reg_update(struct max22190_desc *desc, uint32_t addr, uint32_t mask, uint32_t val)
Register update function for MAX22190.
Definition: max22190.c:405
#define MAX22190_CHANNELS
Definition: max22190.h:43
int max22190_init(struct max22190_desc **desc, struct max22190_init_param *param)
MAX22190 Initialization function.
Definition: max22190.c:427
#define MAX22190_FAULT2_EN_MASK
Definition: max22190.h:71
int32_t no_os_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: no_os_gpio.c:104
int max22190_fault_enable_get(struct max22190_desc *, enum max22190_fault_enable, bool *)
Get fault enable from the fault registers.
Definition: max22190.c:225
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
struct no_os_gpio_desc * en_gpio
Definition: max22190.h:90
@ MAX22190_FAULT1_ALRMT2E
Definition: max22190.h:113
#define MAX22190_DELAY_MASK
Definition: max22190.h:60
int max22190_filter_set(struct max22190_desc *, uint32_t, uint32_t, uint32_t, enum max22190_delay)
Set filter delay, wite break detection and if the filter is used or bypassed.
Definition: max22190.c:93
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
#define MAX22190_CFG_REFDI_MASK
Definition: max22190.h:73
@ MAX22190_FAULT2_RFDISE
Definition: max22190.h:117
uint8_t fault2en
Definition: max22190.h:93
#define MAX22190_FAULT1_REG
Definition: max22190.h:48
int32_t no_os_spi_transfer(struct no_os_spi_desc *desc, struct no_os_spi_msg *msgs, uint32_t len)
Iterate over head list and send all spi messages.
Definition: no_os_spi.c:185
uint32_t bytes_number
Definition: no_os_spi.h:106
#define MAX22190_FAULT1_EN_REG
Definition: max22190.h:55
@ MAX22190_FAULT1_FAULT2E
Definition: max22190.h:114
int max22190_wbe_set(struct max22190_desc *, uint32_t, bool)
Set Wire Break detection for requested channel.
Definition: max22190.c:207
uint32_t no_os_field_get(uint32_t mask, uint32_t word)
int max22190_wbe_set(struct max22190_desc *desc, uint32_t ch, bool enabled)
Set Wire Break detection for requested channel.
Definition: max22190.c:207
int max22190_reg_write(struct max22190_desc *desc, uint32_t addr, uint32_t val)
Register write function for MAX22190.
Definition: max22190.c:375
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
int max22190_fault_enable_set(struct max22190_desc *, enum max22190_fault_enable, bool)
Set fault enable in the fault registers.
Definition: max22190.c:273
@ MAX22190_FAULT2_RFWBOE
Definition: max22190.h:116
Definition: max22190.h:82
#define MAX22190_FILTER_IN_REG(x)
Definition: max22190.h:49
int32_t no_os_gpio_set_value(struct no_os_gpio_desc *desc, uint8_t value)
Set the value of the specified GPIO.
Definition: no_os_gpio.c:197
max22190_ch_state
Definition: max22190.h:77
#define MAX22190_FBP_MASK
Definition: max22190.h:61
int32_t no_os_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: no_os_spi.c:116
max22190_delay
Definition: max22190.h:97
@ MAX22190_CH_ON
Definition: max22190.h:79
Header file of GPIO Interface.
int32_t no_os_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: no_os_spi.c:52
Header file of MAX22190 Driver.
Header file of utility functions.
enum max22190_ch_state channels[MAX22190_CHANNELS]
Definition: max22190.h:92
@ MAX22190_FAULT2_OTSHDNE
Definition: max22190.h:119
@ MAX22190_CFG_REFDI_SH_ENA
Definition: max22190.h:122
#define MAX22190_FAULT2_EN_REG
Definition: max22190.h:53
@ MAX22190_DELAY_800US
Definition: max22190.h:101
@ MAX22190_CFG_24VF
Definition: max22190.h:121
struct no_os_gpio_init_param * en_gpio_param
Definition: max22190.h:84
@ MAX22190_FAULT1_24VME
Definition: max22190.h:110
int max22190_reg_write(struct max22190_desc *, uint32_t, uint32_t)
Register write function for MAX22190.
Definition: max22190.c:375
Error macro definition for ARM Compiler.
#define MAX22190_CH_STATE_MASK(x)
Definition: max22190.h:59
@ MAX22190_DELAY_12800US
Definition: max22190.h:104
int max22190_reg_read(struct max22190_desc *, uint32_t, uint32_t *)
Register read function for MAX22190.
Definition: max22190.c:332
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140
int max22190_remove(struct max22190_desc *desc)
Free the resources allocated by initialization.
Definition: max22190.c:485
int max22190_filter_get(struct max22190_desc *desc, uint32_t ch, uint32_t *clrf, uint32_t *fbp, enum max22190_delay *delay)
Get filter delay, wite break detection and if the filter is used or bypassed.
Definition: max22190.c:125
int32_t no_os_gpio_get_optional(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Get the value of an optional GPIO.
Definition: no_os_gpio.c:75