lis302dl OUT_X&Y&Z value converted to "g" type

hamody hamody.wang at borqs.com
Tue Oct 21 10:40:53 CEST 2008




Andy Green wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Somebody in the thread at some point said:
> | Hello all
> |
> | Lis302dl(also LIS331DL) generate 3 axis values in register OUT_X OUT_Y
> | OUT_Z as 2's complement type.When APP layer get the value,I supose app
> act
> | according the value in g type.So My question is how you convert the
> value in
> | "byte" to g?For example,when the FS bit is 0,the sensor in a steady
> | state,the OUT_Z value will be 55~60.And now it's 1g.
> |
> | How do you perform that?
> 
> You can see the code here:
> 
> http://git.openmoko.org/?p=kernel.git;a=blob;f=drivers/input/misc/lis302dl.c;h=f743a241d87817a15bd748f0f911f7ff0a746946;hb=stable#l218
> 
> input_report_rel(lis->input_dev, REL_X, mg_per_sample * (s8)read[0]);
> 
> mg_per_sample is 18 for the default sensitivity, it just scales the
> reading up before passing it to the input subsystem.
> 
> - -Andy
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
> 
> iEYEARECAAYFAkj9dswACgkQOjLpvpq7dMpZPQCgipaaEtLL6WwY1eqBJsII1U7L
> HhsAn0zGjm0KHMBhZ2+l1aN+Bi+hP79f
> =1A90
> -----END PGP SIGNATURE-----
> 
> 
> 

Hello Andy

I've again taken a quick look of Simon's 
http://lists.openmoko.org/nabble.html#nabble-td1108850
lis302dl-queue-work-in-interrupt-handler.patch .
The work_queue has been replaced in the git tree code you gave above.
I have a question and a suggestion.How to exactly count the escaped
interrupt in work_queue way?In my opinion,
System will feel too have with work_queue when flood interrupt comes,and it
may miss some.Right?

If so,I think the follow suggestion is valuable.

In my driver,I use a work_struct+timer_list to solve this problem.If too
much interrupt comes at a time,I would only recognize the last one with a
delay in timer_list.

There is also problem here.If interrupt is always generating,the timer_list
make the system quiet,just as nothing happen.Even in the git tree code,irq
is disabled ,this problem becomes you will also miss some interrupt.Right?

Thanks:-D





-----
----hamody 
China is a great country.Welcome to Beijing.
-- 
View this message in context: http://n2.nabble.com/lis302dl-OUT_X-Y-Z-value-converted-to-%22g%22-type-tp1358246p1358759.html
Sent from the Openmoko Kernel mailing list archive at Nabble.com.




More information about the openmoko-kernel mailing list