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 "no_os_crc8.h"
Include dependency graph for adgs6414d.c:

Functions

 NO_OS_DECLARE_CRC8_TABLE (adgs6414d_crc8)
 
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_crc_enable (struct adgs6414d_dev *dev, bool enable)
 
int adgs6414d_get_err_flags (struct adgs6414d_dev *dev, uint8_t *flags)
 
int adgs6414d_clear_err_flags (struct adgs6414d_dev *dev)
 
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.

SPDX-License-Identifier: BSD-3-Clause

Function Documentation

◆ adgs6414d_clear_err_flags()

int adgs6414d_clear_err_flags ( struct adgs6414d_dev * dev)

Clear the error flags register. Sends special command 0x6CA9 to clear all error flags.

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

◆ adgs6414d_crc_enable()

int adgs6414d_crc_enable ( struct adgs6414d_dev * dev,
bool enable )

Enable or disable CRC error detection.

Parameters
dev- The device structure.
enable- true to enable, false to disable.
Returns
0 in case of success, negative error code otherwise.

◆ adgs6414d_get_err_flags()

int adgs6414d_get_err_flags ( struct adgs6414d_dev * dev,
uint8_t * flags )

Read the error flags register.

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

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

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

◆ NO_OS_DECLARE_CRC8_TABLE()

NO_OS_DECLARE_CRC8_TABLE ( adgs6414d_crc8 )