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

Implementation of ADF7023 Driver. More...

#include <stdlib.h>
#include "adf7023_config.h"
#include "adf7023.h"
#include "no_os_alloc.h"
Include dependency graph for adf7023.c:

Macros

#define ADF7023_CS_ASSERT
 
#define ADF7023_CS_DEASSERT
 

Functions

void adf7023_write_read_byte (struct adf7023_dev *dev, uint8_t write_byte, uint8_t *read_byte)
 Transfers one byte of data.
 
int32_t adf7023_init (struct adf7023_dev **device, struct adf7023_init_param init_param)
 Initializes the ADF7023.
 
int32_t adf7023_remove (struct adf7023_dev *dev)
 Free the resources allocated by adf7023_init().
 
void adf7023_get_status (struct adf7023_dev *dev, uint8_t *status)
 Reads the status word of the ADF7023.
 
void adf7023_set_command (struct adf7023_dev *dev, uint8_t command)
 Initiates a command.
 
void adf7023_set_fw_state (struct adf7023_dev *dev, uint8_t fw_state)
 Sets a FW state and waits until the device enters in that state.
 
void adf7023_get_ram (struct adf7023_dev *dev, uint32_t address, uint32_t length, uint8_t *data)
 Reads data from the RAM.
 
void adf7023_set_ram (struct adf7023_dev *dev, uint32_t address, uint32_t length, uint8_t *data)
 Writes data to RAM.
 
void adf7023_receive_packet (struct adf7023_dev *dev, uint8_t *packet, uint8_t *length)
 Receives one packet.
 
void adf7023_transmit_packet (struct adf7023_dev *dev, uint8_t *packet, uint8_t length)
 Transmits one packet.
 
void adf7023_set_channel_frequency (struct adf7023_dev *dev, uint32_t ch_freq)
 Sets the channel frequency.
 
void adf7023_set_data_rate (struct adf7023_dev *dev, uint32_t data_rate)
 Sets the data rate.
 
void adf7023_set_frequency_deviation (struct adf7023_dev *dev, uint32_t freq_dev)
 Sets the frequency deviation.
 

Detailed Description

Implementation of ADF7023 Driver.

Author
DBogdan (Drago.nosp@m.s.Bo.nosp@m.gdan@.nosp@m.anal.nosp@m.og.co.nosp@m.m)

Copyright 2013(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ ADF7023_CS_ASSERT

#define ADF7023_CS_ASSERT
Value:
no_os_gpio_set_value(dev->gpio_cs, \
int32_t no_os_gpio_set_value(struct no_os_gpio_desc *desc, uint8_t value)
Set the value of the specified GPIO.
Definition no_os_gpio.c:170
@ NO_OS_GPIO_LOW
Definition no_os_gpio.h:80

◆ ADF7023_CS_DEASSERT

#define ADF7023_CS_DEASSERT
Value:
no_os_gpio_set_value(dev->gpio_cs, \
@ NO_OS_GPIO_HIGH
Definition no_os_gpio.h:82

Function Documentation

◆ adf7023_get_ram()

void adf7023_get_ram ( struct adf7023_dev * dev,
uint32_t address,
uint32_t length,
uint8_t * data )

Reads data from the RAM.

Parameters
dev- The device structure.
address- Start address.
length- Number of bytes to write.
data- Read buffer.

◆ adf7023_get_status()

void adf7023_get_status ( struct adf7023_dev * dev,
uint8_t * status )

Reads the status word of the ADF7023.

Parameters
dev- The device structure.
status- Status word.

◆ adf7023_init()

int32_t adf7023_init ( struct adf7023_dev ** device,
struct adf7023_init_param init_param )

Initializes the ADF7023.

Parameters
device- The device structure.
init_param- The structure that contains the device initial parameters.
Returns
ret - Result of the initialization procedure. Example: 0 - if initialization was successful; -1 - if initialization was unsuccessful.

◆ adf7023_receive_packet()

void adf7023_receive_packet ( struct adf7023_dev * dev,
uint8_t * packet,
uint8_t * length )

Receives one packet.

Parameters
dev- The device structure.
packet- Data buffer.
length- Number of received bytes.

◆ adf7023_remove()

int32_t adf7023_remove ( struct adf7023_dev * dev)

Free the resources allocated by adf7023_init().

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

◆ adf7023_set_channel_frequency()

void adf7023_set_channel_frequency ( struct adf7023_dev * dev,
uint32_t ch_freq )

Sets the channel frequency.

Parameters
dev- The device structure.
ch_freq- Channel frequency.

◆ adf7023_set_command()

void adf7023_set_command ( struct adf7023_dev * dev,
uint8_t command )

Initiates a command.

Parameters
dev- The device structure.
command- Command.

◆ adf7023_set_data_rate()

void adf7023_set_data_rate ( struct adf7023_dev * dev,
uint32_t data_rate )

Sets the data rate.

Parameters
dev- The device structure.
data_rate- Data rate.

◆ adf7023_set_frequency_deviation()

void adf7023_set_frequency_deviation ( struct adf7023_dev * dev,
uint32_t freq_dev )

Sets the frequency deviation.

Parameters
dev- The device structure.
freq_dev- Frequency deviation.

◆ adf7023_set_fw_state()

void adf7023_set_fw_state ( struct adf7023_dev * dev,
uint8_t fw_state )

Sets a FW state and waits until the device enters in that state.

Parameters
dev- The device structure.
fw_state- FW state.

◆ adf7023_set_ram()

void adf7023_set_ram ( struct adf7023_dev * dev,
uint32_t address,
uint32_t length,
uint8_t * data )

Writes data to RAM.

Parameters
dev- The device structure.
address- Start address.
length- Number of bytes to write.
data- Write buffer.

◆ adf7023_transmit_packet()

void adf7023_transmit_packet ( struct adf7023_dev * dev,
uint8_t * packet,
uint8_t length )

Transmits one packet.

Parameters
dev- The device structure.
packet- Data buffer.
length- Number of bytes to transmit.

◆ adf7023_write_read_byte()

void adf7023_write_read_byte ( struct adf7023_dev * dev,
uint8_t write_byte,
uint8_t * read_byte )

Transfers one byte of data.

Parameters
dev- The device structure.
write_byte- Write data.
read_byte- Read data.