#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include "no_os_error.h"
#include "no_os_util.h"
#include "no_os_alloc.h"
#include "adpd410x.h"
Functions | |
int32_t | adpd410x_reg_read (struct adpd410x_dev *dev, uint16_t address, uint16_t *data) |
Read device register. | |
int32_t | adpd410x_reg_read_bytes (struct adpd410x_dev *dev, uint16_t address, uint8_t *data, uint16_t num_bytes) |
Read a specified number of bytes from device register. | |
int32_t | adpd410x_reg_write (struct adpd410x_dev *dev, uint16_t address, uint16_t data) |
Write device register. | |
int32_t | adpd410x_reg_write_mask (struct adpd410x_dev *dev, uint16_t address, uint16_t data, uint16_t mask) |
Do a read and write of a register to update only part of a register. | |
int32_t | adpd410x_reset (struct adpd410x_dev *dev) |
Do a software reset. | |
int32_t | adpd410x_set_opmode (struct adpd410x_dev *dev, enum adpd410x_opmode mode) |
Set operation mode. | |
int32_t | adpd410x_get_opmode (struct adpd410x_dev *dev, enum adpd410x_opmode *mode) |
Get operation mode. | |
int32_t | adpd410x_set_last_timeslot (struct adpd410x_dev *dev, enum adpd410x_timeslots timeslot_no) |
Set number of active time slots. | |
int32_t | adpd410x_get_last_timeslot (struct adpd410x_dev *dev, enum adpd410x_timeslots *timeslot_no) |
Get number of active time slots. | |
int32_t | adpd410x_set_sampling_freq (struct adpd410x_dev *dev, uint32_t sampling_freq) |
Set device sampling frequency. | |
int32_t | adpd410x_get_sampling_freq (struct adpd410x_dev *dev, uint32_t *sampling_freq) |
Get device sampling frequency. | |
int32_t | adpd410x_timeslot_setup (struct adpd410x_dev *dev, enum adpd410x_timeslots timeslot_no, struct adpd410x_timeslot_init *init) |
Setup an active time slot. | |
int32_t | adpd410x_get_fifo_bytecount (struct adpd410x_dev *dev, uint16_t *bytes) |
Get number of bytes in the device FIFO. | |
int32_t | adpd410x_read_fifo (struct adpd410x_dev *dev, uint32_t *data, uint16_t num_samples, uint8_t datawidth) |
Reads a certain number of bytes from the fifo and stores in data Used to read a large amount of data from the fifo efficiently (using as few register reads as possible.) | |
int32_t | adpd410x_get_data (struct adpd410x_dev *dev, uint32_t *data) |
Get a full data packet from the device containing data from all active time slots. | |
int32_t | adpd410x_setup (struct adpd410x_dev **device, struct adpd410x_init_param *init_param) |
Setup the device and the driver. | |
int32_t | adpd410x_remove (struct adpd410x_dev *dev) |
Free memory allocated by adpd410x_setup(). | |
Copyright 2020(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:
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.
int32_t adpd410x_get_data | ( | struct adpd410x_dev * | dev, |
uint32_t * | data ) |
Get a full data packet from the device containing data from all active time slots.
dev | - Device handler. |
data | - Pointer to the data container. |
int32_t adpd410x_get_fifo_bytecount | ( | struct adpd410x_dev * | dev, |
uint16_t * | bytes ) |
Get number of bytes in the device FIFO.
dev | - Device handler. |
bytes | - Pointer to the byte count container. |
int32_t adpd410x_get_last_timeslot | ( | struct adpd410x_dev * | dev, |
enum adpd410x_timeslots * | timeslot_no ) |
Get number of active time slots.
dev | - Device handler. |
timeslot_no | - Last time slot enabled. |
int32_t adpd410x_get_opmode | ( | struct adpd410x_dev * | dev, |
enum adpd410x_opmode * | mode ) |
Get operation mode.
dev | - Device handler. |
mode | - Operation mode. |
int32_t adpd410x_get_sampling_freq | ( | struct adpd410x_dev * | dev, |
uint32_t * | sampling_freq ) |
Get device sampling frequency.
dev | - Device handler. |
sampling_freq | - New sampling frequency. |
int32_t adpd410x_read_fifo | ( | struct adpd410x_dev * | dev, |
uint32_t * | data, | ||
uint16_t | num_samples, | ||
uint8_t | datawidth ) |
Reads a certain number of bytes from the fifo and stores in data Used to read a large amount of data from the fifo efficiently (using as few register reads as possible.)
dev | - Device handler. |
data | - Pointer to the data container. |
num_samples | - number of samples to read |
datawidth | - number of bytes per sample |
int32_t adpd410x_reg_read | ( | struct adpd410x_dev * | dev, |
uint16_t | address, | ||
uint16_t * | data ) |
Read device register.
dev | - Device handler. |
address | - Register address. |
data | - Pointer to the register value container. |
int32_t adpd410x_reg_read_bytes | ( | struct adpd410x_dev * | dev, |
uint16_t | address, | ||
uint8_t * | data, | ||
uint16_t | num_bytes ) |
Read a specified number of bytes from device register.
dev | - Device handler. |
address | - Register address. |
data | - Pointer to the register value container. |
num_bytes | - number of bytes to read. Max 255 for ADPD4101 (I2C). |
int32_t adpd410x_reg_write | ( | struct adpd410x_dev * | dev, |
uint16_t | address, | ||
uint16_t | data ) |
Write device register.
dev | - Device handler. |
address | - Register address. |
data | - New register value. |
int32_t adpd410x_reg_write_mask | ( | struct adpd410x_dev * | dev, |
uint16_t | address, | ||
uint16_t | data, | ||
uint16_t | mask ) |
Do a read and write of a register to update only part of a register.
dev | - Device handler. |
address | - Address of the register. |
data | - Value to be written to the device. |
mask | - Mask of the bit field to update. |
int32_t adpd410x_remove | ( | struct adpd410x_dev * | dev | ) |
Free memory allocated by adpd410x_setup().
dev | - Device handler. |
int32_t adpd410x_reset | ( | struct adpd410x_dev * | dev | ) |
Do a software reset.
dev | - Device handler. |
int32_t adpd410x_set_last_timeslot | ( | struct adpd410x_dev * | dev, |
enum adpd410x_timeslots | timeslot_no ) |
Set number of active time slots.
dev | - Device handler. |
timeslot_no | - Last time slot to be enabled. |
int32_t adpd410x_set_opmode | ( | struct adpd410x_dev * | dev, |
enum adpd410x_opmode | mode ) |
Set operation mode.
dev | - Device handler. |
mode | - New operation mode. |
int32_t adpd410x_set_sampling_freq | ( | struct adpd410x_dev * | dev, |
uint32_t | sampling_freq ) |
Set device sampling frequency.
dev | - Device handler. |
sampling_freq | - New sampling frequency. |
int32_t adpd410x_setup | ( | struct adpd410x_dev ** | device, |
struct adpd410x_init_param * | init_param ) |
Setup the device and the driver.
device | - Pointer to the device handler. |
init_param | - Pointer to the initialization structure. |
Enable the 1MHz oscillator if the internal low frequency oscillator is used.
int32_t adpd410x_timeslot_setup | ( | struct adpd410x_dev * | dev, |
enum adpd410x_timeslots | timeslot_no, | ||
struct adpd410x_timeslot_init * | init ) |
Setup an active time slot.
dev | - Device handler. |
timeslot_no | - Time slot ID to setup. |
init | - Pointer to the time slot initialization structure. |
Set TIA VREF and TRIM options. The 0xE000 is writing reserved bits as specified in the datasheet.