Analog Devices / AD910x
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ad910x.h Source File

ad910x.h

00001 /******************************************************************************
00002     @file:  ad910x.h
00003  
00004     @brief: Defines digital pins and functions for the devices' SPI interface
00005             and printing data from SPI read to text-based user interface
00006 -------------------------------------------------------------------------------
00007     Copyright (c) 2021 Analog Devices, Inc.
00008     All rights reserved.
00009  
00010     This software is proprietary to Analog Devices, Inc. and its licensors.
00011     By using this software you agree to the terms of the associated
00012     Analog Devices Software License Agreement.
00013  
00014     20210120-LWSC-CTSLA
00015 ******************************************************************************/
00016 
00017 #ifndef __ad910x_h__
00018 #define __ad910x_h__
00019 
00020 class AD910x
00021 {
00022     
00023     public:
00024         SPI( spi );             /// SPI instance of AD910x
00025         DigitalOut( csb );      /// DigitalOut instance for AD910x chip select
00026         DigitalOut( resetb );   /// DigitalOut instance for AD910x reset pin
00027         DigitalOut( triggerb ); /// DigitalOut instance for AD910x trigger pin
00028  
00029         /*** 4-Wire SPI, Reset, and Trigger configuration & constructor ***/
00030         AD910x( PinName CSB = PA_15, PinName MOSI = PA_7, PinName MISO = PB_4, PinName SCK = PB_3,
00031                 PinName RESETB = PG_11, PinName TRIGGERB = PG_10 );
00032      
00033         /*** SPI register addresses ***/
00034         uint16_t reg_add[66]={0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x001f, 0x0020, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x003e, 0x003f, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0047, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, 0x001e, 0x001d};
00035     
00036         // Function to setup SPI
00037         void spi_init( uint8_t reg_len, uint8_t mode, uint32_t hz);
00038     
00039         // SPI write function
00040         void spi_write( uint16_t addr, int16_t data );
00041     
00042         // SPI read function
00043         int16_t spi_read( uint16_t addr );
00044 
00045         // Function to reset SPI register values
00046         void AD910x_reg_reset();
00047         
00048         // Function to display register data
00049         void print_data( uint16_t addr, uint16_t data );
00050     
00051         // Function to write to SRAM
00052         void AD910x_update_sram( int16_t data[] );
00053     
00054         // Function to display n SRAM data
00055         void AD910x_print_sram( uint16_t n );
00056     
00057         // Function to write to device SPI registers and display updated register values
00058         void AD910x_update_regs( uint16_t data[] );
00059           
00060         // Function to start pattern generation
00061         void AD910x_start_pattern();
00062         
00063         // Function to stop pattern generation
00064         void AD910x_stop_pattern();
00065 };
00066 
00067 #endif