/**************************************************************************************************************************************************
* init_ADS1x9x.c - Set's up an ADS1x9x device. All initialization calls are initiated from main.c *
* *
* Author: Luke Duncan *
* *
* Revision Date: June 2009 *
* *
* Revision Level: 1st pass *
* *
* For Support: https://e2e.ti.com/support/development_tools/mavrk/default.aspx *
* *
***************************************************************************************************************************************************
* Copyright � 2009-2010 Texas Instruments Incorporated - http://www.ti.com/ *
***************************************************************************************************************************************************
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: *
* *
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. *
* *
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* Neither the name of Texas Instruments Incorporated nor the names of its contributors may be used to endorse or promote products derived *
* from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT *
* OWNER OR CONTRIBUTORS 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. *
***************************************************************************************************************************************************
* MODULE CHANGE LOG *
* *
* Date Changed: Developer: *
* Change Description: *
* *
**************************************************************************************************************************************************/
/**************************************************************************************************************************************************
* Included Headers *
**************************************************************************************************************************************************/
#include "stdef.h"
#include "ADS1x9x.h"
#include "F5438_Modular_EVM_IO.h"
#include "F5438_usci.h"
#include "ECG_PC_Interface.h"
#include "UART_State_Machine.h"
/**************************************************************************************************************************************************
* Global Variables *
**************************************************************************************************************************************************/
unsigned char ADS1x9x_SPI_data;
// volatile register_name_type *register_name = (volatile register_name_type*)0xADD;
volatile unsigned char ADS1x9x_Config_1;
volatile ADS1x9x_Config_1_Register_type *ADS1x9x_Config_1_register = (volatile ADS1x9x_Config_1_Register_type*) &ADS1x9x_Config_1;
volatile unsigned char ADS1x9x_Config_2;
volatile ADS1x9x_Config_2_Register_type *ADS1x9x_Config_2_register = (volatile ADS1x9x_Config_2_Register_type*) &ADS1x9x_Config_2;
volatile unsigned char ADS1x9x_Config_3;
volatile ADS1x9x_Config_3_Register_type *ADS1x9x_Config_3_register = (volatile ADS1x9x_Config_3_Register_type*) &ADS1x9x_Config_3;
volatile unsigned char ADS1x9x_Config_4;
volatile ADS1x9x_Config_4_Register_type *ADS1x9x_Config_4_register = (volatile ADS1x9x_Config_4_Register_type*) &ADS1x9x_Config_4;
unsigned char ADS1x9x_Default_Register_Settings [22] =
{
0x86, // Config1
0x20, // Config2
0xC0, // Config3
0x00, // loff
0x00, // ch1set
0x00, // ch2set
0x00, // ch3set
0x00, // ch4set
0x00, // ch5set
0x00, // ch6set
0x00, // ch7set
0x00, // ch8set
0x00, // rld_sensp
0x00, // rld_sensm
0x00, // loff_sensp
0x00, // loff_sensm
0x00, // loff_flip
0x00, // gpio
0x00, // resp
0x00, // pace
0x00 // config4
};
const unsigned char *ADS1x9x_download_pointer = ADS1x9x_Default_Register_Settings;
volatile unsigned char ADS1x9x_Lead_Off_Control