ads1278.c
69 lines
| 2.2 KiB
| text/x-c
|
CLexer
jeandet@pc-de-jeandet3.lab-lpp.local
|
r16 | #/*------------------------------------------------------------------------------ | ||
#-- This file is a part of the libuc, microcontroler library | ||||
#-- Copyright (C) 2011, Alexis Jeandet | ||||
#-- | ||||
#-- This program is free software; you can redistribute it and/or modify | ||||
#-- it under the terms of the GNU General Public License as published by | ||||
#-- the Free Software Foundation; either version 3 of the License, or | ||||
#-- (at your option) any later version. | ||||
#-- | ||||
#-- This program is distributed in the hope that it will be useful, | ||||
#-- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
#-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
#-- GNU General Public License for more details. | ||||
#-- | ||||
#-- You should have received a copy of the GNU General Public License | ||||
#-- along with this program; if not, write to the Free Software | ||||
#-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||||
#------------------------------------------------------------------------------- | ||||
#-- Author : Alexis Jeandet | ||||
#-- Mail : alexis.jeandet@gmail.com | ||||
#-------------------------------------------------------------------------------*/ | ||||
#include "ssp.h" | ||||
#include "ads1278.h" | ||||
//#include <bsp.h> | ||||
void ads1278open(ads1278Dev* adc,sspDev dev){ | ||||
adc->SSP_device = dev; | ||||
} | ||||
void ads1278sample(ads1278Dev* dev) | ||||
{ | ||||
bsp_ads1278_Sample(); | ||||
} | ||||
void ads1278readresult(ads1278Dev* dev,unsigned int* CH1,unsigned int* CH2,unsigned int* CH3,unsigned int* CH4,unsigned int* CH5,unsigned int* CH6,unsigned int* CH7,unsigned int* CH8) | ||||
{ | ||||
//while(!bsp_ads1278_Ready()); | ||||
CH1=0; | ||||
CH2=0; | ||||
CH3=0; | ||||
CH4=0; | ||||
CH5=0; | ||||
CH6=0; | ||||
CH7=0; | ||||
CH8=0; | ||||
for(int i=0;i<3;i++) | ||||
*CH1 = (*CH1<<8) + (0xff & sspgetc(dev->SSP_device)); | ||||
for(int i=0;i<3;i++) | ||||
*CH2 = (*CH2<<8) + (0xff & sspgetc(dev->SSP_device)); | ||||
for(int i=0;i<3;i++) | ||||
*CH3 = (*CH3<<8) + (0xff & sspgetc(dev->SSP_device)); | ||||
for(int i=0;i<3;i++) | ||||
*CH4 = (*CH4<<8) + (0xff & sspgetc(dev->SSP_device)); | ||||
for(int i=0;i<3;i++) | ||||
*CH5 = (*CH5<<8) + (0xff & sspgetc(dev->SSP_device)); | ||||
for(int i=0;i<3;i++) | ||||
*CH6 = (*CH6<<8) + (0xff & sspgetc(dev->SSP_device)); | ||||
for(int i=0;i<3;i++) | ||||
*CH7 = (*CH7<<8) + (0xff & sspgetc(dev->SSP_device)); | ||||
for(int i=0;i<3;i++) | ||||
*CH8 = (*CH8<<8) + (0xff & sspgetc(dev->SSP_device)); | ||||
} | ||||