全志主线内核lradc 按键的一种调试方法

全志A20 keyadc驱动程序及toolbox测试代码 //TODO: keyadc驱动程序 /* * linux/drivers/char/keyadc.c * * Copyright (C) 2013 Jack chen, chwenj@gmail.com * * - Base on Allwinner A20 K70 platform; * * This file is subject to the terms 阅读详情

通过dev_info打印出电压的值

通过修改 /drivers/input/keyboard/sun4i-lradc-keys.c
实现在dmesg内打印lradc检测到的电压

From 7d2532e1274f75a9d157cbe0e8a4cee3c7760db4 Mon Sep 17 00:00:00 2001
From: handsomeyingyan <handsomeyingyan@github.com>
Date: Mon, 10 May 2021 11:12:20 +0800
Subject: [PATCH] debug : display voltage in sun4i-lradc

---
 drivers/input/keyboard/sun4i-lradc-keys.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/input/keyboard/sun4i-lradc-keys.c b/drivers/input/keyboard/sun4i-lradc-keys.c
index 4a796bed4..3e24dad3c 100755
--- a/drivers/input/keyboard/sun4i-lradc-keys.c
+++ b/drivers/input/keyboard/sun4i-lradc-keys.c
@@ -91,6 +91,9 @@ struct sun4i_lradc_data {
 	u32 vref;
 };
 
+// hack: just for testing
+static struct device *lradc_dev;
+
 static irqreturn_t sun4i_lradc_irq(int irq, void *dev_id)
 {
 	struct sun4i_lradc_data *lradc = dev_id;
@@ -111,7 +114,10 @@ static irqreturn_t sun4i_lradc_irq(int irq, void *dev_id)
 	if ((ints & CHAN0_KEYDOWN_IRQ) && lradc->chan0_keycode == 0) {
 		val = readl(lradc->base + LRADC_DATA0) & 0x3f;
 		voltage = val * lradc->vref / 63;
-
+		
+		// debug hack : display voltage in dmesg
+		dev_info(lradc_dev, "Debug: a %u V button pressed\n", voltage);
+		
 		for (i = 0; i < lradc->chan0_map_count; i++) {
 			diff = abs(lradc->chan0_map[i].voltage - voltage);
 			if (diff < closest) {
@@ -228,6 +234,9 @@ static int sun4i_lradc_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	int i;
 	int error;
+	
+	// hack : just for testing
+	lradc_dev = &pdev->dev;
 
 	lradc = devm_kzalloc(dev, sizeof(struct sun4i_lradc_data), GFP_KERNEL);
 	if (!lradc)
-- 
2.31.1
【全志R128外设模块配置】USB外设功能配置 USB 功能模块包括了USB Host,USB Device 和OTG 功能。USB Host 目前已经支持上的功能有:Mass Storage,UVC。USB Device 目前已经支持上的功能有:ADB,UAC。OTG 主要用作Host 与Device 的切换,如当板子通过 USB 线连接到 USB 主机 (PC) 上时, 此时 OTG 是加载成 USB Device;若当前板子是通过 OTG 线连接一个USB 设备,此时 OTG 则加载 成 USB Host。sys_config.fex 中主要是对 阅读详情

相关推荐

lradc按键驱动程序分析(for F1C100S)

#include <linux/err.h> #include <linux/init.h> #include <linux/input.h> #include <linux/interrupt.h> #include <linux/io.h> #include <linux/module.h> #include <li...

Yfw的博客 2672

全志A33 Android4.4 修改adckey的按键功能

以前在瑞芯微的平台上调试过adckey,也修改过adckey对应的功能,当时在瑞芯微平台上的需求是将recovery按键修改成back按键,修改方法也很简单,在dts设备树里面只要修改对应的key值为back的key值就行。现在全志A33平台的需求是将vol+按键修改成back按键,调查后发现全志平台的修改就没有像瑞芯微平台这么简单了,在A33的sys_config.fex的配置文件里面,没有对adckey的配置操作,这样子的话只能自己去驱动里面去修改对应内容,修改过程如下: 1.一开始并不清楚如何下手.

Mrdeath的博客 1927

PLUS模型土地利用变化模拟使用简介

因子包括自然因子如社会因子,通过计算整理得到新图层,并以tif文件输出到驱动因子的文件夹里,驱动因子文件夹里存放的是tif文件格式。线性回归使用提供的所有的LULC资源数据,可以选择往后预测的年数,选择好数据之后,可以得出预测的每一年的每一用地类型面积数据。在此过程之后,可以继续使用此CARS输入的数据继续模拟,也可返回二(3)中CARS模块,重新输入不同的年份预测。在此过程之后,可以继续使用此CARS输入的数据继续模拟,也可返回二(3)中CARS模块,重新输入不同的年份预测。

qq_42831270的博客 5806

全志A20 keyadc驱动程序

/* * linux/drivers/char/keyadc.c * * Copyright (C) 2013 Jack Chen, chwenj@gmail.com * * - Base on Allwinner A20 K70 platform; * * This file is subject to the terms and conditions of the ...

Yfw的博客 1395

论文阅读笔记:Extended Vision Transformer (ExViT) for Land Use and Land Cover Classification

注意力机制驱动的深度模型最近取得了成功,如最具代表性的视觉转换器(ViT),吸引了一波高级研究来探索它们对更广泛领域的适应。然而,遥感(RS)领域中基于Transformer的方法更关注单模态数据,这可能会在充分利用不断增长的多模态地球观测数据时失去可扩展性。为此,我们提出了一种新的多模式深度学习框架,通过在最小修改的情况下扩展传统的ViT,针对土地利用和土地覆盖(LULC)分类任务。

嗑研狗的日常 945

【实战指南】WinPE环境下360系统急救箱的病毒查杀全流程解析

本文详细解析了在WinPE环境下使用360系统急救箱进行病毒查杀的全流程。从制作WinPE启动盘到进入PE环境,再到360急救箱的深度使用和系统修复,提供了实用技巧和常见问题解决方案,帮助用户高效清除顽固病毒。

weixin_28568819的博客 535

【全志V3S开发】(十)-LRADC按键

全志V3S 的LRADC(低分辨率模数转换器,Low Resolution Analog to Digital Converter)是一个简单的模数转换模块,通常用于读取模拟信号,如电池电压、键盘输入或其他低频率的模拟传感器输入。

Daemon.Chen的博客 1333

RiscV运行zephyr和Linux的方法

riscv基金会搞了一个网站,用于介绍如何使用riscv指令集进行开发。 对于运行zephyr和linux以及Qemu有非常大的帮助。 可以作为riscv开发的相关参考。 RISC-V - Getting Started Guide — RISC-V - Getting Started Guidehttps://risc-v-getting-started-guide.readthedocs.io/en/latest/index.html RISC-V - Getting Started Gu.

闲人的专栏 736

全志V3S嵌入式驱动开发-多按键输入驱动

我们通过printk&dmesg打印,也验证了这一想法,所以如果需要得到正确的按键数值,只需要修正一下sun4i-lradc-keys.c中的判断逻辑就可以了,修改方法如下,具体的标定数值可以做实验来解决,这说明,硬件,没问题。一般来说,如果按键ok的话,会在设备启动的时候生成个/dev/input/event0节点,此时,如果编写一个应用程序,读写这些节点,就完全可以获取相关的按键信息。但是实际运行的时候,发现按键被按下的时候,有三个按键的数值居然是一样的,都是352,另外一个是114。

DOT小文哥的博客 713

Verilog单周期CPU设计(超详细)

实验 单周期CPU一、设计目的与目标实验内容实验要求二、课程设计器材硬件平台软件平台三、 CPU逻辑设计总体方案指令模块MIPS指令格式指令处理流程数据通路总体结构图设计流程逻辑图四、模块详细设计PCAdd4PCINSTMEMDATAMEMSHIFTER32_L2SHIFTER_COMBINATIONMUX4X32MUX2X5EXT16T32MUX2X32CONUNITREGFILEALUSing...

Ace Cheney的博客 9万+

NetSuite软件二次开发:NetSuite二次开发最佳实践与案例分析

SuiteScript是NetSuite提供的一种用于二次开发的脚本语言,它基于JavaScript,但添加了特定的API和框架,以支持NetSuite平台的业务逻辑开发。SuiteScript有两种版本:SuiteScript 1.0和SuiteScript 2.0,后者提供了更现代的面向对象编程模型,增强了代码的可读性和可维护性。NetSuite允许用户自定义字段以满足特定的业务需求。这些字段可以添加到现有的记录类型中,也可以用于自定义记录。自定义字段可以是文本、数字、日期、下拉列表等多种类型。

kkchenjj的博客 1465

荔枝派zero适配内核驱动:按键输入设备(LRADC)

荔枝派zero(全志v3s)适配内核驱动,注册按键输入设备,实现检测开发板上的按键

my_fly_dream的博客 1346

ROS局部路径规划器插件teb_local_planner流程梳理(上)

在我之前的文章《ROS导航包Navigation中的 Movebase节点路径规划相关流程梳理》中已经介绍过Move_base节点调用局部路径规划器插件的接口函数是computeVelocityCommands,接下来,我们就从这个函数入手梳理一下teb_local_planner功能包的工作流程。

慕羽★的博客 5165

ARM Linux DIY(十)LRADC 按键

有时 ARM SOC 需要三五个按键,这时候 LRADC 就是一个不错的选择,它使用一个引脚,就可以扩展几个到几十个按键。

lyndon 1609

【ComfyUI】FluxKontext 人物服装平铺重构

本文介绍了一个基于ComfyUI的高保真服装语义提取工作流,利用FluxKontext模型实现人物服装结构的精准抽离与平铺展示。工作流包含图像输入、潜空间处理、语义引导和生成输出四个阶段,通过Flux_Kontext_dev_fp8主模型、双CLIP文本编码和VAE转换等核心组件,配合FluxKontextImageScale、ReferenceLatent等节点完成服装结构的稳定提取。流程中CLIPTextEncode负责语义解析,FluxGuidance强化引导力度,KSampler执行最终生成,最终输

Mr数据杨 956

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

嵌入式Linux驱动:LRADC按键

文章目录一、修改设备树1、添加pinctrl节点2、驱动源码3、驱动测试 KEY_ADC0:112–LRADC0 参考:https://blog.youkuaiyun.com/lengyuefeng212/article/details/120033179 参考:https://dandelioncloud.cn/article/details/1419660822644854785/ 参考:https://blog.youkuaiyun.com/u012577474/article/details/103166505 一、

似水流年 1万+

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

【Allwinner ClassA20类库分析】6.LRADC类的使用

本节讲述LRADC类的使用方法,请先在https://github.com/tjCFeng/ClassA20下载ClassA20类库。     先来说一下A20的ADC。A20的ADC共有两种,一种是LRADC,另一种是TPController。          LARADC,是一种低分辨率的模数转换器,按照用途A20常把它当作按键检测的通道,可以检测长按、短按、按下、抬起

tjCFeng的专栏 3115

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

全志V3s开发板ADC开发笔记

ADC被用于按钮识别,在\linux-3.4\drivers\input\keyboard\sunxi-keyboard.c中被调用。 由于ADC被占用,如果想用于其他功能,就要在内核配置中去掉sunxi keyboard选项。 驱动分析: 1. 在驱动prob时有三个步骤 (1)调用初始化函数: static void battery_adc_init(void) { script_item_u script_val; script_item_value_type_e type...

chenben的专栏 3279

全志A33-gpio驱动程序

开发环境 Ubuntu:14.04 开发板:A33-Vstar 开发板系统:android 4.4 、linux-3.4.39 交叉编译器:arm-linux-gnueabi-gcc 4.7.3 -----------------------------------------------------   1. 驱动程序 1)采用Linux gpio api,具有很好的移植性 2...

ARM-Linux 5347

linux按键驱动设计(V3S开发板)

本文描述了基于全志V3S开发板的按键驱动程序和测试应用程序的设计流程。本次设计系统内核是基于linux3.4。本次设计的步骤是:步骤一、编写一个driver_button.c的驱动程序。步骤二、编写makefile文件,编译得到ko。步骤三、编写一个app_button.c的测试应用程序。步骤四、在V3S开发板中安装demo_driver驱动程序,并测试app_button应用程序。

li_man_man_man的博客 3652

ADC检测多个按键

按照传统的按键检测方法就是一个按键对应一个IO口,进行高低电平检测。可是在IO口紧缺的情况下,不得不需要一个有效的解决方案 借鉴网上的资料了解到一个简单的方法,希望分享一下。 ADC检测实现简单实用的按键方法:仅需要一个AD口和若干个电阻就可实现多个按键的输入检测。 工作原理:按下按键时,通过电阻分压得到不同的电压值。 摘录网上的图片 根据上述电路,4个1K的电阻

明镜台 2万+

全志A83T硬件设计指南

全志A83T原理图设计指南: CPU 1. REXT网络到地电阻200K-1%值不能修改。 2. UART调试请保留测试点。 3. GPIO分配请按照标案图进行,切勿随意调整。如确需调整,请与相关FAE沟通。 4. 高频晶振的网络X24MO上串接电阻必须保留。 5. A83T采用CPU、SYS、GPU独立电源域供电(VDD-CPUA、VDD-CPUB、VDD-SYS、VDD-GPU)。四路电源使用独立DC-DC供电,去耦电路请参考标案图。 DRAM 1. A83T支持DDR3/3L、LPDDR2、LPDD

szx940213的博客 1380

全志H313盒子 遥控器配置

盒子一般都是多遥控器兼容的 无非就是底层把相应的config 配置上 然后配置不同遥控器的键码值映射表 1 内核配置 make ARCH=arm64 menuconfig 设备ID 可以通过getevent 获取 ...

科技改变社会 3771

android如何编程红外遥控,全志A20[android教程]-红外遥控器调试

第1章 前言要在树莓派3 (A20)android系统上实现红外遥控器,因为super3上有红外接收头,所以可以直接支持红外遥控器,可以把树莓派3应用到家庭控制当中。当作网络机顶盒用树莓派3的红外遥控器,还有鼠标功能,也就是它可以代替的部份的鼠标功能,因为在有些软件,不支持纯遥控支持,必须要鼠标箭头去它按钮的,就可以用到这个功能了只要轻轻按一下右下角这个“箭头”按钮,就可以用方向键来控制鼠标箭...

weixin_29410963的博客 1544
上一篇: 自己DIY一个pinephone——debian与主线linux在红米2(msm8916)上的移植
下一篇: 自己DIY一个pinephone——debian与主线linux在红米2(msm8916)上的移植 (二)
HandsomeHacker
博客等级 码龄10年 345粉丝 22原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值