no-OS
Classes | Macros | Enumerations | Functions
adgs5412.h File Reference

Header file of ADGS5412 Driver. More...

#include <stdint.h>
#include "no_os_spi.h"
Include dependency graph for adgs5412.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  adgs5412_dev
 
struct  adgs5412_init_param
 

Macros

#define ADGS5412_REG_SW_DATA   0x01
 
#define ADGS5412_REG_ERR_CONFIG   0x02
 
#define ADGS5412_REG_ERR_FLAGS   0x03
 
#define ADGS5412_REG_BURST_EN   0x05
 
#define ADGS5412_REG_SOFT_RESETB   0x0B
 
#define ADGS5412_SW4_EN   (1 << 3)
 
#define ADGS5412_SW3_EN   (1 << 2)
 
#define ADGS5412_SW2_EN   (1 << 1)
 
#define ADGS5412_SW1_EN   (1 << 0)
 
#define ADGS5414_SW7_EN   (1 << 7)
 
#define ADGS5414_SW6_EN   (1 << 6)
 
#define ADGS5414_SW5_EN   (1 << 5)
 
#define ADGS5414_SW4_EN   (1 << 4)
 
#define ADGS5414_SW3_EN   (1 << 3)
 
#define ADGS5414_SW2_EN   (1 << 2)
 
#define ADGS5414_SW1_EN   (1 << 1)
 
#define ADGS5414_SW0_EN   (1 << 0)
 
#define ADGS5412_RW_ERR_EN   (1 << 2)
 
#define ADGS5412_SCLK_ERR_EN   (1 << 1)
 
#define ADGS5412_CRC_ERR_EN   (1 << 0)
 
#define ADGS5412_RW_ERR_FLAG   (1 << 2)
 
#define ADGS5412_SCLK_ERR_FLAG   (1 << 1)
 
#define ADGS5412_CRC_ERR_FLAG   (1 << 0)
 
#define ADGS5412_CLR_1   0x6C
 
#define ADGS5412_CLR_2   0xA9
 
#define ADGS5412_BURST_MODE_EN   (1 << 0)
 
#define ADGS5412_SOFT_RESETB(x)   (((x) & 0xFF) << 0)
 
#define ADGS5412_RESET_1   0xA3
 
#define ADGS5412_RESET_2   0x05
 
#define ADGS5412_DAISY_CHAIN_1   0x25
 
#define ADGS5412_DAISY_CHAIN_2   0x00
 
#define ADGS5412_ALIGNMENT   0x25
 
#define ADGS5412_CRC8_POLY   0x07
 

Enumerations

enum  adgs5412_state {
  ADGS5412_ENABLE,
  ADGS5412_DISABLE
}
 

Functions

uint8_t adgs5412_compute_crc8 (uint8_t *data, uint8_t data_size)
 
int32_t adgs5412_spi_reg_read (adgs5412_dev *dev, uint8_t reg_addr, uint8_t *reg_data)
 
int32_t adgs5412_spi_reg_write (adgs5412_dev *dev, uint8_t reg_addr, uint8_t reg_data)
 
int32_t adgs5412_spi_reg_read_mask (adgs5412_dev *dev, uint8_t reg_addr, uint8_t mask, uint8_t *data)
 
int32_t adgs5412_spi_reg_write_mask (adgs5412_dev *dev, uint8_t reg_addr, uint8_t mask, uint8_t data)
 
int32_t adgs5412_do_soft_reset (adgs5412_dev *dev)
 
int32_t adgs5412_clear_err_flags (adgs5412_dev *dev)
 
int32_t adgs5412_enter_daisy_chain (adgs5412_dev *dev)
 
int32_t adgs5412_send_daisy_chain_cmds (adgs5412_dev *dev, uint8_t *cmds, uint8_t cmds_size)
 
int32_t adgs5412_init (adgs5412_dev **device, adgs5412_init_param init_param)
 
int32_t adgs5412_remove (adgs5412_dev *dev)
 Free the resources allocated by adgs5412_init(). More...
 

Detailed Description

Header file of ADGS5412 Driver.

Author
DBogdan (drago.nosp@m.s.bo.nosp@m.gdan@.nosp@m.anal.nosp@m.og.co.nosp@m.m)

Copyright 2016(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.

Macro Definition Documentation

◆ ADGS5412_ALIGNMENT

#define ADGS5412_ALIGNMENT   0x25

◆ ADGS5412_BURST_MODE_EN

#define ADGS5412_BURST_MODE_EN   (1 << 0)

◆ ADGS5412_CLR_1

#define ADGS5412_CLR_1   0x6C

◆ ADGS5412_CLR_2

#define ADGS5412_CLR_2   0xA9

◆ ADGS5412_CRC8_POLY

#define ADGS5412_CRC8_POLY   0x07

◆ ADGS5412_CRC_ERR_EN

#define ADGS5412_CRC_ERR_EN   (1 << 0)

◆ ADGS5412_CRC_ERR_FLAG

#define ADGS5412_CRC_ERR_FLAG   (1 << 0)

◆ ADGS5412_DAISY_CHAIN_1

#define ADGS5412_DAISY_CHAIN_1   0x25

◆ ADGS5412_DAISY_CHAIN_2

#define ADGS5412_DAISY_CHAIN_2   0x00

◆ ADGS5412_REG_BURST_EN

#define ADGS5412_REG_BURST_EN   0x05

◆ ADGS5412_REG_ERR_CONFIG

#define ADGS5412_REG_ERR_CONFIG   0x02

◆ ADGS5412_REG_ERR_FLAGS

#define ADGS5412_REG_ERR_FLAGS   0x03

◆ ADGS5412_REG_SOFT_RESETB

#define ADGS5412_REG_SOFT_RESETB   0x0B

◆ ADGS5412_REG_SW_DATA

#define ADGS5412_REG_SW_DATA   0x01

◆ ADGS5412_RESET_1

#define ADGS5412_RESET_1   0xA3

◆ ADGS5412_RESET_2

#define ADGS5412_RESET_2   0x05

◆ ADGS5412_RW_ERR_EN

#define ADGS5412_RW_ERR_EN   (1 << 2)

◆ ADGS5412_RW_ERR_FLAG

#define ADGS5412_RW_ERR_FLAG   (1 << 2)

◆ ADGS5412_SCLK_ERR_EN

#define ADGS5412_SCLK_ERR_EN   (1 << 1)

◆ ADGS5412_SCLK_ERR_FLAG

#define ADGS5412_SCLK_ERR_FLAG   (1 << 1)

◆ ADGS5412_SOFT_RESETB

#define ADGS5412_SOFT_RESETB (   x)    (((x) & 0xFF) << 0)

◆ ADGS5412_SW1_EN

#define ADGS5412_SW1_EN   (1 << 0)

◆ ADGS5412_SW2_EN

#define ADGS5412_SW2_EN   (1 << 1)

◆ ADGS5412_SW3_EN

#define ADGS5412_SW3_EN   (1 << 2)

◆ ADGS5412_SW4_EN

#define ADGS5412_SW4_EN   (1 << 3)

◆ ADGS5414_SW0_EN

#define ADGS5414_SW0_EN   (1 << 0)

◆ ADGS5414_SW1_EN

#define ADGS5414_SW1_EN   (1 << 1)

◆ ADGS5414_SW2_EN

#define ADGS5414_SW2_EN   (1 << 2)

◆ ADGS5414_SW3_EN

#define ADGS5414_SW3_EN   (1 << 3)

◆ ADGS5414_SW4_EN

#define ADGS5414_SW4_EN   (1 << 4)

◆ ADGS5414_SW5_EN

#define ADGS5414_SW5_EN   (1 << 5)

◆ ADGS5414_SW6_EN

#define ADGS5414_SW6_EN   (1 << 6)

◆ ADGS5414_SW7_EN

#define ADGS5414_SW7_EN   (1 << 7)

Enumeration Type Documentation

◆ adgs5412_state

Enumerator
ADGS5412_ENABLE 
ADGS5412_DISABLE 

Function Documentation

◆ adgs5412_clear_err_flags()

int32_t adgs5412_clear_err_flags ( adgs5412_dev dev)

Clear the Error Flags Register.

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

◆ adgs5412_compute_crc8()

uint8_t adgs5412_compute_crc8 ( uint8_t *  data,
uint8_t  data_size 
)

Compute CRC8 checksum.

Parameters
data- The data buffer.
data_size- The size of the data buffer.
Returns
CRC8 checksum.
Here is the caller graph for this function:

◆ adgs5412_do_soft_reset()

int32_t adgs5412_do_soft_reset ( adgs5412_dev dev)

Do a software reset.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ adgs5412_enter_daisy_chain()

int32_t adgs5412_enter_daisy_chain ( adgs5412_dev dev)

Enter Daisy-Chain Mode.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ adgs5412_init()

int32_t adgs5412_init ( adgs5412_dev **  device,
adgs5412_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.

◆ adgs5412_remove()

int32_t adgs5412_remove ( adgs5412_dev dev)

Free the resources allocated by adgs5412_init().

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

◆ adgs5412_send_daisy_chain_cmds()

int32_t adgs5412_send_daisy_chain_cmds ( adgs5412_dev dev,
uint8_t *  cmds,
uint8_t  cmds_size 
)

Send Daisy-Chain commands.

Parameters
dev- The device structure.
cmds- The commands to be sent.
cmds_size- The number of commands.
Returns
0 in case of success, negative error code otherwise.

◆ adgs5412_spi_reg_read()

int32_t adgs5412_spi_reg_read ( adgs5412_dev dev,
uint8_t  reg_addr,
uint8_t *  reg_data 
)

SPI register read from device.

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

◆ adgs5412_spi_reg_read_mask()

int32_t adgs5412_spi_reg_read_mask ( adgs5412_dev dev,
uint8_t  reg_addr,
uint8_t  mask,
uint8_t *  data 
)

SPI register read from device using a mask.

Parameters
dev- The device structure.
reg_addr- The register address.
mask- The mask.
data- The register data.
Returns
0 in case of success, negative error code otherwise.

◆ adgs5412_spi_reg_write()

int32_t adgs5412_spi_reg_write ( adgs5412_dev dev,
uint8_t  reg_addr,
uint8_t  reg_data 
)

SPI register write to device.

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

◆ adgs5412_spi_reg_write_mask()

int32_t adgs5412_spi_reg_write_mask ( adgs5412_dev dev,
uint8_t  reg_addr,
uint8_t  mask,
uint8_t  data 
)

SPI internal register write to device using a mask.

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