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

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.

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

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 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.

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

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

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.

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.

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: