andoid电阻触摸移植

这里我使用的是210的开发板 系统Android4.0.4 内核linux3.0.8

要用电阻屏一般都是使用tslib进行校准的 这里给个我在android上用的tslib

下载地址 http://download.csdn.net/detail/hclydao/8074069

直接把这个放在android源代码external文件夹下就可以 有几点须要注意的

tslib里我改了下Android.mk 曾经用的时候应该是模块名input被用了 所以我改成了input1

include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := eng
LOCAL_MODULE:= input1
LOCAL_PRELINK_MODULE := false
LOCAL_CFLAGS = $(CFLAGS)
LOCAL_C_INCLUDES = $(C_INCLUDES)
LOCAL_SRC_FILES =  plugins/input-raw.c
LOCAL_SHARED_LIBRARIES += libts
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/ts
include $(BUILD_SHARED_LIBRARY)

所以对应的ts.conf里也要改 我的ts.conf内容例如以下

# Uncomment if you wish to use the linux input layer event interface
module_raw input1

# Uncomment if you‘re using a Sharp Zaurus SL-5500/SL-5000d
# module_raw collie

# Uncomment if you‘re using a Sharp Zaurus SL-C700/C750/C760/C860
# module_raw corgi

# Uncomment if you‘re using a device with a UCB1200/1300/1400 TS interface
# module_raw ucb1x00

# Uncomment if you‘re using an HP iPaq h3600 or similar
# module_raw h3600

# Uncomment if you‘re using a Hitachi Webpad
# module_raw mk712

# Uncomment if you‘re using an IBM Arctic II
# module_raw arctic2

module pthres pmin=1
module variance delta=30
module dejitter delta=100
module linear

直接放在system/etc/下就能够了 注意上面的 

module_raw input1

后面的input1是和上面模块名是一样的

ts.conf最好是系统编译完毕后 在拷贝过去 或者能够直接改tslib下的 然后制作文件系统的时候还须要添加对应的几个节点 例如以下

	mkdir rootfs_dir/dev/input
	mkdir rootfs_dir/dev/graphics
	mknod rootfs_dir/dev/graphics/fb0 c 29 0
	mknod rootfs_dir/dev/input/event1  c 13 65

由于我把校准放在了init之前 基本上设备节点都没有 所以这里我自己创建 我的电阻触摸驱动是event1所以这里要加上

然后是calibrate脚本

#!/bin/sh
export TSLIB_TSDEVICE=/dev/input/event1
export TSLIB_CALIBFILE=/system/etc/pointercal
export TSLIB_CONFFILE=/system/etc/ts.conf
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/graphics/fb0
export TSLIB_PLUGINDIR=/system/lib/ts
exec /sbin/ts_calibrate

这里的TSDEVICE和FBDEVICE详细依据你自己的改

然后就是校准后的数据回写到驱动里 校准完毕后在运行这个

/system/bin/cat /etc/pointercal > /proc/driver/micc_ts

后面的/proc/driver/micc_ts依据驱动里来的 这个你能够开个服务运行就能够了

然后就是加个idc这个直接拷贝一个 名字改成你的驱动里的名字即可了 我这里是s3c-ts

文件系统改动基本都是这样了 以下上驱动 

/* linux/drivers/input/touchscreen/s3c-ts.c
 *
 * 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 2 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
 *
 * Copyright (c) 2004 Arnaud Patard <[email protected]>
 * iPAQ H1940 touchscreen support
 *
 * ChangeLog
 *
 * 2004-09-05: Herbert Potzl <[email protected]>
 *	- added clock (de-)allocation code
 *
 * 2005-03-06: Arnaud Patard <[email protected]>
 *      - h1940_ -> s3c24xx (this driver is now also used on the n30
 *        machines :P)
 *      - Debug messages are now enabled with the config option
 *        TOUCHSCREEN_S3C_DEBUG
 *      - Changed the way the value are read
 *      - Input subsystem should now work
 *      - Use ioremap and readl/writel
 *
 * 2005-03-23: Arnaud Patard <[email protected]>
 *      - Make use of some undocumented features of the touchscreen
 *        controller
 *
 * 2006-09-05: Ryu Euiyoul <[email protected]>
 *      - added power management suspend and resume code
 *
 */

#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/input.h>
#include <linux/init.h>
#include <linux/serio.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/clk.h>
#ifdef CONFIG_HAS_EARLYSUSPEND
#include <linux/earlysuspend.h>
#endif
#include <linux/io.h>
#include <asm/irq.h>
#include <mach/hardware.h>

#include <mach/regs-adc.h>
#include <mach/ts-s3c.h>
#include <mach/irqs.h>
#include <linux/proc_fs.h>
#include <asm/uaccess.h>

/* For ts->dev.id.version */
#define S3C_TSVERSION	0x0101

#define WAIT4INT(x)	(((x)<<8) | 			S3C_ADCTSC_YM_SEN | S3C_ADCTSC_YP_SEN | 			S3C_ADCTSC_XP_SEN | S3C_ADCTSC_XY_PST(3))

#define AUTOPST	(S3C_ADCTSC_YM_SEN | S3C_ADCTSC_YP_SEN | 		 S3C_ADCTSC_XP_SEN | S3C_ADCTSC_AUTO_PST | 		 S3C_ADCTSC_XY_PST(0))

#ifdef CONFIG_HAS_EARLYSUSPEND
static void ts_early_suspend(struct early_suspend *h);
static void ts_late_resume(struct early_suspend *h);
#endif

/* Touchscreen default configuration */
struct s3c_ts_mach_info s3c_ts_default_cfg __initdata = {
	.delay			= 10000,
	.presc			= 49,
	.oversampling_shift	= 2,
	.resol_bit		= 10
};

/*
 * Definitions & global arrays.
 */
static char *s3c_ts_name = "s3c-ts";
static void __iomem		*ts_base;
static struct resource		*ts_mem;
static struct resource		*ts_irq;
static struct clk		*ts_clock;
static struct s3c_ts_info	*ts;

static struct proc_dir_entry *ts_proc_entry;

signed long pointercal[7] = {1,0,0,0,1,0,1};

static int SCREEN_X=800;
static int SCREEN_Y=480;

#define  TSNUM  8
static   int  ts_x[TSNUM];
static   int  ts_y[TSNUM];
//上层回写保存上层tslib校准后的数据
static int ts_proc_write(struct file *file, const char *buffer,
			     unsigned long count, void *data)
{
	char buf[256];
	unsigned long len;
	char *p = (char *)buf;
	int i,j;
	int flag = 1;
	memset(buf,0,256);
	len = min_t(unsigned long, sizeof(buf) - 1, count);

	if (copy_from_user(buf, buffer, len))
		return count;

	j = 0;
	for(i=0;i<len;i++)
	{
		if(flag)
		{
			pointercal[j] = simple_strtol(p, &p, 10);
			j++;
			if(j>=7)
				break;
			flag = 0;
		}

		if(p[0] == ‘ ‘)
		{
			flag = 1;
		}
		if(p[0] == ‘\t‘)
		{
			flag = 1;
		}
		p++;
	}
	return count;
}

static void data_select() {
}

static void touch_timer_fire(unsigned long data)
{
	unsigned long data0;
	unsigned long data1;
	int updown;
	int x, y;
	long a,b,c,d,e,f,div;
	int i,j,tmp;

	data0 = readl(ts_base+S3C_ADCDAT0);
	data1 = readl(ts_base+S3C_ADCDAT1);

	updown = (!(data0 & S3C_ADCDAT0_UPDOWN)) &&
		 (!(data1 & S3C_ADCDAT1_UPDOWN));

	if (updown) {
		if (ts->count) {
			a = pointercal[0];
			b = pointercal[1];
			c = pointercal[2];
			d = pointercal[3];
			e = pointercal[4];
			f = pointercal[5];
			div = pointercal[6];
			for(j=(TSNUM-1);j>0;j--)
			  for(i = 0; i < j;i++)
			  {
			      if (ts_x[i] < ts_x[i+1])
			      {
					tmp = ts_x[i+1];
					ts_x[i+1]  = ts_x[i];
					ts_x[i] = tmp;
			      }
			     if (ts_y[i] < ts_y[i+1])
			      {
					tmp = ts_y[i+1];
					ts_y[i+1]  = ts_y[i];
					ts_y[i] = tmp;
			      }

			 }  

			tmp = 0;
			for (i=TSNUM/4;i<(TSNUM*3/4);i++)
			   tmp+=ts_x[i];
			ts->xp = tmp*2/TSNUM;

			tmp = 0;
			for (i=TSNUM/4;i<(TSNUM*3/4);i++)
			   tmp+=ts_y[i];
			ts->yp  = tmp*2/TSNUM;
                        //校准后上报
			x = (a*ts->xp + b*ts->yp + c)/div;
			y = (d*ts->xp + e*ts->yp + f)/div;
			input_report_abs(ts->dev, ABS_X, x);
			input_report_abs(ts->dev, ABS_Y, y);

			input_report_key(ts->dev, BTN_TOUCH, 1);
			input_report_abs(ts->dev, ABS_PRESSURE, 1);//这个地方要注意前面是abs
			input_sync(ts->dev);
		}

		ts->xp = 0;
		ts->yp = 0;
		ts->count = 0;

		writel(S3C_ADCTSC_PULL_UP_DISABLE | AUTOPST,
				ts_base + S3C_ADCTSC);
		writel(readl(ts_base+S3C_ADCCON) | S3C_ADCCON_ENABLE_START,
				ts_base + S3C_ADCCON);
	} else {
		ts->count = 0;
		input_report_key(ts->dev, BTN_TOUCH, 0);
		input_report_abs(ts->dev, ABS_PRESSURE, 0);
		input_sync(ts->dev);
		writel(WAIT4INT(0), ts_base+S3C_ADCTSC);
	}
}

static struct timer_list touch_timer =
		TIMER_INITIALIZER(touch_timer_fire, 0, 0);

static irqreturn_t stylus_updown(int irqno, void *param)
{
	unsigned long data0;
	unsigned long data1;
	int updown;

	data0 = readl(ts_base + S3C_ADCDAT0);
	data1 = readl(ts_base + S3C_ADCDAT1);
	updown = (!(data0 & S3C_ADCDAT0_UPDOWN)) &&
		 (!(data1 & S3C_ADCDAT1_UPDOWN));

	/* TODO we should never get an interrupt with updown set while
	 * the timer is running, but maybe we ought to verify that the
	 * timer isn‘t running anyways. */

	if (updown)
		touch_timer_fire(0);

	if (ts->s3c_adc_con == ADC_TYPE_2) {
		__raw_writel(0x0, ts_base + S3C_ADCCLRWK);
		__raw_writel(0x0, ts_base + S3C_ADCCLRINT);
	}

	return IRQ_HANDLED;
}

static irqreturn_t stylus_action(int irqno, void *param)
{
	unsigned long data0;
	unsigned long data1;

	data0 = readl(ts_base + S3C_ADCDAT0);
	data1 = readl(ts_base + S3C_ADCDAT1);
	if (ts->resol_bit == 12) {
		ts_x[ts->count] =  (data0 & S3C_ADCDAT0_XPDATA_MASK_12BIT);
		ts_y[ts->count] =  data1 & S3C_ADCDAT1_YPDATA_MASK_12BIT;
	} else {
		ts_x[ts->count] = S3C_ADCDAT0_XPDATA_MASK_12BIT - (data0 & S3C_ADCDAT0_XPDATA_MASK_12BIT);
		ts_y[ts->count] = S3C_ADCDAT1_YPDATA_MASK_12BIT - (data1 & S3C_ADCDAT1_YPDATA_MASK_12BIT);
	}

	ts->count++;

	if (ts->count < TSNUM) {
		writel(S3C_ADCTSC_PULL_UP_DISABLE | AUTOPST,
				ts_base + S3C_ADCTSC);
		writel(readl(ts_base + S3C_ADCCON) | S3C_ADCCON_ENABLE_START,
				ts_base + S3C_ADCCON);
	} else {
		mod_timer(&touch_timer, jiffies + 1);
		writel(WAIT4INT(1), ts_base + S3C_ADCTSC);
	}

	if (ts->s3c_adc_con == ADC_TYPE_2) {
		__raw_writel(0x0, ts_base+S3C_ADCCLRWK);
		__raw_writel(0x0, ts_base+S3C_ADCCLRINT);
	}
	return IRQ_HANDLED;
}

static struct s3c_ts_mach_info *s3c_ts_get_platdata(struct device *dev)
{
	if (dev->platform_data != NULL)
		return (struct s3c_ts_mach_info *)dev->platform_data;

	return &s3c_ts_default_cfg;
}

/*
 * The functions for inserting/removing us as a module.
 */
static int __init s3c_ts_probe(struct platform_device *pdev)
{
	struct resource *res;
	struct device *dev;
	struct input_dev *input_dev;
	struct s3c_ts_mach_info *s3c_ts_cfg;
	int ret, size;
	int irq_flags = 0;
#if defined(CONFIG_FB_S3C_AT070)
		SCREEN_X = 800;
		SCREEN_Y = 480;
#endif
	dev = &pdev->dev;

	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	if (res == NULL) {
		dev_err(dev, "no memory resource specified\n");
		return -ENOENT;
	}

	size = (res->end - res->start) + 1;
	ts_mem = request_mem_region(res->start, size, pdev->name);
	if (ts_mem == NULL) {
		dev_err(dev, "failed to get memory region\n");
		ret = -ENOENT;
		goto err_req;
	}

	ts_base = ioremap(res->start, size);
	if (ts_base == NULL) {
		dev_err(dev, "failed to ioremap() region\n");
		ret = -EINVAL;
		goto err_map;
	}

	ts_clock = clk_get(&pdev->dev, "adc");
	if (IS_ERR(ts_clock)) {
		dev_err(dev, "failed to find watchdog clock source\n");
		ret = PTR_ERR(ts_clock);
		goto err_clk;
	}

	clk_enable(ts_clock);

	s3c_ts_cfg = s3c_ts_get_platdata(&pdev->dev);
	if ((s3c_ts_cfg->presc & 0xff) > 0)
		writel(S3C_ADCCON_PRSCEN |
				S3C_ADCCON_PRSCVL(s3c_ts_cfg->presc & 0xFF),
				ts_base+S3C_ADCCON);
	else
		writel(0, ts_base + S3C_ADCCON);

	/* Initialise registers */
	if ((s3c_ts_cfg->delay & 0xffff) > 0)
		writel(s3c_ts_cfg->delay & 0xffff, ts_base + S3C_ADCDLY);

	if (s3c_ts_cfg->resol_bit == 12) {
		switch (s3c_ts_cfg->s3c_adc_con) {
		case ADC_TYPE_2:
			writel(readl(ts_base + S3C_ADCCON) |
					S3C_ADCCON_RESSEL_12BIT,
					ts_base + S3C_ADCCON);
			break;

		case ADC_TYPE_1:
			writel(readl(ts_base + S3C_ADCCON) |
					S3C_ADCCON_RESSEL_12BIT_1,
					ts_base + S3C_ADCCON);
			break;

		default:
			dev_err(dev, "this type of AP isn‘t supported !\n");
			break;
		}
	}

	writel(WAIT4INT(0), ts_base + S3C_ADCTSC);

	ts = kzalloc(sizeof(struct s3c_ts_info), GFP_KERNEL);

	input_dev = input_allocate_device();
	if (!input_dev) {
		ret = -ENOMEM;
		goto err_alloc;
	}

	ts->dev = input_dev;

	ts->dev->evbit[0] = BIT_MASK(EV_SYN) | BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
	ts->dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);

	if (s3c_ts_cfg->resol_bit == 12) {
		input_set_abs_params(ts->dev,ABS_X, 0, SCREEN_X, 0, 0);
		input_set_abs_params(ts->dev,ABS_Y, 0, SCREEN_Y, 0, 0);
	} else {
		input_set_abs_params(ts->dev, ABS_X, 0, SCREEN_X, 0, 0);
		input_set_abs_params(ts->dev, ABS_Y, 0, SCREEN_Y, 0, 0);
	}

	input_set_abs_params(ts->dev, ABS_PRESSURE, 0, 1, 0, 0);

	sprintf(ts->phys, "input(ts)");

	ts->dev->name = s3c_ts_name;//文件系统里idc名字与这个要一致
	ts->dev->phys = ts->phys;
	ts->dev->id.bustype = BUS_RS232;
	ts->dev->id.vendor = 0xDEAD;
	ts->dev->id.product = 0xBEEF;
	ts->dev->id.version = S3C_TSVERSION;

	ts->shift = s3c_ts_cfg->oversampling_shift;
	ts->resol_bit = s3c_ts_cfg->resol_bit;
	ts->s3c_adc_con = s3c_ts_cfg->s3c_adc_con;

#ifdef CONFIG_HAS_EARLYSUSPEND
	ts->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1;
	ts->early_suspend.suspend = ts_early_suspend;
	ts->early_suspend.resume = ts_late_resume;
	register_early_suspend(&ts->early_suspend);
#endif

	/* For IRQ_PENDUP */
	ts_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
	if (ts_irq == NULL) {
		dev_err(dev, "no irq resource specified\n");
		ret = -ENOENT;
		goto err_irq;
	}

	ret = request_irq(ts_irq->start, stylus_updown, irq_flags,
			"s3c_updown", ts);
	if (ret != 0) {
		dev_err(dev, "s3c_ts.c: Could not allocate ts IRQ_PENDN !\n");
		ret = -EIO;
		goto err_irq;
	}

	/* For IRQ_ADC */
	ts_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 1);
	if (ts_irq == NULL) {
		dev_err(dev, "no irq resource specified\n");
		ret = -ENOENT;
		goto err_irq;
	}

	ret = request_irq(ts_irq->start, stylus_action, irq_flags,
			"s3c_action", ts);
	if (ret != 0) {
		dev_err(dev, "s3c_ts.c: Could not allocate ts IRQ_ADC !\n");
		ret =  -EIO;
		goto err_irq;
	}

	printk(KERN_INFO "%s got loaded successfully : %d bits\n",
			s3c_ts_name, s3c_ts_cfg->resol_bit);

	/* All went ok, so register to the input system */
	ret = input_register_device(ts->dev);
	if (ret) {
		dev_err(dev, "Could not register input device(touchscreen)!\n");
		ret = -EIO;
		goto fail;
	}

	ts_proc_entry = create_proc_entry("driver/micc_ts", 0, NULL); //创建上层节点
	if (ts_proc_entry) {
		ts_proc_entry->write_proc = ts_proc_write;
	}  

	return 0;

fail:
	free_irq(ts_irq->start, ts->dev);
	free_irq(ts_irq->end, ts->dev);

err_irq:
	input_free_device(input_dev);
	kfree(ts);

err_alloc:
	clk_disable(ts_clock);
	clk_put(ts_clock);

err_clk:
	iounmap(ts_base);

err_map:
	release_resource(ts_mem);
	kfree(ts_mem);

err_req:
	return ret;
}

static int s3c_ts_remove(struct platform_device *dev)
{
	printk(KERN_INFO "s3c_ts_remove() of TS called !\n");

	disable_irq(IRQ_ADC);
	disable_irq(IRQ_PENDN);

	free_irq(IRQ_PENDN, ts->dev);
	free_irq(IRQ_ADC, ts->dev);

	if (ts_clock) {
		clk_disable(ts_clock);
		clk_put(ts_clock);
		ts_clock = NULL;
	}

#ifdef CONFIG_HAS_EARLYSUSPEND
     unregister_early_suspend(&ts->early_suspend);
#endif

	input_unregister_device(ts->dev);
	iounmap(ts_base);

	return 0;
}

#ifdef CONFIG_PM
static unsigned int adccon, adctsc, adcdly;

static int s3c_ts_suspend(struct platform_device *dev, pm_message_t state)
{
	adccon = readl(ts_base+S3C_ADCCON);
	adctsc = readl(ts_base+S3C_ADCTSC);
	adcdly = readl(ts_base+S3C_ADCDLY);

	disable_irq(IRQ_ADC);
	disable_irq(IRQ_PENDN);

	clk_disable(ts_clock);

	return 0;
}

static int s3c_ts_resume(struct platform_device *pdev)
{
	clk_enable(ts_clock);

	writel(adccon, ts_base+S3C_ADCCON);
	writel(adctsc, ts_base+S3C_ADCTSC);
	writel(adcdly, ts_base+S3C_ADCDLY);
	writel(WAIT4INT(0), ts_base+S3C_ADCTSC);

	enable_irq(IRQ_ADC);
	enable_irq(IRQ_PENDN);

	return 0;
}
#else
#define s3c_ts_suspend NULL
#define s3c_ts_resume  NULL
#endif

#ifdef CONFIG_HAS_EARLYSUSPEND
static void ts_early_suspend(struct early_suspend *h)
{
	struct s3c_ts_info *ts;
	ts = container_of(h, struct s3c_ts_info, early_suspend);
	s3c_ts_suspend(NULL, PMSG_SUSPEND);
}

static void ts_late_resume(struct early_suspend *h)
{
	struct s3c_ts_info *ts;
	ts = container_of(h, struct s3c_ts_info, early_suspend);
	s3c_ts_resume(NULL);
}
#endif

static struct platform_driver s3c_ts_driver = {
       .probe          = s3c_ts_probe,
       .remove         = s3c_ts_remove,
       .suspend        = s3c_ts_suspend,
       .resume         = s3c_ts_resume,
       .driver		= {
		.owner	= THIS_MODULE,
		.name	= "s3c-ts",
	},
};

static char banner[] __initdata = KERN_INFO 		"S5P Touchscreen driver, (c) 2008 Samsung Electronics\n";

static int __init s3c_ts_init(void)
{
	printk(banner);
	return platform_driver_register(&s3c_ts_driver);
}

static void __exit s3c_ts_exit(void)
{
	platform_driver_unregister(&s3c_ts_driver);
}

module_init(s3c_ts_init);
module_exit(s3c_ts_exit);

MODULE_AUTHOR("Samsung AP");
MODULE_DESCRIPTION("S5P touchscreen driver");
MODULE_LICENSE("GPL");

仅仅是在ADC驱动里加了一些东西 详细ADC驱动就不说了 大致的一些解释都写上面了 基本上就这个样了

改动完毕后 測试效果还是不错地.

时间: 2024-11-05 06:26:06

andoid电阻触摸移植的相关文章

四轴飞行器1.6 emwin与ucgui的移植,汉字外挂字库移植和DEMO效果对比

飞控的遥控器打算自己做,这样全局都能掌握,可以通过遥控器对飞控的参数和飞行模式进行修改,而买遥控器是做不到这样的哈..以后做图传的时候,屏幕还可以实时现实摄像头拍回来的画面,挺好的哈.. 做遥控我们选的是原子的战舰开发板,开发板附带小霸王那种遥控器,可以用这个来控制飞控哈,回忆童年有木有...板子还带一个ADXL345的加速度传感器,那还可以用开发板的姿态控制飞控的姿态..哈..应该挺好玩... 第一步我们打算先写一个GUI的界面,UI这东西就让我头疼哈.额..打算第一版就没什么UI,就把要显示

AD电阻转换---那些年我们一起玩mini2440(arm9)裸机

ADC驱动程序设计 ADC:模/数转换器. 一种将模拟信号转换成数字信号的装置: DAC:数/模转换器. 一种将数字信号转换成模拟信号的装置. 模拟信号转换为数值信号的步骤: 1.     取值: 2.     量化: 3.     编码: S3C2440ADC S3C2440芯片内部共有8路A/D转换通道AIN0~AIN7,但是转换器只有一个. 转换精度为10位,故转换后的值最小时会接近0,最大时会接近1024. 最大的转换率在2.5MHZ转换时钟下能达到500KSPS(每秒采样5000千次)

【转】朱兆祺带你一步一步学习嵌入式(连载)

原文网址:http://bbs.elecfans.com/jishu_357014_2_1.html#comment_top  从最初涉及嵌入式Linux开始到现在,深深的知道嵌入式的每一步学习都是举步维艰.从去年11月份开始,我就着手整理各种学习资料,希望推动嵌入式学习的前进贡献自己微不足道的一份力量.从去年到现在,将C语言的学习经验整理成<攻破C语言笔试与机试陷阱及难点>(现在仍在更新),这份资料已经在电子发烧友论坛的单片机论坛连载(http://bbs.elecfans.com/jish

【STM32H7教程】第51章 STM32H7的LTDC应用之LCD汉字显示和2D图形显示

完整教程下载地址:http://www.armbbs.cn/forum.php?mod=viewthread&tid=86980 第51章       STM32H7的LTDC应用之LCD汉字显示和2D图形显示 本章教程为大家讲解LTDC应用中最基本的汉字显示和2D图形显示功能实现. 51.1 初学者重要提示 51.2 LCD相关的基础支持 51.3 LCD硬件设计 51.4 LCD驱动设计 51.5 LCD板级支持包(bsp_ltdc_h7.c和bsp_tft_lcd.c) 51.6 LCD的

arm方案商,三星解决方案S5P4418核心板

产品简介 G4418开发平台采用邮票孔的核心板+底板方式设计,核心板可扩展性强,多达 184 PIN 管脚,运行速度高达 1.4GHz.PCB 采用 8 层沉金工艺设计,具有最佳的电气特性和抗干扰特性,工作稳定可靠.核心板板载了 PMU,带库仑计的充电管理,可以广泛应用于 MID,POS,PDA,PND,智能家居,手机,车机,学习机,游戏机以及其他各种工控领域. S5P4418 采用 28nm 制作工艺,内置高性能 4 核 A9 ARM 架构,相比 Exynos4412, 在多媒体性能上,它几乎

[转发]RTH试用手记之“外场应用”

年初,罗德与施瓦茨公司(Rohde & Schwarz)推出了第一款的手持示波器,从指标上看,该示波器打破了传统手持器功能简单.指标水平低.结构粗糙的印象,取而代之达到了主流台式数字示波器的性能,在使用方式和功能上,将手持示波器的发展到了一个新的水平.华睿集成有幸较早的获得了RTH试用的资格,我们通过实际的测试和比较,看看这一款新定义的手持示波器到底能给客户带来多大的惊喜. 作为一款手持示波器,会经常应用在外场环境,这就要求设备在设计和定义中,要全面考虑外场的环境和条件,那RTH针对外场环境有哪

【分享】【原创开源应用第4期】给ili9488,RA8875类显示屏的emWin底层增加DMA加速方案

说明:1.emWin底层中最重要的一个优化就是16bpp绘制,特此为其增加DMA加速,已经支持RA8875和ili9488.2.使用中务必将emWin任务设置为除了空闲任务,统计任务以外的最低优先级,这样就可以有效的发挥DMA的优势,CPU可以解放出来处理其他任务. 操作说明:1. 所有界面支持按键操作(1)K2按键用于控件焦点的切换,切换时,所选择的控件会出现浅色边框(2)K3按键用于进入下一个界面(3)摇杆的OK键用于选择相应控件后,触发控件所对应的的操作. 2. 如果使用电阻触摸操作的话,

基于飞凌FET1052-C控制永磁同步交流伺服电机方案

一.前言介绍,背景描述运动控制.精密控制是目前众多行业设备的需求,为了使这些设备能以最佳的性能工作,采用经过改进的新型马达控制技术是关键所在.能效的提高是趋势所向,新技术同时还能带来更多的优势,如实现更加平稳的工作,大幅度降低噪声水平.众多制造商正在应对这些挑战,马达市场正在被更加高效的方案替代,如直流无刷(BLDC)和永磁同步电机(PMSM). 近年来,采用全数字控制方法,以永磁交流电机为控制对象的全数字交流伺服系统正在逐渐取代以直流电机为控制对象的直流伺服系统和采用模拟控制技术的模拟式交流伺

NUC970平台触摸屏驱动移植

原理概述 1.首先要区分lcd和触摸屏,lcd是一个屏幕,触摸屏是贴在lcd上的两层膜. 2.四线电阻触摸屏的原理:触摸屏就是上下两层膜,比如上层代表x轴(XM:负端,XP:正端),下层代表y轴(YM:负端,YP:正端).当读取x轴坐标时,XP接3.3v,XM接地,从YM读取按下点的电压值作为模拟输入信号,再经过AD转换后就得到了x轴坐标.同理,当读取y轴坐标时,YP接3.3v,YM接地,从XM读取按下点的电压值作为模拟输入,再经过AD转换后就得到了y轴坐标. 触摸屏驱动程序采用中断方式对触摸笔