<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forums.obdev.at/app.php/feed/topic/4606" />

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2010-08-01T21:48:02+02:00</updated>

	<author><name><![CDATA[Objective Development Forums]]></name></author>
	<id>https://forums.obdev.at/app.php/feed/topic/4606</id>

		<entry>
		<author><name><![CDATA[snookie]]></name></author>
		<updated>2010-08-01T21:48:02+02:00</updated>

		<published>2010-08-01T21:48:02+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=4606&amp;p=15407#p15407</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=4606&amp;p=15407#p15407"/>
		<title type="html"><![CDATA[Re: Detecting Suspend Mode]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=4606&amp;p=15407#p15407"><![CDATA[
Thanks to Christian again, who helped me offline, I was able to accomplish this.<br /><br />As Christian described, since I have D- hooked up to int1, toggling on int1 happens every 100ms. So I accomplished detecting sleep with the following code:<br /><br />sbi is a macro that was depricated but I still like to use so I always include it in my projects as the following: <br />#define sbi(reg, bit_number)    reg |= _BV(bit_number)                                 <br />#define cbi(reg, bit_number)    reg &amp;= ~_BV(bit_number)  <br /><br />I enable my timer2 to the slowest possible setting and turn on overflow.<br />        /* enable timer 2 */<br />        sbi(TCCR2B, CS22);<br />        sbi(TCCR2B, CS20);<br />        sbi(TIMSK2, TOIE2);<br /><br />I enable interrupts on INT1 with the following:<br />        /* enable Interrupt */<br />        sbi(EIMSK, INTF1);<br /><br />global static variable: <br />static int sleeping = 0;<br /><br />Then the following interrupt handlers.<br /><br />SIGNAL(SIG_INTERRUPT1)<br />{<br />        TCNT2 = 0;<br />        sleeping = 0;                                                                  <br />}<br /><br />SIGNAL(SIG_OVERFLOW2)<br />{                                                                                      <br />        sleeping = 1;<br />}<br /><br />just check if sleeping was set.<br /><br />You should also be very careful as putting anything else in INT1 interrupt handler could slow down the USB scheduler to the point where it breaks.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1317">snookie</a> — Sun Aug 01, 2010 9:48 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[snookie]]></name></author>
		<updated>2010-07-09T21:44:52+02:00</updated>

		<published>2010-07-09T21:44:52+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=4606&amp;p=15128#p15128</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=4606&amp;p=15128#p15128"/>
		<title type="html"><![CDATA[Detecting Suspend Mode]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=4606&amp;p=15128#p15128"><![CDATA[
I've exhausted my searches on this forum/example projects/wiki and haven't found anything.<br /><br />Is there anyway to detect if the host is suspended without using D- as the int0 pin?<br /><br />My current configuration is:<br /> D-    int1<br /> D+    int0<br /><br />Any tricks available? Can I not use measure frame length? How about USB_COUNT_SOF?<br /><br />I already have made many boards, most of them are in the field, and many people are requesting a wake if host is sleeping functionality.<br /><br />Thanks so much Christian, appreciate any help, tips, pointers. <br /><br />Much Obliged,<br />Jason<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1317">snookie</a> — Fri Jul 09, 2010 9:44 pm</p><hr />
]]></content>
	</entry>
	</feed>
