##// END OF EJS Templates
Added OpenOCD target for olimex-arm-usb-tiny....
Added OpenOCD target for olimex-arm-usb-tiny. Working D51E5TA7601 driver. Added Framebuffer interface. Added generic memory to memory DMA api, mmainly used by framebuffer API. ADS7843 work in progress. Added SOSmartPSU bsp.

File last commit:

r103:3311a844031e dev_alexis
r103:3311a844031e dev_alexis
Show More
ADS7843.h
102 lines | 3.6 KiB | text/x-c | CLexer
/*------------------------------------------------------------------------------
-- This file is a part of the libuc, microcontroler library
-- Copyright (C) 2013, 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@member.fsf.org
-------------------------------------------------------------------------------*/
#ifndef STMPE811_H
#define STMPE811_H
#include <stdio.h>
#include <genericTC_Controler.h>
#include <spi.h>
#define ADS7843_CONFIG_MASK 0x0F
#define ADS7843_MODE_8BITS 0x08
#define ADS7843_MODE_12BITS 0x00
#define ADS7843_REFMODE_SINGLE 0x04
#define ADS7843_REFMODE_DIFF 0x00
#define ADS7843_POWER_ADC_ON 0x01
#define ADS7843_POWER_ADC_OFF 0x00
#define ADS7843_POWER_REF_ON 0x02
#define ADS7843_POWER_REF_OFF 0x00
#define ADS7843_START 0x80
#define ADS7843_MEAS_X_POS 0x50
#define ADS7843_MEAS_Y_POS 0x10
#define ADS7843_MEAS_Z1_POS 0x30
#define ADS7843_MEAS_Z2_POS 0x40
#define ADS7843_MEAS_X_POS_SINGLE (ADS7843_MEAS_X_POS |ADS7843_REFMODE_SINGLE)
#define ADS7843_MEAS_Y_POS_SINGLE (ADS7843_MEAS_Y_POS |ADS7843_REFMODE_SINGLE)
#define ADS7843_MEAS_Z1_POS_SINGLE (ADS7843_MEAS_Z1_POS|ADS7843_REFMODE_SINGLE)
#define ADS7843_MEAS_Z2_POS_SINGLE (ADS7843_MEAS_Z2_POS|ADS7843_REFMODE_SINGLE)
#define ADS7843_MEAS_TEMP0_SINGLE ( 0x00 |ADS7843_REFMODE_SINGLE)
#define ADS7843_MEAS_TEMP1_SINGLE ( 0x70 |ADS7843_REFMODE_SINGLE)
#define ADS7843_MEAS_AUX_SINGLE ( 0x60 |ADS7843_REFMODE_SINGLE)
#define ADS7843_MEAS_VBAT_SINGLE ( 0x20 |ADS7843_REFMODE_SINGLE)
#define ADS7843_MEAS_Z2_POS_SINGLE (ADS7843_MEAS_Z2_POS|ADS7843_REFMODE_SINGLE)
#define ADS7843_MEAS_X_POS_DIFF (ADS7843_MEAS_X_POS |ADS7843_REFMODE_DIFF)
#define ADS7843_MEAS_Y_POS_DIFF (ADS7843_MEAS_Y_POS |ADS7843_REFMODE_DIFF)
#define ADS7843_MEAS_Z1_POS_DIFF (ADS7843_MEAS_Z1_POS|ADS7843_REFMODE_DIFF)
#define ADS7843_MEAS_Z2_POS_DIFF (ADS7843_MEAS_Z2_POS|ADS7843_REFMODE_DIFF)
typedef struct ADS7843_t
{
spi_t spidev;
void (*setnCS)(char);
int (*busy)();
char config;
uint16_t zeroX;
uint16_t zeroY;
uint16_t zeroRtouch;
uint16_t xMin;
uint16_t xMax;
uint16_t yMin;
uint16_t yMax;
char delta;
}ADS7843_t;
extern int ads7843init(ADS7843_t *dev, spi_t spidev,char config,void (*setnCS)(char),int (*busy)());
extern int ads7843read(ADS7843_t *dev,int* x,int* y);
extern int ads7843readRtouch(ADS7843_t *dev);
extern int ads7843calibrate(ADS7843_t *dev,uint16_t zeroX,uint16_t zeroY,uint16_t zeroRtouch,uint16_t xMin,uint16_t xMax,uint16_t yMin,uint16_t yMax,char delta);
extern int ads7843isPenTouching(ADS7843_t *dev);
#endif