<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>LeafLabs Garden &#187; Topic: Non blocking capacitive sensor</title>
		<link>http://forums.leaflabs.com/topic.php?id=13460</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:05:19 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://forums.leaflabs.com/search.php</link>
		</textInput>
		<atom:link href="http://forums.leaflabs.com/rss.php?topic=13460" rel="self" type="application/rss+xml" />

		<item>
			<title>pyrohaz on "Non blocking capacitive sensor"</title>
			<link>http://forums.leaflabs.com/topic.php?id=13460#post-28656</link>
			<pubDate>Sun, 01 Sep 2013 14:07:02 +0000</pubDate>
			<dc:creator>pyrohaz</dc:creator>
			<guid isPermaLink="false">28656@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Thank you all very much, after reading through your code and part of the manual, I've decided instead to using the input capture feature of the timers, i'm just going to use a timer set and reset scheme using the TIMER_UPDATE_INTERRUPT for the overflow and the attachInterrupt piece of code to pause the timer on the rising edge. Thanks for all the help!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>crenn on "Non blocking capacitive sensor"</title>
			<link>http://forums.leaflabs.com/topic.php?id=13460#post-28641</link>
			<pubDate>Sat, 31 Aug 2013 03:25:54 +0000</pubDate>
			<dc:creator>crenn</dc:creator>
			<guid isPermaLink="false">28641@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I don't know why it was never integrated in the library, but manually writing to the registers works fine. I've done something similar to what ala42 has done although using PWM capture mode (not applicable for your case I believe) however, the code ala42 provided should give you a good idea of what you need to do to get the timer into input capture mode.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ala42 on "Non blocking capacitive sensor"</title>
			<link>http://forums.leaflabs.com/topic.php?id=13460#post-28637</link>
			<pubDate>Fri, 30 Aug 2013 18:38:52 +0000</pubDate>
			<dc:creator>ala42</dc:creator>
			<guid isPermaLink="false">28637@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;From your last post I am not sure if you got it running . Here &#60;a href=&#34;https://github.com/AeroQuad/AeroQuad/blob/master/Libraries/AQ_Receiver/Receiver_STM32.h&#34; rel=&#34;nofollow&#34;&#62;https://github.com/AeroQuad/AeroQuad/blob/master/Libraries/AQ_Receiver/Receiver_STM32.h&#60;/a&#62; I set up the registers manually to measure the high time of PWM signals.&#60;/p&#62;
&#60;p&#62;You could try to get it running with a single pin by activating the internal pull up resistor, but as it is ~40kOhm, that might take a bit too long.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>pyrohaz on "Non blocking capacitive sensor"</title>
			<link>http://forums.leaflabs.com/topic.php?id=13460#post-28636</link>
			<pubDate>Fri, 30 Aug 2013 13:01:59 +0000</pubDate>
			<dc:creator>pyrohaz</dc:creator>
			<guid isPermaLink="false">28636@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Right, i've got the stop at overflow sorted, I can use this to let the program know if the range was exceeded as using the TIMER_UPDATE_INTERRUPT, in this interrupt, the timer is paused and timer count is kept at 0. All I need now it so set up the input capture. In a real application, i'd be using a schmitt trigger comparator to trigger the input though as far as I know, each of the timers has an input filter of some form (according to the data sheet), one question i'm wondering though is how come the input capture usage of timers hasn't been integrated into the timer api?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>pyrohaz on "Non blocking capacitive sensor"</title>
			<link>http://forums.leaflabs.com/topic.php?id=13460#post-28628</link>
			<pubDate>Fri, 30 Aug 2013 10:01:45 +0000</pubDate>
			<dc:creator>pyrohaz</dc:creator>
			<guid isPermaLink="false">28628@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;As far as I know, it doesn't have to have the same pin being the input and output, it can use two different pins. How can I go about configuring a timer for input capture? After reading through the timer API, to set pin 0 as the input, could I:&#60;/p&#62;
&#60;p&#62;timer_init(TIMER2);&#60;br /&#62;
timer_set_mode(TIMER2, TIMER_CH4, TIMER_OUTPUT_COMPARE); (unsure here)&#60;br /&#62;
timer_set_prescaler(TIMER2, prescaler);&#60;br /&#62;
timer_set_reload(TIMER2, overflow);&#60;br /&#62;
timer_attach_interrupt(TIMER2, TIMER_TRG_INTERRUPT, intname);&#60;br /&#62;
timer_enable_irq(TIMER2, TIMER_TRG_INTERRUPT);&#60;br /&#62;
timer_cc_enable(TIMER2, TIMER_CH4);&#60;br /&#62;
timer_cc_set_pol(TIMER2, TIMER_CH4, 0);&#60;br /&#62;
timer_resume(TIMER2);&#60;/p&#62;
&#60;p&#62;Having an interrupt at overflow-1 to stop the timer if it reaches the max and having the input compare as an interrupt to see the current value could work as far as I know?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>crenn on "Non blocking capacitive sensor"</title>
			<link>http://forums.leaflabs.com/topic.php?id=13460#post-28626</link>
			<pubDate>Fri, 30 Aug 2013 09:23:10 +0000</pubDate>
			<dc:creator>crenn</dc:creator>
			<guid isPermaLink="false">28626@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I'm not sure exactly, but I think input capture might work, but I'm not sure exactly if you can have the pin as output and the timer channel as input capture. The reference manual probably will be the most help here. It can be found here:&#60;br /&#62;
&#60;a href=&#34;http://www.st.com/st-web-ui/static/active/en/resource/technical/document/reference_manual/CD00171190.pdf?s_searchtype=keyword&#34; rel=&#34;nofollow&#34;&#62;http://www.st.com/st-web-ui/static/active/en/resource/technical/document/reference_manual/CD00171190.pdf?s_searchtype=keyword&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>pyrohaz on "Non blocking capacitive sensor"</title>
			<link>http://forums.leaflabs.com/topic.php?id=13460#post-28623</link>
			<pubDate>Fri, 30 Aug 2013 08:53:15 +0000</pubDate>
			<dc:creator>pyrohaz</dc:creator>
			<guid isPermaLink="false">28623@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi, i'm sure many of you will know of the CapSense library that can be used on the arduino where a large metal pad, along with a suitably large resistor can be used to create a capacitive proximity sensor. Now this is all well and good apart from the fact that the code is blocking! It works by setting the &#34;charge&#34; pin high and counting the time until the &#34;sense&#34; pin goes high, this time will be somewhat inversely proportional to distance. The problem here obviously is that the code waits UNTIL the pin goes high. What i'd like to do is use one of the timers on the maple with suitably set prescaler and overflow and start it counting once the &#34;charge&#34; pin is set high. Once the &#34;sense&#34; pin is high, i'd like the timer to stop, the current timer value to be stored in a variable and the timer reset to zero. &#60;/p&#62;
&#60;p&#62;If the timer reaches the overflow, i'd also like it to stop too, therefore &#34;limiting&#34; the maximum value that the sensor can achieve. What would be the best way to do this and how can I attach external interrupts to pins (is there an example sketch...)?&#60;/p&#62;
&#60;p&#62;Any help appreciated as per!&#60;/p&#62;
&#60;p&#62;Harris
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
