Library files for EVAL-AD910x

Dependents:   EVAL-AD910x

Committer:
scabatan
Date:
Sat Apr 10 10:45:39 2021 +0000
Revision:
4:15b1cf1aa2b0
Parent:
3:909f157c982e
Child:
5:47508d73dad2
Added comments and software license number

Who changed what in which revision?

UserRevisionLine numberNew contents of line
scabatan 4:15b1cf1aa2b0 1 /******************************************************************************
scabatan 4:15b1cf1aa2b0 2 @file: ad910x.h
scabatan 4:15b1cf1aa2b0 3
scabatan 4:15b1cf1aa2b0 4 @brief: Defines digital pins and functions for the devices' SPI interface
scabatan 4:15b1cf1aa2b0 5 and printing data from SPI read to text-based user interface
scabatan 4:15b1cf1aa2b0 6 -------------------------------------------------------------------------------
scabatan 4:15b1cf1aa2b0 7 Copyright (c) 2021 Analog Devices, Inc.
scabatan 4:15b1cf1aa2b0 8 All rights reserved.
scabatan 4:15b1cf1aa2b0 9
scabatan 4:15b1cf1aa2b0 10 This software is proprietary to Analog Devices, Inc. and its licensors.
scabatan 4:15b1cf1aa2b0 11 By using this software you agree to the terms of the associated
scabatan 4:15b1cf1aa2b0 12 Analog Devices Software License Agreement.
scabatan 4:15b1cf1aa2b0 13
scabatan 4:15b1cf1aa2b0 14 20210120-LWSC-CTSLA
scabatan 4:15b1cf1aa2b0 15 ******************************************************************************/
scabatan 4:15b1cf1aa2b0 16
scabatan 1:10838ebbc223 17 #ifndef __ad910x_h__
scabatan 1:10838ebbc223 18 #define __ad910x_h__
scabatan 1:10838ebbc223 19
scabatan 1:10838ebbc223 20 class AD910x
scabatan 1:10838ebbc223 21 {
scabatan 1:10838ebbc223 22
scabatan 1:10838ebbc223 23 public:
scabatan 4:15b1cf1aa2b0 24 SPI( spi ); /// SPI instance of AD910x
scabatan 4:15b1cf1aa2b0 25 DigitalOut( csb ); /// DigitalOut instance for AD910x chip select
scabatan 4:15b1cf1aa2b0 26 DigitalOut( resetb ); /// DigitalOut instance for AD910x reset pin
scabatan 4:15b1cf1aa2b0 27 DigitalOut( triggerb ); /// DigitalOut instance for AD910x trigger pin
scabatan 1:10838ebbc223 28
scabatan 4:15b1cf1aa2b0 29 /*** 4-Wire SPI, Reset, and Trigger configuration & constructor ***/
scabatan 1:10838ebbc223 30 AD910x( PinName CSB = PG_10, PinName MOSI = PA_7, PinName MISO = PB_4, PinName SCK = PB_3,
scabatan 2:d718e772d5a6 31 PinName RESETB = PG_11, PinName TRIGGERB = PG_10 );
scabatan 1:10838ebbc223 32
scabatan 1:10838ebbc223 33 /*** SPI register addresses ***/
scabatan 1:10838ebbc223 34 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};
scabatan 1:10838ebbc223 35
scabatan 1:10838ebbc223 36 // Function to setup SPI
scabatan 3:909f157c982e 37 void spi_init( uint8_t reg_len, uint8_t mode, uint32_t hz);
scabatan 1:10838ebbc223 38
scabatan 1:10838ebbc223 39 // SPI write function
scabatan 1:10838ebbc223 40 void spi_write( uint16_t addr, int16_t data );
scabatan 1:10838ebbc223 41
scabatan 1:10838ebbc223 42 // SPI read function
scabatan 1:10838ebbc223 43 int16_t spi_read( uint16_t addr );
scabatan 1:10838ebbc223 44
scabatan 1:10838ebbc223 45 // Function to reset SPI register values
scabatan 1:10838ebbc223 46 void AD910x_reg_reset();
scabatan 1:10838ebbc223 47
scabatan 1:10838ebbc223 48 // Function to display register data
scabatan 1:10838ebbc223 49 void print_data( uint16_t addr, uint16_t data );
scabatan 1:10838ebbc223 50
scabatan 1:10838ebbc223 51 // Function to write to SRAM
scabatan 1:10838ebbc223 52 void AD910x_update_sram( int16_t data[] );
scabatan 1:10838ebbc223 53
scabatan 1:10838ebbc223 54 // Function to display n SRAM data
scabatan 1:10838ebbc223 55 void AD910x_print_sram( uint16_t n );
scabatan 1:10838ebbc223 56
scabatan 1:10838ebbc223 57 // Function to write to device SPI registers and display updated register values
scabatan 1:10838ebbc223 58 void AD910x_update_regs( uint16_t data[] );
scabatan 1:10838ebbc223 59
scabatan 1:10838ebbc223 60 // Function to start pattern generation
scabatan 1:10838ebbc223 61 void AD910x_start_pattern();
scabatan 1:10838ebbc223 62
scabatan 1:10838ebbc223 63 // Function to stop pattern generation
scabatan 1:10838ebbc223 64 void AD910x_stop_pattern();
scabatan 1:10838ebbc223 65 };
scabatan 1:10838ebbc223 66
scabatan 1:10838ebbc223 67 #endif