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

Implementation of ADGS6414D Driver. More...

#include <stdio.h>
#include <stdlib.h>
#include "adgs6414d.h"
#include "no_os_error.h"
#include "no_os_alloc.h"
Include dependency graph for adgs6414d.c:

Functions

int adgs6414d_spi_write (struct adgs6414d_dev *dev, uint8_t reg_addr, uint8_t data)
 
int adgs6414d_spi_read (struct adgs6414d_dev *dev, uint8_t reg_addr, uint8_t *data)
 
int adgs6414d_soft_reset (struct adgs6414d_dev *dev)
 
int adgs6414d_set_switch (struct adgs6414d_dev *dev, uint8_t channel, bool state)
 
int adgs6414d_get_switch (struct adgs6414d_dev *dev, uint8_t channel, bool *state)
 
int adgs6414d_set_switches (struct adgs6414d_dev *dev, uint8_t mask)
 
int adgs6414d_get_switches (struct adgs6414d_dev *dev, uint8_t *mask)
 
int adgs6414d_init (struct adgs6414d_dev **device, struct adgs6414d_init_param *init_param)
 
int adgs6414d_remove (struct adgs6414d_dev *dev)
 

Detailed Description

Implementation of ADGS6414D Driver.

Author
Antoniu Miclaus (anton.nosp@m.iu.m.nosp@m.iclau.nosp@m.s@an.nosp@m.alog..nosp@m.com)

Copyright 2025(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

◆ adgs6414d_get_switch()

int adgs6414d_get_switch ( struct adgs6414d_dev * dev,
uint8_t channel,
bool * state )

Get switch state for a specific channel.

Parameters
dev- The device structure.
channel- Switch channel (0-7).
state- Pointer to store the switch state.
Returns
0 in case of success, negative error code otherwise.

◆ adgs6414d_get_switches()

int adgs6414d_get_switches ( struct adgs6414d_dev * dev,
uint8_t * mask )

Get all switch states as bitmask.

Parameters
dev- The device structure.
mask- Pointer to store the switch states bitmask.
Returns
0 in case of success, negative error code otherwise.

◆ adgs6414d_init()

int adgs6414d_init ( struct adgs6414d_dev ** device,
struct adgs6414d_init_param * init_param )

Initialize the device.

Parameters
device- The device structure.
init_param- The structure that contains the device initial parameters.
Returns
0 in case of success, negative error code otherwise.

◆ adgs6414d_remove()

int adgs6414d_remove ( struct adgs6414d_dev * dev)

Free the resources allocated by adgs6414d_init().

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ adgs6414d_set_switch()

int adgs6414d_set_switch ( struct adgs6414d_dev * dev,
uint8_t channel,
bool state )

Set switch state for a specific channel.

Parameters
dev- The device structure.
channel- Switch channel (0-7).
state- Switch state (true = closed, false = open).
Returns
0 in case of success, negative error code otherwise.

◆ adgs6414d_set_switches()

int adgs6414d_set_switches ( struct adgs6414d_dev * dev,
uint8_t mask )

Set multiple switches at once using bitmask.

Parameters
dev- The device structure.
mask- Bitmask for switch states (bit 0 = SW1, bit 7 = SW8).
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ adgs6414d_soft_reset()

int adgs6414d_soft_reset ( struct adgs6414d_dev * dev)

Perform software reset.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ adgs6414d_spi_read()

int adgs6414d_spi_read ( struct adgs6414d_dev * dev,
uint8_t reg_addr,
uint8_t * data )

SPI read operation.

Parameters
dev- The device structure.
reg_addr- Register address.
data- Pointer to store read data.
Returns
0 in case of success, negative error code otherwise.

◆ adgs6414d_spi_write()

int adgs6414d_spi_write ( struct adgs6414d_dev * dev,
uint8_t reg_addr,
uint8_t data )

SPI write operation.

Parameters
dev- The device structure.
reg_addr- Register address.
data- Data to write.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function: