Implementation of ad9833 Driver for Microblaze processor.
More...
#include <stdlib.h>
#include "ad9833.h"
#include "no_os_error.h"
#include "no_os_alloc.h"
|
| int8_t | ad9833_init (struct ad9833_dev **device, struct ad9833_init_param init_param) |
| | Initialize the SPI communication with the device.
|
| |
| int32_t | ad9833_remove (struct ad9833_dev *dev) |
| | Free the resources allocated by ad9833_init().
|
| |
| void | ad9833_tx_spi (struct ad9833_dev *dev, int16_t value) |
| | Transmits 16 bits on SPI.
|
| |
| int8_t | ad9833_out_mode (struct ad9833_dev *dev, uint8_t out_mode) |
| | Selects the type of output.
|
| |
| void | ad9833_sleep_mode (struct ad9833_dev *dev, uint8_t sleep_mode) |
| | Enable / Disable the sleep function.
|
| |
| void | ad9833_set_freq (struct ad9833_dev *dev, uint8_t register_number, uint32_t frequency_value) |
| | Loads a frequency value in a register.
|
| |
| void | ad9833_set_phase (struct ad9833_dev *dev, uint8_t register_number, float phase_value) |
| | Loads a phase value in a register.
|
| |
| void | ad9833_select_freq_reg (struct ad9833_dev *dev, uint8_t freq_reg) |
| | Select the frequency register to be used.
|
| |
| void | ad9833_select_phase_reg (struct ad9833_dev *dev, uint8_t phase_reg) |
| | Select the phase register to be used.
|
| |
| void | ad9834_select_prog_method (struct ad9833_dev *dev, uint8_t value) |
| | Sets the programming method. (only for AD9834 & AD9838)
|
| |
| void | ad9834_logic_output (struct ad9833_dev *dev, uint8_t opbiten, uint8_t signpib, uint8_t div2) |
| | Configures the control register for logic output. (only for AD9834 & AD9838)
|
| |
Implementation of ad9833 Driver for Microblaze processor.
- Author
- Lucian Sin (Lucia.nosp@m.n.Si.nosp@m.n@ana.nosp@m.log..nosp@m.com)
Copyright 2013(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
◆ ad9833_init()
Initialize the SPI communication with the device.
- Parameters
-
| device | - The device structure. |
| init_param | - The structure that contains the device initial parameters. |
- Returns
- status - Result of the initialization procedure. Example: 0 - if initialization was successful; -1 - if initialization was unsuccessful.
◆ ad9833_out_mode()
| int8_t ad9833_out_mode |
( |
struct ad9833_dev * | dev, |
|
|
uint8_t | out_mode ) |
Selects the type of output.
- Parameters
-
| dev | - The device structure. |
| out_mode | - type of output Example AD9833&AD9837: 0 - Sinusoid. 1 - Triangle. 2 - DAC Data MSB/2. 3 - DAC Data MSB. Example AD9834&AD9838: 0 - Sinusoid. 1 - Triangle. |
- Returns
- status - output type could / couldn't be selected. Example: 0 - output type possible for the given configuration. -1 - output type not possible for the given configuration.
◆ ad9833_remove()
Free the resources allocated by ad9833_init().
- Parameters
-
| dev | - The device structure. |
- Returns
- 0 in case of success, negative error code otherwise.
◆ ad9833_select_freq_reg()
| void ad9833_select_freq_reg |
( |
struct ad9833_dev * | dev, |
|
|
uint8_t | freq_reg ) |
Select the frequency register to be used.
- Parameters
-
| dev | - The device structure. |
| freq_reg | - Number of frequency register. (0 / 1) |
◆ ad9833_select_phase_reg()
| void ad9833_select_phase_reg |
( |
struct ad9833_dev * | dev, |
|
|
uint8_t | phase_reg ) |
Select the phase register to be used.
- Parameters
-
| dev | - The device structure. |
| phase_reg | - Number of phase register. (0 / 1) |
◆ ad9833_set_freq()
| void ad9833_set_freq |
( |
struct ad9833_dev * | dev, |
|
|
uint8_t | register_number, |
|
|
uint32_t | frequency_value ) |
Loads a frequency value in a register.
- Parameters
-
| dev | - The device structure. |
| register_number | - Number of the register (0 / 1). |
| frequency_value | - Frequency value. |
◆ ad9833_set_phase()
| void ad9833_set_phase |
( |
struct ad9833_dev * | dev, |
|
|
uint8_t | register_number, |
|
|
float | phase_value ) |
Loads a phase value in a register.
- Parameters
-
| dev | - The device structure. |
| register_number | - Number of the register (0 / 1). |
| phase_value | - Phase value. |
◆ ad9833_sleep_mode()
| void ad9833_sleep_mode |
( |
struct ad9833_dev * | dev, |
|
|
uint8_t | sleep_mode ) |
Enable / Disable the sleep function.
- Parameters
-
| dev | - The device structure. |
| sleep_mode | - type of sleep Example soft method(all devices): 0 - No power-down. 1 - DAC powered down. 2 - Internal clock disabled. 3 - DAC powered down and Internal clock disabled. Example hard method(AD9834 & AD9838): 0 - No power-down. 1 - DAC powered down. |
◆ ad9833_tx_spi()
| void ad9833_tx_spi |
( |
struct ad9833_dev * | dev, |
|
|
int16_t | value ) |
Transmits 16 bits on SPI.
- Parameters
-
| dev | - The device structure. |
| value | - Data which will be transmitted. |
◆ ad9834_logic_output()
| void ad9834_logic_output |
( |
struct ad9833_dev * | dev, |
|
|
uint8_t | opbiten, |
|
|
uint8_t | signpib, |
|
|
uint8_t | div2 ) |
Configures the control register for logic output. (only for AD9834 & AD9838)
- Parameters
-
| dev | - The device structure. |
| opbiten | - Enables / disables the logic output. |
| signpib | - Connects comparator / MSB to the SIGN BIT OUT pin. |
| div2 | - MSB / MSB/2 |
◆ ad9834_select_prog_method()
| void ad9834_select_prog_method |
( |
struct ad9833_dev * | dev, |
|
|
uint8_t | value ) |
Sets the programming method. (only for AD9834 & AD9838)
- Parameters
-
| dev | - The device structure. |
| value | - soft or hard method. (0 / 1) |
◆ phase_const
| float phase_const = 651.8986469f |