no-OS
Loading...
Searching...
No Matches
max14906.c File Reference

Source file of MAX14906 Driver. More...

#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "max14906.h"
#include "no_os_util.h"
#include "no_os_alloc.h"
Include dependency graph for max14906.c:

Functions

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).
 
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).
 
int max14906_ch_func (struct max149x6_desc *desc, uint32_t ch, enum max14906_function function)
 Configure a channel's function.
 
int max14906_climit_set (struct max149x6_desc *desc, uint32_t ch, enum max14906_climit climit)
 Configure the current limit for output channels.
 
int max14906_climit_get (struct max149x6_desc *desc, uint32_t ch, enum max14906_climit *climit)
 Read an output channel's current limit.
 
int max14906_init (struct max149x6_desc **desc, struct max149x6_init_param *param)
 Initialize and configure the MAX14906 device.
 
int max14906_remove (struct max149x6_desc *desc)
 Free the resources allocated during init and place all the channels in high-z.
 

Detailed Description

Source 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.

SPDX-License-Identifier: BSD-3-Clause

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.

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

◆ 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).

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).

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.

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

◆ 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.

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

◆ max14906_init()

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

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

◆ max14906_remove()

int max14906_remove ( struct max149x6_desc * desc)

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