<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="pl-pl">
<link rel="self" type="application/atom+xml" href="https://forum.atnel.pl/feed.php?f=8&amp;t=15337&amp;mode" />

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2016-06-21T11:13:44+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=8&amp;t=15337&amp;mode</id>
<entry>
<author><name><![CDATA[michal_c]]></name></author>
<updated>2016-06-21T11:13:44+01:00</updated>
<published>2016-06-21T11:13:44+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=162700#p162700</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=162700#p162700"/>
<title type="html"><![CDATA[Re: Atmega32U4 Problem z USB]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=162700#p162700"><![CDATA[
Wow. Działa. Dziękuję bardzo za pomoc,<br />Przyciski działają aż miło <img src="https://forum.atnel.pl/images/smilies/icon_e_smile.gif" alt=":)" title="Szczęśliwy" /> Teraz chciałem skorzystać z I2C aby ruszyć MPU. Skorzystałem z biblioteki TWI.c i TWI.h wziętej z LUFY.....<br />I mam taki problem, że w momencie jakiejkolwiek transmisji po i2c usb przestaje mi działać, rozłącza mi usb......<br />Nie wiem dlaczego..... Może ktoś ma jakiś pomysł?<br />[syntax=c]int main(void)<br />{<br /><br />DDRD &amp;= 0xfc;<br />PORTD |= 0x03;<br />//DDRC = 0xFF;<br />SetupHardware();<br /><br />LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);<br />GlobalInterruptEnable();<br /><br />for (;;)<br />{<br /><br /><br /><br />TWI_StartTransmission(0xD0,10);                                    // start transmission<br />//TWI_Write(0xD0);<br />TWI_SendByte(0x3B);                                // select first register<br />TWI_StartTransmission(0xD1,10);                                   // repeated start<br />//TWI_Write(0xD1);                                // write address for reading data<br />//TWI_ReceiveByte(B1,false);<br />//TWI_ReceiveByte(B2,false);<br />//TWI_ReceiveByte(B3,false);<br />//TWI_ReceiveByte(B4,false);<br />//TWI_ReceiveByte(B5,false);<br />//TWI_ReceiveByte(B6,true);<br />TWI_StopTransmission();<br />HID_Device_USBTask(&amp;Joystick_HID_Interface);<br />USB_USBTask();<br />}<br />}[/syntax]<br />Z góry dziękuję za pomoc<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=13894">michal_c</a> — 21 cze 2016, o 11:13</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Sparrow-hawk]]></name></author>
<updated>2016-06-14T20:48:09+01:00</updated>
<published>2016-06-14T20:48:09+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=162298#p162298</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=162298#p162298"/>
<title type="html"><![CDATA[Re: Atmega32U4 Problem z USB]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=162298#p162298"><![CDATA[
Dokładnie, to zmieniłem w pliku Buttons.h te trzy linijki:<br />[syntax=c]#define BUTTONS_BUTTON1  (1 &lt;&lt; PD4)<br />static inline void       Buttons_Init(void) {DDRD &amp;= ~(1&lt;&lt;PD4); PORTD |= (1&lt;&lt;PD4);};<br />static inline uint_reg_t Buttons_GetStatus(void) { return !(PIND &amp; (1 &lt;&lt; PD4)) &lt;&lt; PD4; };[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=10614">Sparrow-hawk</a> — 14 cze 2016, o 20:48</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[michal_c]]></name></author>
<updated>2016-06-10T10:21:17+01:00</updated>
<published>2016-06-10T10:21:17+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=162042#p162042</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=162042#p162042"/>
<title type="html"><![CDATA[Re: Atmega32U4 Problem z USB]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=162042#p162042"><![CDATA[
Aha <img src="https://forum.atnel.pl/images/smilies/icon_e_smile.gif" alt=":)" title="Szczęśliwy" /> Dziękuję <img src="https://forum.atnel.pl/images/smilies/icon_e_smile.gif" alt=":)" title="Szczęśliwy" /> A tylko tę jedną linijkę zmieniłeś aby zadziałały tej przycisk?<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=13894">michal_c</a> — 10 cze 2016, o 10:21</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Sparrow-hawk]]></name></author>
<updated>2016-06-09T07:46:07+01:00</updated>
<published>2016-06-09T07:46:07+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=161942#p161942</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=161942#p161942"/>
<title type="html"><![CDATA[Re: Atmega32U4 Problem z USB]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=161942#p161942"><![CDATA[
Przesuwam dla tego, że ten kod: !(PIND &amp; (1 &lt;&lt; PD4)) zwraca 1 lub 0 w zależności od stanu przycisku, a funkcja w pętli głównej oczekuje wartości (1 &lt;&lt; PD4) lub 0.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=10614">Sparrow-hawk</a> — 9 cze 2016, o 07:46</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[michal_c]]></name></author>
<updated>2016-06-08T10:20:41+01:00</updated>
<published>2016-06-08T10:20:41+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=161887#p161887</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=161887#p161887"/>
<title type="html"><![CDATA[Re: Atmega32U4 Problem z USB]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=161887#p161887"><![CDATA[
Dzień dobry,<br />Dziękuję za pomoc, <br />Jednak u mnie nie chce to działać choć próbował na wszystkie sposoby..... <br />Mam przycisk podłączony do pinu PB2 i nie chce działać.<br />Poniżej wkleję kod z buttom.h może coś przeoczyłem co powinno być......<br /><br />[syntax=c]/*<br />             LUFA Library<br />     Copyright (C) Dean Camera, 2015.<br /><br />  dean &#91;at&#93; fourwalledcubicle &#91;dot&#93; com<br />           www.lufa-lib.org<br />*/<br /><br />/*<br />  Copyright 2015  Dean Camera (dean &#91;at&#93; fourwalledcubicle &#91;dot&#93; com)<br /><br />  Permission to use, copy, modify, distribute, and sell this<br />  software and its documentation for any purpose is hereby granted<br />  without fee, provided that the above copyright notice appear in<br />  all copies and that both that the copyright notice and this<br />  permission notice and warranty disclaimer appear in supporting<br />  documentation, and that the name of the author not be used in<br />  advertising or publicity pertaining to distribution of the<br />  software without specific, written prior permission.<br /><br />  The author disclaims all warranties with regard to this<br />  software, including all implied warranties of merchantability<br />  and fitness.  In no event shall the author be liable for any<br />  special, indirect or consequential damages or any damages<br />  whatsoever resulting from loss of use, data or profits, whether<br />  in an action of contract, negligence or other tortious action,<br />  arising out of or in connection with the use or performance of<br />  this software.<br />*/<br /><br />/** \file<br /> *  \brief Digital button board hardware driver.<br /> *<br /> *  This file is the master dispatch header file for the board-specific Buttons driver, for boards containing<br /> *  physical pushbuttons connected to the microcontroller's GPIO pins.<br /> *<br /> *  User code should include this file, which will in turn include the correct Button driver header file for the<br /> *  currently selected board.<br /> *<br /> *  If the \c BOARD value is set to \c BOARD_USER, this will include the \c /Board/Buttons.h file in the user project<br /> *  directory.<br /> *<br /> *  For possible \c BOARD makefile values, see \ref Group_BoardTypes.<br /> */<br /><br />/** \ingroup Group_BoardDrivers<br /> *  \defgroup Group_Buttons Buttons Driver - LUFA/Drivers/Board/Buttons.h<br /> *  \brief Digital button board hardware driver.<br /> *<br /> *  \section Sec_Buttons_Dependencies Module Source Dependencies<br /> *  The following files must be built with any user project that uses this module:<br /> *    - None<br /> *<br /> *  \section Sec_Buttons_ModDescription Module Description<br /> *  Hardware buttons driver. This provides an easy to use driver for the hardware buttons present on many boards.<br /> *  It provides a way to easily configure and check the status of all the buttons on the board so that appropriate<br /> *  actions can be taken.<br /> *<br /> *  If the \c BOARD value is set to \c BOARD_USER, this will include the \c /Board/Buttons.h file in the user project<br /> *  directory. Otherwise, it will include the appropriate built-in board driver header file.<br /> *<br /> *  For possible \c BOARD makefile values, see \ref Group_BoardTypes.<br /> *<br /> *  \section Sec_Buttons_ExampleUsage Example Usage<br /> *  The following snippet is an example of how this module may be used within a typical<br /> *  application.<br /> *<br /> *  \code<br /> *      // Initialize the button driver before first use<br /> *      Buttons_Init();<br /> *<br /> *      printf(&quot;Waiting for button press...\r\n&quot;);<br /> *<br /> *      // Loop until a board button has been pressed<br /> *      uint8_t ButtonPress;<br /> *      while (!(ButtonPress = Buttons_GetStatus())) {};<br /> *<br /> *      // Display which button was pressed (assuming two board buttons)<br /> *      printf(&quot;Button pressed: %s\r\n&quot;, (ButtonPress == BUTTONS_BUTTON1) ? &quot;Button 1&quot; : &quot;Button 2&quot;);<br /> *  \endcode<br /> *<br /> *  @{<br /> */<br /><br />#ifndef __BUTTONS_H__<br />#define __BUTTONS_H__<br /><br />/* Macros: */<br />#define __INCLUDE_FROM_BUTTONS_H<br /><br />/* Includes: */<br />#include &quot;../../Common/Common.h&quot;<br /><br />#if (BOARD == BOARD_NONE)<br />#define BUTTONS_BUTTON1  0<br />static inline void       Buttons_Init(void) {};<br />static inline uint_reg_t Buttons_GetStatus(void) { return 0; };<br />#elif (BOARD == BOARD_USBKEY)<br />#include &quot;AVR8/USBKEY/Buttons.h&quot;<br />#elif (BOARD == BOARD_STK525)<br />#include &quot;AVR8/STK525/Buttons.h&quot;<br />#elif (BOARD == BOARD_STK526)<br />#include &quot;AVR8/STK526/Buttons.h&quot;<br />#elif (BOARD == BOARD_ATAVRUSBRF01)<br />#include &quot;AVR8/ATAVRUSBRF01/Buttons.h&quot;<br />#elif (BOARD == BOARD_BUMBLEB)<br />#include &quot;AVR8/BUMBLEB/Buttons.h&quot;<br />#elif (BOARD == BOARD_EVK527)<br />#include &quot;AVR8/EVK527/Buttons.h&quot;<br />#elif (BOARD == BOARD_USBTINYMKII)<br />#include &quot;AVR8/USBTINYMKII/Buttons.h&quot;<br />#elif (BOARD == BOARD_BENITO)<br />#include &quot;AVR8/BENITO/Buttons.h&quot;<br />#elif (BOARD == BOARD_JMDBU2)<br />#include &quot;AVR8/JMDBU2/Buttons.h&quot;<br />#elif (BOARD == BOARD_OLIMEX162)<br />#include &quot;AVR8/OLIMEX162/Buttons.h&quot;<br />#elif (BOARD == BOARD_USBFOO)<br />#include &quot;AVR8/USBFOO/Buttons.h&quot;<br />#elif (BOARD == BOARD_UDIP)<br />#include &quot;AVR8/UDIP/Buttons.h&quot;<br />#elif (BOARD == BOARD_CULV3)<br />#include &quot;AVR8/CULV3/Buttons.h&quot;<br />#elif (BOARD == BOARD_MINIMUS)<br />#include &quot;AVR8/MINIMUS/Buttons.h&quot;<br />#elif (BOARD == BOARD_MICROSIN162)<br />#include &quot;AVR8/MICROSIN162/Buttons.h&quot;<br />#elif (BOARD == BOARD_EVK1101)<br />#include &quot;UC3/EVK1101/Buttons.h&quot;<br />#elif (BOARD == BOARD_TUL)<br />#include &quot;AVR8/TUL/Buttons.h&quot;<br />#elif (BOARD == BOARD_EVK1100)<br />#include &quot;UC3/EVK1100/Buttons.h&quot;<br />#elif (BOARD == BOARD_EVK1104)<br />#include &quot;UC3/EVK1104/Buttons.h&quot;<br />#elif (BOARD == BOARD_A3BU_XPLAINED)<br />#include &quot;XMEGA/A3BU_XPLAINED/Buttons.h&quot;<br />#elif ((BOARD == BOARD_USB2AX) || (BOARD == BOARD_USB2AX_V3))<br />#include &quot;AVR8/USB2AX/Buttons.h&quot;<br />#elif ((BOARD == BOARD_MICROPENDOUS_32U2) || (BOARD == BOARD_MICROPENDOUS_A) || \<br />       (BOARD == BOARD_MICROPENDOUS_1)    || (BOARD == BOARD_MICROPENDOUS_2) || \<br />       (BOARD == BOARD_MICROPENDOUS_3)    || (BOARD == BOARD_MICROPENDOUS_4) || \<br />       (BOARD == BOARD_MICROPENDOUS_REV1) || (BOARD == BOARD_MICROPENDOUS_REV2) || \<br />       (BOARD == BOARD_MICROPENDOUS_DIP))<br />#include &quot;AVR8/MICROPENDOUS/Buttons.h&quot;<br />#elif (BOARD == BOARD_B1_XPLAINED)<br />#include &quot;XMEGA/B1_XPLAINED/Buttons.h&quot;<br />#elif (BOARD == BOARD_OLIMEX32U4)<br />#include &quot;AVR8/OLIMEX32U4/Buttons.h&quot;<br />#elif (BOARD == BOARD_OLIMEXT32U4)<br />#include &quot;AVR8/OLIMEXT32U4/Buttons.h&quot;<br />#elif (BOARD == BOARD_OLIMEXISPMK2)<br />#include &quot;AVR8/OLIMEXISPMK2/Buttons.h&quot;<br />#elif (BOARD == BOARD_UC3A3_XPLAINED)<br />#include &quot;UC3/UC3A3_XPLAINED/Buttons.h&quot;<br />#elif (BOARD == BOARD_STANGE_ISP)<br />#include &quot;AVR8/STANGE_ISP/Buttons.h&quot;<br />#elif (BOARD == BOARD_C3_XPLAINED)<br />#include &quot;XMEGA/C3_XPLAINED/Buttons.h&quot;<br />#elif (BOARD == BOARD_U2S)<br />#include &quot;AVR8/U2S/Buttons.h&quot;<br />#else<br />#include &quot;Board/Buttons.h&quot;<br />#endif<br /><br />/* Pseudo-Functions for Doxygen: */<br />#if defined(__DOXYGEN__)<br />/** Initializes the buttons driver, so that the current button position can be read. This sets the appropriate<br /> *  I/O pins to an inputs with pull-ups enabled.<br /> *<br /> *  This must be called before any Button driver functions are used.<br /> */<br />static inline void Buttons_Init(void);<br /><br />/** Disables the buttons driver, releasing the I/O pins back to their default high-impedance input mode. */<br />static inline void Buttons_Disable(void);<br /><br />/** Returns a mask indicating which board buttons are currently pressed.<br /> *<br /> *  \return Mask of \c BUTTONS_BUTTON* constants indicating which board buttons are currently pressed.<br /> */<br />static inline uint_reg_t Buttons_GetStatus(void) { return !(PINB &amp; (1 &lt;&lt; PB2)) &lt;&lt; PB2; };<br /><br /><br />#endif<br /><br />#endif<br /><br />/** @} */[/syntax]<br /><br />Oraz mam jeszcze pytanie dlaczego to PD4 u Pana jest dodatkowo przesuwane?<br />Z góry dziękuję za pomoc <img src="https://forum.atnel.pl/images/smilies/icon_e_smile.gif" alt=":)" title="Szczęśliwy" /><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=13894">michal_c</a> — 8 cze 2016, o 10:20</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Sparrow-hawk]]></name></author>
<updated>2016-05-23T22:00:41+01:00</updated>
<published>2016-05-23T22:00:41+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=161034#p161034</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=161034#p161034"/>
<title type="html"><![CDATA[Re: Atmega32U4 Problem z USB]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=161034#p161034"><![CDATA[
Hmm, widzę, że masz te funkcje zdefiniowane. U mnie taka konstrukcja:<br />[syntax=c]static inline uint_reg_t Buttons_GetStatus(void) { return !(PIND &amp; (1 &lt;&lt; PD4)) &lt;&lt; PD4; };[/syntax]<br />Dla przycisku podłączonego do pinu PD4, z aktywnym stanem niskimi działa bez zarzutu.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=10614">Sparrow-hawk</a> — 23 maja 2016, o 22:00</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[michal_c]]></name></author>
<updated>2016-05-21T12:39:32+01:00</updated>
<published>2016-05-21T12:39:32+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160969#p160969</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160969#p160969"/>
<title type="html"><![CDATA[Re: Atmega32U4 Problem z USB]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160969#p160969"><![CDATA[
Dziękuje za odpowiedź,<br />Ale musisz o plikach z Lufy tych oryginalnych czy tych moich.... <br />Po wydaje mi się, że te funkcje nie są puste.... ale może źle patrzę... . Bo myślałem, że ja definiuje w button.h....<br />Z góry dziękuję za odpowiedź/podpowiedź.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=13894">michal_c</a> — 21 maja 2016, o 12:39</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Sparrow-hawk]]></name></author>
<updated>2016-05-20T20:31:28+01:00</updated>
<published>2016-05-20T20:31:28+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160943#p160943</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160943#p160943"/>
<title type="html"><![CDATA[Re: Atmega32U4 Problem z USB]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160943#p160943"><![CDATA[
No jeśli chodzi o składnie, to na pewno jest poprawna. Ale te funkcje są puste. Należy je zdefiniować wg potrzeb.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=10614">Sparrow-hawk</a> — 20 maja 2016, o 20:31</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[michal_c]]></name></author>
<updated>2016-05-17T17:34:17+01:00</updated>
<published>2016-05-17T17:34:17+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160808#p160808</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160808#p160808"/>
<title type="html"><![CDATA[Re: Atmega32U4 Problem z USB]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160808#p160808"><![CDATA[
Przyjrzałem się....wg mnie wyglądają okej-poprawnie..... nie wiem co może być nie tak......<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=13894">michal_c</a> — 17 maja 2016, o 17:34</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Sparrow-hawk]]></name></author>
<updated>2016-05-15T19:57:35+01:00</updated>
<published>2016-05-15T19:57:35+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160687#p160687</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160687#p160687"/>
<title type="html"><![CDATA[Re: Atmega32U4 Problem z USB]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160687#p160687"><![CDATA[
W pliku joystick.c są takie funkcje jak: Buttons_Init(); oraz Buttons_GetStatus(); Przyjrzyj się im, zobacz ich implementacje. <br /><br />PS. Nie musisz w tej chwili wklejać w całości tych plików, jedynie swoje zmiany oraz ewentualnie kontekst tych zmian.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=10614">Sparrow-hawk</a> — 15 maja 2016, o 19:57</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[michal_c]]></name></author>
<updated>2016-05-15T16:29:56+01:00</updated>
<published>2016-05-15T16:29:56+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160666#p160666</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160666#p160666"/>
<title type="html"><![CDATA[Re: Atmega32U4 Problem z USB]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160666#p160666"><![CDATA[
Po rozwiązaniu problemu po dużej pomocy ze strony Sparrow-hawk  z widzialnością w sekcji kontrolerów. Kończą mi się pomysły dlaczego nie mam żadnej reakcji po kliknięciu na płytce przyciski na ekranie komputera nic się nie pojawia. Ma ktoś może pomysł gdzie mogę mieć problem?<br />Poniżej wstawiam kod:<br />destriptors.c<br />[syntax=c]/*<br />             LUFA Library<br />     Copyright (C) Dean Camera, 2012.<br /><br />  dean &#91;at&#93; fourwalledcubicle &#91;dot&#93; com<br />           www.lufa-lib.org<br />*/<br /><br />/*<br />  Copyright 2012  Dean Camera (dean &#91;at&#93; fourwalledcubicle &#91;dot&#93; com)<br /><br />  Permission to use, copy, modify, distribute, and sell this<br />  software and its documentation for any purpose is hereby granted<br />  without fee, provided that the above copyright notice appear in<br />  all copies and that both that the copyright notice and this<br />  permission notice and warranty disclaimer appear in supporting<br />  documentation, and that the name of the author not be used in<br />  advertising or publicity pertaining to distribution of the<br />  software without specific, written prior permission.<br /><br />  The author disclaim all warranties with regard to this<br />  software, including all implied warranties of merchantability<br />  and fitness.  In no event shall the author be liable for any<br />  special, indirect or consequential damages or any damages<br />  whatsoever resulting from loss of use, data or profits, whether<br />  in an action of contract, negligence or other tortious action,<br />  arising out of or in connection with the use or performance of<br />  this software.<br />*/<br /><br />/** \file<br /> *<br /> *  USB Device Descriptors, for library use when in USB device mode. Descriptors are special<br /> *  computer-readable structures which the host requests upon device enumeration, to determine<br /> *  the device's capabilities and functions.<br /> */<br /><br />#include &quot;Descriptors.h&quot;<br /><br />/** HID class report descriptor. This is a special descriptor constructed with values from the<br /> *  USBIF HID class specification to describe the reports and capabilities of the HID device. This<br /> *  descriptor is parsed by the host and its contents used to determine what data (and in what encoding)<br /> *  the device will send, and what it may be sent back from the host. Refer to the HID specification for<br /> *  more details on HID report descriptors.<br /> */<br />const USB_Descriptor_HIDReport_Datatype_t PROGMEM JoystickReport&#91;&#93; =<br />{<br />    /* Use the HID class driver's standard Joystick report.<br />     *   Number of Axis: 2 (X/Y)<br />     *   Min X/Y Axis values: -100<br />     *   Max X/Y Axis values:  100<br />     *   Min physical X/Y Axis values (used to determine resolution): -1<br />     *   Max physical X/Y Axis values (used to determine resolution):  1<br />     *   Buttons: 2<br />     */<br />    HID_DESCRIPTOR_JOYSTICK( -128, 127, -1, 1, 2)<br />};<br /><br />/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall<br /> *  device characteristics, including the supported USB version, control endpoint size and the<br /> *  number of device configurations. The descriptor is read out by the USB host when the enumeration<br /> *  process begins.<br /> */<br />const USB_Descriptor_Device_t PROGMEM DeviceDescriptor =<br />{<br />    .Header                 = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},<br /><br />    .USBSpecification       = VERSION_BCD(01.10),<br />    .Class                  = USB_CSCP_NoDeviceClass,<br />    .SubClass               = USB_CSCP_NoDeviceSubclass,<br />    .Protocol               = USB_CSCP_NoDeviceProtocol,<br /><br />    .Endpoint0Size          = FIXED_CONTROL_ENDPOINT_SIZE,<br /><br />    .VendorID               = 0x03EB,<br />    .ProductID              = 0x2043,<br />    .ReleaseNumber          = VERSION_BCD(00.01),<br /><br />    .ManufacturerStrIndex   = 0x01,<br />    .ProductStrIndex        = 0x02,<br />    .SerialNumStrIndex      = NO_DESCRIPTOR,<br /><br />    .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS<br />};<br /><br />/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage<br /> *  of the device in one of its supported configurations, including information about any device interfaces<br /> *  and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting<br /> *  a configuration so that the host may correctly communicate with the USB device.<br /> */<br />const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =<br />{<br />    .Config =<br />        {<br />            .Header                 = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},<br /><br />            .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),<br />            .TotalInterfaces        = 1,<br /><br />            .ConfigurationNumber    = 1,<br />            .ConfigurationStrIndex  = NO_DESCRIPTOR,<br /><br />            .ConfigAttributes       = (USB_CONFIG_ATTR_RESERVED | USB_CONFIG_ATTR_SELFPOWERED),<br /><br />            .MaxPowerConsumption    = USB_CONFIG_POWER_MA(100)<br />        },<br /><br />    .HID_Interface =<br />        {<br />            .Header                 = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},<br /><br />            .InterfaceNumber        = 0x00,<br />            .AlternateSetting       = 0x00,<br /><br />            .TotalEndpoints         = 1,<br /><br />            .Class                  = HID_CSCP_HIDClass,<br />            .SubClass               = HID_CSCP_NonBootSubclass,<br />            .Protocol               = HID_CSCP_NonBootProtocol,<br /><br />            .InterfaceStrIndex      = NO_DESCRIPTOR<br />        },<br /><br />    .HID_JoystickHID =<br />        {<br />            .Header                 = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},<br /><br />            .HIDSpec                = VERSION_BCD(01.11),<br />            .CountryCode            = 0x00,<br />            .TotalReportDescriptors = 1,<br />            .HIDReportType          = HID_DTYPE_Report,<br />            .HIDReportLength        = sizeof(JoystickReport)<br />        },<br /><br />    .HID_ReportINEndpoint =<br />        {<br />            .Header                 = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},<br /><br />            .EndpointAddress        = (ENDPOINT_DIR_IN | JOYSTICK_EPNUM),<br />            .Attributes             = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),<br />            .EndpointSize           = JOYSTICK_EPSIZE,<br />            .PollingIntervalMS      = 0x01<br />        }<br />};<br /><br />/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests<br /> *  the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate<br /> *  via the language ID table available at USB.org what languages the device supports for its string descriptors.<br /> */<br />const USB_Descriptor_String_t PROGMEM LanguageString =<br />{<br />    .Header                 = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},<br /><br />    .UnicodeString          = {LANGUAGE_ID_ENG}<br />};<br /><br />/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable<br /> *  form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device<br /> *  Descriptor.<br /> */<br />const USB_Descriptor_String_t PROGMEM ManufacturerString =<br />{<br />    .Header                 = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},<br /><br />    .UnicodeString          = L&quot;Dean Camera&quot;<br />};<br /><br />/** Product descriptor string. This is a Unicode string containing the product's details in human readable form,<br /> *  and is read out upon request by the host when the appropriate string ID is requested, listed in the Device<br /> *  Descriptor.<br /> */<br />const USB_Descriptor_String_t PROGMEM ProductString =<br />{<br />    .Header                 = {.Size = USB_STRING_LEN(18), .Type = DTYPE_String},<br /><br />    .UnicodeString          = L&quot;LUFA Joystick Demo&quot;<br />};<br /><br />/** This function is called by the library when in device mode, and must be overridden (see library &quot;USB Descriptors&quot;<br /> *  documentation) by the application code so that the address and size of a requested descriptor can be given<br /> *  to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function<br /> *  is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the<br /> *  USB host.<br /> */<br />uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,<br />                                    const uint8_t wIndex,<br />                                    const void** const DescriptorAddress)<br />{<br />    const uint8_t  DescriptorType   = (wValue &gt;&gt; 8);<br />    const uint8_t  DescriptorNumber = (wValue &amp; 0xFF);<br /><br />    const void* Address = NULL;<br />    uint16_t    Size    = NO_DESCRIPTOR;<br /><br />    switch (DescriptorType)<br />    {<br />        case DTYPE_Device:<br />            Address = &amp;DeviceDescriptor;<br />            Size    = sizeof(USB_Descriptor_Device_t);<br />            break;<br />        case DTYPE_Configuration:<br />            Address = &amp;ConfigurationDescriptor;<br />            Size    = sizeof(USB_Descriptor_Configuration_t);<br />            break;<br />        case DTYPE_String:<br />            switch (DescriptorNumber)<br />            {<br />                case 0x00:<br />                    Address = &amp;LanguageString;<br />                    Size    = pgm_read_byte(&amp;LanguageString.Header.Size);<br />                    break;<br />                case 0x01:<br />                    Address = &amp;ManufacturerString;<br />                    Size    = pgm_read_byte(&amp;ManufacturerString.Header.Size);<br />                    break;<br />                case 0x02:<br />                    Address = &amp;ProductString;<br />                    Size    = pgm_read_byte(&amp;ProductString.Header.Size);<br />                    break;<br />            }<br /><br />            break;<br />        case HID_DTYPE_HID:<br />            Address = &amp;ConfigurationDescriptor.HID_JoystickHID;<br />            Size    = sizeof(USB_HID_Descriptor_HID_t);<br />            break;<br />        case HID_DTYPE_Report:<br />            Address = &amp;JoystickReport;<br />            Size    = sizeof(JoystickReport);<br />            break;<br />    }<br /><br />    *DescriptorAddress = Address;<br />    return Size;<br />}[/syntax]<br /><br />joystick.c<br />[syntax=c]/*<br />             LUFA Library<br />     Copyright (C) Dean Camera, 2012.<br /><br />  dean &#91;at&#93; fourwalledcubicle &#91;dot&#93; com<br />           www.lufa-lib.org<br />*/<br /><br />/*<br />  Copyright 2012  Dean Camera (dean &#91;at&#93; fourwalledcubicle &#91;dot&#93; com)<br /><br />  Permission to use, copy, modify, distribute, and sell this<br />  software and its documentation for any purpose is hereby granted<br />  without fee, provided that the above copyright notice appear in<br />  all copies and that both that the copyright notice and this<br />  permission notice and warranty disclaimer appear in supporting<br />  documentation, and that the name of the author not be used in<br />  advertising or publicity pertaining to distribution of the<br />  software without specific, written prior permission.<br /><br />  The author disclaim all warranties with regard to this<br />  software, including all implied warranties of merchantability<br />  and fitness.  In no event shall the author be liable for any<br />  special, indirect or consequential damages or any damages<br />  whatsoever resulting from loss of use, data or profits, whether<br />  in an action of contract, negligence or other tortious action,<br />  arising out of or in connection with the use or performance of<br />  this software.<br />*/<br /><br />/** \file<br /> *<br /> *  Main source file for the Joystick demo. This file contains the main tasks of<br /> *  the demo and is responsible for the initial application hardware configuration.<br /> */<br /><br />#include &lt;LUFA/Drivers/Peripheral/ADC.h&gt;<br />#include &quot;Joystick.h&quot;<br /><br />/** Buffer to hold the previously generated HID report, for comparison purposes inside the HID class driver. */<br />static uint8_t PrevJoystickHIDReportBuffer&#91;sizeof(USB_JoystickReport_Data_t)&#93;;<br /><br />/** LUFA HID Class driver interface configuration and state information. This structure is<br /> *  passed to all HID Class driver functions, so that multiple instances of the same class<br /> *  within a device can be differentiated from one another.<br /> */<br />USB_ClassInfo_HID_Device_t Joystick_HID_Interface =<br />    {<br />        .Config =<br />            {<br />                .InterfaceNumber              = 0,<br /><br />                .ReportINEndpointNumber       = JOYSTICK_EPNUM,<br />                .ReportINEndpointSize         = JOYSTICK_EPSIZE,<br />                .ReportINEndpointDoubleBank   = false,<br /><br />                .PrevReportINBuffer           = PrevJoystickHIDReportBuffer,<br />                .PrevReportINBufferSize       = sizeof(PrevJoystickHIDReportBuffer),<br />            },<br />    };<br /><br />static int8_t y_ax;<br />static int8_t x_ax;<br /><br />/** Main program entry point. This routine contains the overall program flow, including initial<br /> *  setup of all components and the main program loop.<br /> */<br />int main(void)<br />{<br />    SetupHardware();<br /><br />    LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);<br />    sei();<br /><br />    for (;;)<br />    {<br />        // Suma kolejnych prĂłbek poszczegĂłlnych kanaĹ‚Ăłw ADC.<br />        int16_t y_ax_sum = 0;<br />        int16_t x_ax_sum = 0;<br /><br />        // PÄ™tla pomiarowa. NapiÄ™cie poszczegĂłlnych kanaĹ‚Ăłw zostanie zmierzone<br />        // tyle razy, ile okreĹ›lono w staĹ‚ej JOY_ADC_SAMPLES_NUM.<br />        for( uint8_t i = 0; i &lt; JOY_ADC_SAMPLES_NUM; i++ )<br />        {<br />            // WybĂłr kanaĹ‚u zapisanego w staĹ‚ej JOY_ADC_CHANNEL_Y.<br />            ADC_SetupChannel( JOY_ADC_CHANNEL_Y );<br />            // Pomiar napiÄ™cia wybranego kanaĹ‚u ADC. Parametr wywoĹ‚ania oznacza, ĹĽe:<br />            // a) napiÄ™cie odniesienia przetwornika pobierane jest z pinu AVCC (ADC_REFERENCE_AVCC)<br />            // b) wynik pomiaru jest wyrĂłwnany do lewej strony (ADC_LEFT_ADJUSTED)<br />            // c) wybrany zostaje kanaĹ‚ okreĹ›lony w staĹ‚ej JOY_ADC_CHANNEL_Y<br />            // Funkcja ADC_GetChannelReading() czeka w pÄ™tli na zakoĹ„czenie konwersji. Wynik, przed dodaniem<br />            // do zmiennej sumy prĂłbek jest przesuwany o 8 bitĂłw w prawo, poniewaĹĽ parametr ADC_LEFT_ADJUSTED<br />            // oznacza, ĹĽe 8 najbardziej znaczÄ…cych bitĂłw 10 bitowego wyniku pomiaru jest umieszczanych w<br />            // bardziej znaczÄ…cym bajcie 16 bitowego wyniku zwracanego przez funkcjÄ™. DziÄ™ki tym operacjom,<br />            // wynik przetwarzania jest 8 bitowy, bazujÄ…c na 10 bitowym przetworniku.<br />            y_ax_sum += ADC_GetChannelReading( ADC_REFERENCE_AVCC | ADC_LEFT_ADJUSTED | JOY_ADC_CHANNEL_Y ) &gt;&gt; 8;<br /><br />            ADC_SetupChannel( JOY_ADC_CHANNEL_X );<br />            x_ax_sum += ADC_GetChannelReading( ADC_REFERENCE_AVCC | ADC_LEFT_ADJUSTED | JOY_ADC_CHANNEL_X ) &gt;&gt; 8;<br />        }<br /><br />        // Obliczenie pozycji potencjometrĂłw osi X-Y. Po pierwsze, wynik pomiaru (suma prĂłbek)<br />        // poszczegĂłlnych kanaĹ‚Ăłw jest uĹ›redniany (dzielony przez JOY_ADC_SAMPLES_NUM). NastÄ™pnie<br />        // wartoĹ›Ä‡ bez znaku z zakresu 0-255 jest zamieniana na wartoĹ›Ä‡ ze znakiem z<br />        // zakresu -128 - +127, poprzez odjÄ™cie wartoĹ›ci 128 (255 - 128 = 127, 0 - 128 = -128).<br />        y_ax = (y_ax_sum / JOY_ADC_SAMPLES_NUM) - 128;<br />        x_ax = (x_ax_sum / JOY_ADC_SAMPLES_NUM) - 128;<br /><br />        HID_Device_USBTask(&amp;Joystick_HID_Interface);<br />        USB_USBTask();<br />    }<br />}<br /><br />/** Configures the board hardware and chip peripherals for the demo's functionality. */<br />void SetupHardware(void)<br />{<br />    /* Disable watchdog if enabled by bootloader/fuses */<br />    MCUSR &amp;= ~(1 &lt;&lt; WDRF);<br />    wdt_disable();<br /><br />    /* Disable clock division */<br />    clock_prescale_set(clock_div_1);<br /><br />    /* Hardware Initialization */<br />    ADC_Init( ADC_SINGLE_CONVERSION | ADC_PRESCALE_128 );<br />    LEDs_Init();<br />    Buttons_Init();<br />    USB_Init();<br />}<br /><br />/** Event handler for the library USB Connection event. */<br />void EVENT_USB_Device_Connect(void)<br />{<br />    LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);<br />}<br /><br />/** Event handler for the library USB Disconnection event. */<br />void EVENT_USB_Device_Disconnect(void)<br />{<br />    LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);<br />}<br /><br />/** Event handler for the library USB Configuration Changed event. */<br />void EVENT_USB_Device_ConfigurationChanged(void)<br />{<br />    bool ConfigSuccess = true;<br /><br />    ConfigSuccess &amp;= HID_Device_ConfigureEndpoints(&amp;Joystick_HID_Interface);<br /><br />    USB_Device_EnableSOFEvents();<br /><br />    LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);<br />}<br /><br />/** Event handler for the library USB Control Request reception event. */<br />void EVENT_USB_Device_ControlRequest(void)<br />{<br />    HID_Device_ProcessControlRequest(&amp;Joystick_HID_Interface);<br />}<br /><br />/** Event handler for the USB device Start Of Frame event. */<br />void EVENT_USB_Device_StartOfFrame(void)<br />{<br />    HID_Device_MillisecondElapsed(&amp;Joystick_HID_Interface);<br />}<br /><br />/** HID class driver callback function for the creation of HID reports to the host.<br /> *<br /> *  \param&#91;in&#93;     HIDInterfaceInfo  Pointer to the HID class interface configuration structure being referenced<br /> *  \param&#91;in,out&#93; ReportID    Report ID requested by the host if non-zero, otherwise callback should set to the generated report ID<br /> *  \param&#91;in&#93;     ReportType  Type of the report to create, either HID_REPORT_ITEM_In or HID_REPORT_ITEM_Feature<br /> *  \param&#91;out&#93;    ReportData  Pointer to a buffer where the created report should be stored<br /> *  \param&#91;out&#93;    ReportSize  Number of bytes written in the report (or zero if no report is to be sent)<br /> *<br /> *  \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent<br /> */<br />bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,<br />                                         uint8_t* const ReportID,<br />                                         const uint8_t ReportType,<br />                                         void* ReportData,<br />                                         uint16_t* const ReportSize)<br />{<br />    USB_JoystickReport_Data_t* JoystickReport = (USB_JoystickReport_Data_t*)ReportData;<br /><br />    uint8_t ButtonStatus_LCL = Buttons_GetStatus();<br /><br />    JoystickReport-&gt;Y = y_ax;<br />    JoystickReport-&gt;X = x_ax;<br /><br />    if (ButtonStatus_LCL &amp; BUTTONS_BUTTON2)<br />      JoystickReport-&gt;Button |= (1 &lt;&lt; 1);<br /><br />    if (ButtonStatus_LCL &amp; BUTTONS_BUTTON1)<br />      JoystickReport-&gt;Button |= (1 &lt;&lt; 0);<br /><br />    *ReportSize = sizeof(USB_JoystickReport_Data_t);<br /><br />    return false;<br />}<br /><br />/** HID class driver callback function for the processing of HID reports from the host.<br /> *<br /> *  \param&#91;in&#93; HIDInterfaceInfo  Pointer to the HID class interface configuration structure being referenced<br /> *  \param&#91;in&#93; ReportID    Report ID of the received report from the host<br /> *  \param&#91;in&#93; ReportType  The type of report that the host has sent, either HID_REPORT_ITEM_Out or HID_REPORT_ITEM_Feature<br /> *  \param&#91;in&#93; ReportData  Pointer to a buffer where the received report has been stored<br /> *  \param&#91;in&#93; ReportSize  Size in bytes of the received HID report<br /> */<br />void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,<br />                                          const uint8_t ReportID,<br />                                          const uint8_t ReportType,<br />                                          const void* ReportData,<br />                                          const uint16_t ReportSize)<br />{<br />    // Unused (but mandatory for the HID class driver) in this demo, since there are no Host-&gt;Device reports<br />}[/syntax]<br /><br />destriptors.h<br />[syntax=c]/*<br />             LUFA Library<br />     Copyright (C) Dean Camera, 2012.<br /><br />  dean &#91;at&#93; fourwalledcubicle &#91;dot&#93; com<br />           www.lufa-lib.org<br />*/<br /><br />/*<br />  Copyright 2012  Dean Camera (dean &#91;at&#93; fourwalledcubicle &#91;dot&#93; com)<br /><br />  Permission to use, copy, modify, distribute, and sell this<br />  software and its documentation for any purpose is hereby granted<br />  without fee, provided that the above copyright notice appear in<br />  all copies and that both that the copyright notice and this<br />  permission notice and warranty disclaimer appear in supporting<br />  documentation, and that the name of the author not be used in<br />  advertising or publicity pertaining to distribution of the<br />  software without specific, written prior permission.<br /><br />  The author disclaim all warranties with regard to this<br />  software, including all implied warranties of merchantability<br />  and fitness.  In no event shall the author be liable for any<br />  special, indirect or consequential damages or any damages<br />  whatsoever resulting from loss of use, data or profits, whether<br />  in an action of contract, negligence or other tortious action,<br />  arising out of or in connection with the use or performance of<br />  this software.<br />*/<br /><br />/** \file<br /> *<br /> *  Header file for Descriptors.c.<br /> */<br /><br />#ifndef _DESCRIPTORS_H_<br />#define _DESCRIPTORS_H_<br /><br />/* Includes: */<br />#include &lt;avr/pgmspace.h&gt;<br /><br />#include &lt;LUFA/Drivers/USB/USB.h&gt;<br /><br />/* Type Defines: */<br />/** Type define for the device configuration descriptor structure. This must be defined in the<br /> *  application code, as the configuration descriptor contains several sub-descriptors which<br /> *  vary between devices, and which describe the device's usage to the host.<br /> */<br />typedef struct<br />{<br />USB_Descriptor_Configuration_Header_t Config;<br /><br />// Joystick HID Interface<br />USB_Descriptor_Interface_t            HID_Interface;<br />USB_HID_Descriptor_HID_t              HID_JoystickHID;<br />        USB_Descriptor_Endpoint_t             HID_ReportINEndpoint;<br />} USB_Descriptor_Configuration_t;<br /><br />/* Macros: */<br />/** Endpoint number of the Joystick HID reporting IN endpoint. */<br />#define JOYSTICK_EPNUM               1<br /><br />/** Size in bytes of the Joystick HID reporting IN endpoint. */<br />#define JOYSTICK_EPSIZE              8<br /><br />/* Function Prototypes: */<br />uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,<br />                                    const uint8_t wIndex,<br />                                    const void** const DescriptorAddress)<br />                                    ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);<br /><br />#endif[/syntax]<br /><br />joystick.h<br />[syntax=c]/*<br />             LUFA Library<br />     Copyright (C) Dean Camera, 2012.<br /><br />  dean &#91;at&#93; fourwalledcubicle &#91;dot&#93; com<br />           www.lufa-lib.org<br />*/<br /><br />/*<br />  Copyright 2012  Dean Camera (dean &#91;at&#93; fourwalledcubicle &#91;dot&#93; com)<br /><br />  Permission to use, copy, modify, distribute, and sell this<br />  software and its documentation for any purpose is hereby granted<br />  without fee, provided that the above copyright notice appear in<br />  all copies and that both that the copyright notice and this<br />  permission notice and warranty disclaimer appear in supporting<br />  documentation, and that the name of the author not be used in<br />  advertising or publicity pertaining to distribution of the<br />  software without specific, written prior permission.<br /><br />  The author disclaim all warranties with regard to this<br />  software, including all implied warranties of merchantability<br />  and fitness.  In no event shall the author be liable for any<br />  special, indirect or consequential damages or any damages<br />  whatsoever resulting from loss of use, data or profits, whether<br />  in an action of contract, negligence or other tortious action,<br />  arising out of or in connection with the use or performance of<br />  this software.<br />*/<br /><br />/** \file<br /> *<br /> *  Header file for Joystick.c.<br /> */<br /><br />#ifndef _JOYSTICK_H_<br />#define _JOYSTICK_H_<br /><br />/* Includes: */<br />#include &lt;avr/io.h&gt;<br />#include &lt;avr/wdt.h&gt;<br />#include &lt;avr/power.h&gt;<br />#include &lt;avr/interrupt.h&gt;<br />#include &lt;string.h&gt;<br /><br />#include &quot;Descriptors.h&quot;<br /><br />#include &lt;LUFA/Version.h&gt;<br />#include &lt;LUFA/Drivers/Board/Joystick.h&gt;<br />#include &lt;LUFA/Drivers/Board/LEDs.h&gt;<br />#include &lt;LUFA/Drivers/Board/Buttons.h&gt;<br />#include &lt;LUFA/Drivers/USB/USB.h&gt;<br /><br />/* Type Defines: */<br />/** Type define for the joystick HID report structure, for creating and sending HID reports to the host PC.<br /> *  This mirrors the layout described to the host in the HID report descriptor, in Descriptors.c.<br /> */<br />typedef struct<br />{<br />int8_t  X; /**&lt; Current absolute joystick X position, as a signed 8-bit integer */<br />int8_t  Y; /**&lt; Current absolute joystick Y position, as a signed 8-bit integer */<br />uint8_t Button; /**&lt; Bit mask of the currently pressed joystick buttons */<br />} USB_JoystickReport_Data_t;<br /><br />/* Macros: */<br />/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */<br />#define LEDMASK_USB_NOTREADY      LEDS_LED1<br /><br />/** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */<br />#define LEDMASK_USB_ENUMERATING  (LEDS_LED2 | LEDS_LED3)<br /><br />/** LED mask for the library LED driver, to indicate that the USB interface is ready. */<br />#define LEDMASK_USB_READY        (LEDS_LED2 | LEDS_LED4)<br /><br />/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */<br />#define LEDMASK_USB_ERROR        (LEDS_LED1 | LEDS_LED3)<br /><br />/* Function Prototypes: */<br />void SetupHardware(void);<br /><br />void EVENT_USB_Device_Connect(void);<br />void EVENT_USB_Device_Disconnect(void);<br />void EVENT_USB_Device_ConfigurationChanged(void);<br />void EVENT_USB_Device_ControlRequest(void);<br />void EVENT_USB_Device_StartOfFrame(void);<br /><br />bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,<br />                                         uint8_t* const ReportID,<br />                                         const uint8_t ReportType,<br />                                         void* ReportData,<br />                                         uint16_t* const ReportSize);<br />void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,<br />                                          const uint8_t ReportID,<br />                                          const uint8_t ReportType,<br />                                          const void* ReportData,<br />                                          const uint16_t ReportSize);<br /><br />#endif[/syntax]<br /><br />Buttons.h<br />[syntax=c]/*<br />             LUFA Library<br />     Copyright (C) Dean Camera, 2012.<br /><br />  dean &#91;at&#93; fourwalledcubicle &#91;dot&#93; com<br />           www.lufa-lib.org<br />*/<br /><br />/*<br />  Copyright 2012  Dean Camera (dean &#91;at&#93; fourwalledcubicle &#91;dot&#93; com)<br /><br />  Permission to use, copy, modify, distribute, and sell this<br />  software and its documentation for any purpose is hereby granted<br />  without fee, provided that the above copyright notice appear in<br />  all copies and that both that the copyright notice and this<br />  permission notice and warranty disclaimer appear in supporting<br />  documentation, and that the name of the author not be used in<br />  advertising or publicity pertaining to distribution of the<br />  software without specific, written prior permission.<br /><br />  The author disclaim all warranties with regard to this<br />  software, including all implied warranties of merchantability<br />  and fitness.  In no event shall the author be liable for any<br />  special, indirect or consequential damages or any damages<br />  whatsoever resulting from loss of use, data or profits, whether<br />  in an action of contract, negligence or other tortious action,<br />  arising out of or in connection with the use or performance of<br />  this software.<br />*/<br /><br />/*<br />   This is a stub driver header file, for implementing custom board<br />   layout hardware with compatible LUFA board specific drivers. If<br />   the library is configured to use the BOARD_USER board mode, this<br />   driver file should be completed and copied into the &quot;/Board/&quot; folder<br />   inside the application's folder.<br /><br />   This stub is for the board-specific component of the LUFA Buttons driver,<br />   for the control of physical board-mounted GPIO pushbuttons.<br />*/<br /><br />#ifndef __BUTTONS_USER_H__<br />#define __BUTTONS_USER_H__<br /><br />    /* Includes: */<br />        // TODO: Add any required includes here<br /><br />    /* Enable C linkage for C++ Compilers: */<br />        #if defined(__cplusplus)<br />            extern &quot;C&quot; {<br />        #endif<br /><br />    /* Preprocessor Checks: */<br />        #if !defined(__INCLUDE_FROM_BUTTONS_H)<br />            #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.<br />        #endif<br /><br />    /* Public Interface - May be used in end-application: */<br />        /* Macros: */<br />            /** Button mask for the first button on the board. */<br />            #define BUTTONS_BUTTON1     (1&lt;&lt;PB6)<br />            #define BUTTONS_BUTTON2     (1&lt;&lt;PB4)<br />            #define BUTTONS_ALL_BUTTONS ( BUTTONS_BUTTON2 | BUTTONS_BUTTON1 )<br /><br />        /* Inline Functions: */<br />        #if !defined(__DOXYGEN__)<br />            static inline void Buttons_Init(void)<br />            {<br />                DDRB  &amp;= ~BUTTONS_ALL_BUTTONS;<br />                PORTB |=  BUTTONS_ALL_BUTTONS;<br />            }<br /><br />            static inline void Buttons_Disable(void)<br />            {<br />                DDRB  &amp;= ~BUTTONS_ALL_BUTTONS;<br />                PORTB &amp;= ~BUTTONS_ALL_BUTTONS;<br />            }<br /><br />            static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;<br />            static inline uint8_t Buttons_GetStatus(void)<br />            {<br />                return ( (PINB &amp; BUTTONS_ALL_BUTTONS) ^ BUTTONS_ALL_BUTTONS );<br />            }<br />        #endif<br /><br />    /* Disable C linkage for C++ Compilers: */<br />        #if defined(__cplusplus)<br />            }<br />        #endif<br /><br />#endif[/syntax]<br /><br />Mam nadzieję, że teraz wprowadziłem kod poprawnie. Płytka identyczna jak w artykule AVT5468 (ATmega32U4-DIPMOD). <br />Z góry dziękuję za pomoc,<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=13894">michal_c</a> — 15 maja 2016, o 16:29</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[michal_c]]></name></author>
<updated>2016-05-13T22:44:31+01:00</updated>
<published>2016-05-13T22:44:31+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160569#p160569</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160569#p160569"/>
<title type="html"><![CDATA[Re: Atmega32U4 Problem z USB]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160569#p160569"><![CDATA[
Udało się <img src="https://forum.atnel.pl/images/smilies/icon_e_smile.gif" alt=":)" title="Szczęśliwy" /> Dziękuję za pomoc <img src="https://forum.atnel.pl/images/smilies/icon_e_smile.gif" alt=":)" title="Szczęśliwy" />. Teraz pozostaje mi wykombinować dlaczego jak klikam przycisk na płytce to nie widzę tego na ekranie w sekcji kontrolerów.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=13894">michal_c</a> — 13 maja 2016, o 22:44</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Sparrow-hawk]]></name></author>
<updated>2016-05-12T07:24:25+01:00</updated>
<published>2016-05-12T07:24:25+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160491#p160491</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160491#p160491"/>
<title type="html"><![CDATA[Re: Atmega32U4 Problem z USB]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160491#p160491"><![CDATA[
Nie, w samym kodzie nie zmieniłem niczego.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=10614">Sparrow-hawk</a> — 12 maja 2016, o 07:24</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[michal_c]]></name></author>
<updated>2016-05-12T06:32:23+01:00</updated>
<published>2016-05-12T06:32:23+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160488#p160488</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160488#p160488"/>
<title type="html"><![CDATA[Re: Atmega32U4 Problem z USB]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160488#p160488"><![CDATA[
Dziekuje bardzo <img src="https://forum.atnel.pl/images/smilies/icon_e_smile.gif" alt=":)" title="Szczęśliwy" /> To dales mi nadzieje <img src="https://forum.atnel.pl/images/smilies/icon_e_smile.gif" alt=":)" title="Szczęśliwy" /> nie zmieniales nic w kodzie ? Teraz jestem na wyjezdzie sluzbowym. Jak tylko bede w domu jutro wieczorem odtworze Twoje kroki i mam nadzieje ze rowniez zadziala <img src="https://forum.atnel.pl/images/smilies/icon_e_smile.gif" alt=":)" title="Szczęśliwy" /><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=13894">michal_c</a> — 12 maja 2016, o 06:32</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Sparrow-hawk]]></name></author>
<updated>2016-05-11T20:22:19+01:00</updated>
<published>2016-05-11T20:22:19+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160450#p160450</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160450#p160450"/>
<title type="html"><![CDATA[Re: Atmega32U4 Problem z USB]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160450#p160450"><![CDATA[
Dziś miałem chwilkę, aby sprawdzić. W AVR Studio 7.0 wybrałem utworzenie przykładowego projektu. Odszukałem LUFA API CLASS JOYSTICK (Wymaga uprzedniej instalacji pakietu LUFA poprzez Extensions), utworzyłem projekt, zmieniłem procesor na Atmega32u4, wgrałem w Arduino micro i o to rezultat:<br /><a href="https://obrazkiforum.atnel.pl/10614/f9b73a02f0f51efdf33e5ae37b08723c.png"  class="postlink"><img src="https://obrazkiforum.atnel.pl/thumb/10614/f9b73a02f0f51efdf33e5ae37b08723c.png" alt="Obrazek" /></a><br />Tak więc, nie ma siły, musi działać <img src="https://forum.atnel.pl/images/smilies/icon_e_wink.gif" alt=";-)" title="Puszcza oko" /><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=10614">Sparrow-hawk</a> — 11 maja 2016, o 20:22</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[michal_c]]></name></author>
<updated>2016-05-10T19:05:30+01:00</updated>
<published>2016-05-10T19:05:30+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160384#p160384</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160384#p160384"/>
<title type="html"><![CDATA[Re: Atmega32U4 Problem z USB]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160384#p160384"><![CDATA[
Okej. Wykreslilem os Z z kodu i nadal mam ten sam problem <img src="https://forum.atnel.pl/images/smilies/icon_e_sad.gif" alt=":(" title="Smutny" /> i wszystko co bylo niezgodne z artykulem problem pozostal <img src="https://forum.atnel.pl/images/smilies/icon_e_sad.gif" alt=":(" title="Smutny" /> <img src="https://forum.atnel.pl/images/smilies/icon_e_sad.gif" alt=":(" title="Smutny" /> <img src="https://forum.atnel.pl/images/smilies/icon_e_sad.gif" alt=":(" title="Smutny" /> <br />dziekuje za informacje jak wstawiac kod na przyszlosc sie poprawie <img src="https://forum.atnel.pl/images/smilies/icon_e_smile.gif" alt=":)" title="Szczęśliwy" /><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=13894">michal_c</a> — 10 maja 2016, o 19:05</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[michal_c]]></name></author>
<updated>2016-05-10T19:05:30+01:00</updated>
<published>2016-05-10T19:05:30+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160383#p160383</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160383#p160383"/>
<title type="html"><![CDATA[Re: Atmega32U4 Problem z USB]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160383#p160383"><![CDATA[
Okej. Wykreslilem os Z z kodu i nadal mam ten sam problem <img src="https://forum.atnel.pl/images/smilies/icon_e_sad.gif" alt=":(" title="Smutny" /> i wszystko co bylo niezgodne z artykulem problem pozostal <img src="https://forum.atnel.pl/images/smilies/icon_e_sad.gif" alt=":(" title="Smutny" /> <img src="https://forum.atnel.pl/images/smilies/icon_e_sad.gif" alt=":(" title="Smutny" /> <img src="https://forum.atnel.pl/images/smilies/icon_e_sad.gif" alt=":(" title="Smutny" /> <br />dziekuje za informacje jak wstawiac kod na przyszlosc sie poprawie <img src="https://forum.atnel.pl/images/smilies/icon_e_smile.gif" alt=":)" title="Szczęśliwy" /><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=13894">michal_c</a> — 10 maja 2016, o 19:05</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Sparrow-hawk]]></name></author>
<updated>2016-05-10T14:52:23+01:00</updated>
<published>2016-05-10T14:52:23+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160367#p160367</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160367#p160367"/>
<title type="html"><![CDATA[Re: Atmega32U4 Problem z USB]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160367#p160367"><![CDATA[
Odnośnie wstawiania kodu zerknij proszę tutaj: <a href="http://forum.atnel.pl/topic7402.html"  class="postlink">http://forum.atnel.pl/topic7402.html</a><br /><br />Widzę w tym kodzie dodatkowe zmiany, które wprowadziłeś, nie tylko te wynikające z artykułu. Więc może zacznij od początku i nie dokładaj żadnych zmian od siebie w postaci np. trzeciej osi z.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=10614">Sparrow-hawk</a> — 10 maja 2016, o 14:52</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[michal_c]]></name></author>
<updated>2016-05-10T10:15:45+01:00</updated>
<published>2016-05-10T10:15:45+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160348#p160348</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160348#p160348"/>
<title type="html"><![CDATA[Re: Atmega32U4 Problem z USB]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160348#p160348"><![CDATA[
Dziękuję za odpowiedź. <br />Kod wstawiłem najlepiej jak umiałem <img src="https://forum.atnel.pl/images/smilies/icon_e_sad.gif" alt=":(" title="Smutny" /> nie wiem jak wprowadzić go lepiej..... <br />w fizycznie polutowanym układzie mam dobre wartości rezystorów <img src="https://forum.atnel.pl/images/smilies/icon_e_smile.gif" alt=":)" title="Szczęśliwy" /> <br />Poza tym korzystam teraz z płytki dostarczonej mi z AVT.<br />Jedyne zmiany jakie zrobiłem w LUFA to te z artykułu:<br />ATmega32U4-DIPMOD AVT5468<br />Instaluję w avrstudio 7 rozszerzenie LUFY, jednak nie wiem czy tutaj jest problem..... <br />Bo ja tak jak bym nie miał dostępu do tego joysticka.......ale laptop widzi że coś tam jest.....<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=13894">michal_c</a> — 10 maja 2016, o 10:15</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Sparrow-hawk]]></name></author>
<updated>2016-05-10T07:32:40+01:00</updated>
<published>2016-05-10T07:32:40+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160329#p160329</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160329#p160329"/>
<title type="html"><![CDATA[Re: Atmega32U4 Problem z USB]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160329#p160329"><![CDATA[
Po pierwsze wstaw kod we właściwy sposób. Po drugie, czemu na D+ i D- masz rezystory 1k? Skąd wykopałeś AVR Studio 4? Proponuję zainstalować AVR Studio 7 i tam poprzez zakładkę &quot;Extensions&quot; doinstalować pakiet LUFA. Coś zmieniałeś w tym projekcie LUFA, który tu zamieściłeś?<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=10614">Sparrow-hawk</a> — 10 maja 2016, o 07:32</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[michal_c]]></name></author>
<updated>2016-05-09T08:39:54+01:00</updated>
<published>2016-05-09T08:39:54+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160267#p160267</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160267#p160267"/>
<title type="html"><![CDATA[Atmega32U4 Problem z USB]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=15337&amp;p=160267#p160267"><![CDATA[
Cześć,<br />Od dłuższego czasu mam problem z moim joystickiem. <br />W załącznikach widoczny jest schemat zaprojektowanej przeze mnie płytki. <br /><a href="https://obrazkiforum.atnel.pl/13894/00c2867d07db18654587965a2f7b5a05.PNG"  class="postlink"><img src="https://obrazkiforum.atnel.pl/thumb/13894/00c2867d07db18654587965a2f7b5a05.PNG" alt="Obrazek" /></a><br />Dodatkowo z powodu niemożliwości zaprogramowania USB zakupiłem zestaw:<br />AVT5468 (ATmega32U4-DIPMOD). <br />Chciałem go zrobić na procesorze ATmega32u4. Chciałem zrobić z tego USB-HID. <br />Urządzenie po podłączeniu do dowolnego laptopa (z dowolnym systemem WinXp/Win7/Win10/Linux)<br />jest widoczny jako podłączone urządzenie. Jak widać na załączniku. <br /><a href="https://obrazkiforum.atnel.pl/13894/bc0403ce3e21131e4be205729e861d14.PNG"  class="postlink"><img src="https://obrazkiforum.atnel.pl/thumb/13894/bc0403ce3e21131e4be205729e861d14.PNG" alt="Obrazek" /></a><br />Pojawia się jako kontrolerów, ale w sekcji kontrolery jest nie dostępny. Jak widoczne w następnym załączniku.<br /><a href="https://obrazkiforum.atnel.pl/13894/9bab806d67ce79d30187781af95884ad.PNG"  class="postlink"><img src="https://obrazkiforum.atnel.pl/thumb/13894/9bab806d67ce79d30187781af95884ad.PNG" alt="Obrazek" /></a><br />Zgodnie z artykułem z AVT5468 układ programowałem za pomocą LUFA-120219. <br />Programowałem w AVR Studio 4. <br />Program na płytkę wgrywałem za pomocą programu FLIP.<br />Co zrobić aby urządzenie było widoczne w sekcji kontrolerów? Podejrzewam że gdzieś zrobiłem błąd w pliku descriptors.c ale naprawdę już nie mam pojęcia co mogę zmienić......<br />Poniżej poszczególne zawartości moich plików. <br />descriptors.c:<br />[syntax]/*<br />             LUFA Library<br />     Copyright (C) Dean Camera, 2015.<br /><br />  dean &#91;at&#93; fourwalledcubicle &#91;dot&#93; com<br />           www.lufa-lib.org<br />*/<br /><br />/*<br />  Copyright 2015  Dean Camera (dean &#91;at&#93; fourwalledcubicle &#91;dot&#93; com)<br /><br />  Permission to use, copy, modify, distribute, and sell this<br />  software and its documentation for any purpose is hereby granted<br />  without fee, provided that the above copyright notice appear in<br />  all copies and that both that the copyright notice and this<br />  permission notice and warranty disclaimer appear in supporting<br />  documentation, and that the name of the author not be used in<br />  advertising or publicity pertaining to distribution of the<br />  software without specific, written prior permission.<br /><br />  The author disclaims all warranties with regard to this<br />  software, including all implied warranties of merchantability<br />  and fitness.  In no event shall the author be liable for any<br />  special, indirect or consequential damages or any damages<br />  whatsoever resulting from loss of use, data or profits, whether<br />  in an action of contract, negligence or other tortious action,<br />  arising out of or in connection with the use or performance of<br />  this software.<br />*/<br /><br />/** \file<br /> *<br /> *  USB Device Descriptors, for library use when in USB device mode. Descriptors are special<br /> *  computer-readable structures which the host requests upon device enumeration, to determine<br /> *  the device's capabilities and functions.<br /> */<br /><br />#include &quot;Descriptors.h&quot;<br /><br />/** HID class report descriptor. This is a special descriptor constructed with values from the<br /> *  USBIF HID class specification to describe the reports and capabilities of the HID device. This<br /> *  descriptor is parsed by the host and its contents used to determine what data (and in what encoding)<br /> *  the device will send, and what it may be sent back from the host. Refer to the HID specification for<br /> *  more details on HID report descriptors.<br /> */<br />const USB_Descriptor_HIDReport_Datatype_t PROGMEM JoystickReport&#91;&#93; =<br />{<br />/* Use the HID class driver's standard Joystick report.<br /> *   Min X/Y/Z Axis values: -100<br /> *   Max X/Y/Z Axis values:  100<br /> *   Min physical X/Y/Z Axis values (used to determine resolution): -1<br /> *   Max physical X/Y/Z Axis values (used to determine resolution):  1<br /> *   Buttons: 2<br /> */<br />HID_DESCRIPTOR_JOYSTICK(-100, 100, -1, 1, 2)<br />};<br /><br />/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall<br /> *  device characteristics, including the supported USB version, control endpoint size and the<br /> *  number of device configurations. The descriptor is read out by the USB host when the enumeration<br /> *  process begins.<br /> */<br />const USB_Descriptor_Device_t PROGMEM DeviceDescriptor =<br />{<br />.Header                 = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},<br /><br />.USBSpecification       = VERSION_BCD(1,1,0),<br />.Class                  = USB_CSCP_NoDeviceClass,<br />.SubClass               = USB_CSCP_NoDeviceSubclass,<br />.Protocol               = USB_CSCP_NoDeviceProtocol,<br /><br />.Endpoint0Size          = FIXED_CONTROL_ENDPOINT_SIZE,<br /><br />.VendorID               = 0x03EB,<br />.ProductID              = 0x2043,<br />.ReleaseNumber          = VERSION_BCD(0,0,1),<br /><br />.ManufacturerStrIndex   = STRING_ID_Manufacturer,<br />.ProductStrIndex        = STRING_ID_Product,<br />.SerialNumStrIndex      = NO_DESCRIPTOR,<br /><br />.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS<br />};<br /><br />/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage<br /> *  of the device in one of its supported configurations, including information about any device interfaces<br /> *  and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting<br /> *  a configuration so that the host may correctly communicate with the USB device.<br /> */<br />const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =<br />{<br />.Config =<br />{<br />.Header                 = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},<br /><br />.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),<br />.TotalInterfaces        = 1,<br /><br />.ConfigurationNumber    = 1,<br />.ConfigurationStrIndex  = NO_DESCRIPTOR,<br /><br />.ConfigAttributes       = (USB_CONFIG_ATTR_RESERVED | USB_CONFIG_ATTR_SELFPOWERED),<br /><br />.MaxPowerConsumption    = USB_CONFIG_POWER_MA(100)<br />},<br /><br />.HID_Interface =<br />{<br />.Header                 = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},<br /><br />.InterfaceNumber        = INTERFACE_ID_Joystick,<br />.AlternateSetting       = 0x00,<br /><br />.TotalEndpoints         = 1,<br /><br />.Class                  = HID_CSCP_HIDClass,<br />.SubClass               = HID_CSCP_NonBootSubclass,<br />.Protocol               = HID_CSCP_NonBootProtocol,<br /><br />.InterfaceStrIndex      = NO_DESCRIPTOR<br />},<br /><br />.HID_JoystickHID =<br />{<br />.Header                 = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},<br /><br />.HIDSpec                = VERSION_BCD(1,1,1),<br />.CountryCode            = 0x00,<br />.TotalReportDescriptors = 1,<br />.HIDReportType          = HID_DTYPE_Report,<br />.HIDReportLength        = sizeof(JoystickReport)<br />},<br /><br />.HID_ReportINEndpoint =<br />{<br />.Header                 = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},<br /><br />.EndpointAddress        = JOYSTICK_EPADDR,<br />.Attributes             = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),<br />.EndpointSize           = JOYSTICK_EPSIZE,<br />.PollingIntervalMS      = 0x05<br />}<br />};<br /><br />/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests<br /> *  the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate<br /> *  via the language ID table available at USB.org what languages the device supports for its string descriptors.<br /> */<br />const USB_Descriptor_String_t PROGMEM LanguageString = USB_STRING_DESCRIPTOR_ARRAY(LANGUAGE_ID_ENG);<br /><br />/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable<br /> *  form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device<br /> *  Descriptor.<br /> */<br />const USB_Descriptor_String_t PROGMEM ManufacturerString = USB_STRING_DESCRIPTOR(L&quot;Dean Camera&quot;);<br /><br />/** Product descriptor string. This is a Unicode string containing the product's details in human readable form,<br /> *  and is read out upon request by the host when the appropriate string ID is requested, listed in the Device<br /> *  Descriptor.<br /> */<br />const USB_Descriptor_String_t PROGMEM ProductString = USB_STRING_DESCRIPTOR(L&quot;LUFA Joystick Demo&quot;);<br /><br />/** This function is called by the library when in device mode, and must be overridden (see library &quot;USB Descriptors&quot;<br /> *  documentation) by the application code so that the address and size of a requested descriptor can be given<br /> *  to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function<br /> *  is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the<br /> *  USB host.<br /> */<br />uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,<br />                                    const uint8_t wIndex,<br />                                    const void** const DescriptorAddress)<br />{<br />const uint8_t  DescriptorType   = (wValue &gt;&gt; 8);<br />const uint8_t  DescriptorNumber = (wValue &amp; 0xFF);<br /><br />const void* Address = NULL;<br />uint16_t    Size    = NO_DESCRIPTOR;<br /><br />switch (DescriptorType)<br />{<br />case DTYPE_Device:<br />Address = &amp;DeviceDescriptor;<br />Size    = sizeof(USB_Descriptor_Device_t);<br />break;<br />case DTYPE_Configuration:<br />Address = &amp;ConfigurationDescriptor;<br />Size    = sizeof(USB_Descriptor_Configuration_t);<br />break;<br />case DTYPE_String:<br />switch (DescriptorNumber)<br />{<br />case STRING_ID_Language:<br />Address = &amp;LanguageString;<br />Size    = pgm_read_byte(&amp;LanguageString.Header.Size);<br />break;<br />case STRING_ID_Manufacturer:<br />Address = &amp;ManufacturerString;<br />Size    = pgm_read_byte(&amp;ManufacturerString.Header.Size);<br />break;<br />case STRING_ID_Product:<br />Address = &amp;ProductString;<br />Size    = pgm_read_byte(&amp;ProductString.Header.Size);<br />break;<br />}<br /><br />break;<br />case HID_DTYPE_HID:<br />Address = &amp;ConfigurationDescriptor.HID_JoystickHID;<br />Size    = sizeof(USB_HID_Descriptor_HID_t);<br />break;<br />case HID_DTYPE_Report:<br />Address = &amp;JoystickReport;<br />Size    = sizeof(JoystickReport);<br />break;<br />}<br /><br />*DescriptorAddress = Address;<br />return Size;<br />}[/syntax]<br /><br />discriptors.h:<br />[syntax]#ifndef _DESCRIPTORS_H_<br />#define _DESCRIPTORS_H_<br /><br />/* Includes: */<br />#include &lt;avr/pgmspace.h&gt;<br /><br />#include &lt;LUFA/Drivers/USB/USB.h&gt;<br /><br />/* Type Defines: */<br />/** Type define for the device configuration descriptor structure. This must be defined in the<br /> *  application code, as the configuration descriptor contains several sub-descriptors which<br /> *  vary between devices, and which describe the device's usage to the host.<br /> */<br />typedef struct<br />{<br />USB_Descriptor_Configuration_Header_t Config;<br /><br />// Joystick HID Interface<br />USB_Descriptor_Interface_t            HID_Interface;<br />USB_HID_Descriptor_HID_t              HID_JoystickHID;<br />        USB_Descriptor_Endpoint_t             HID_ReportINEndpoint;<br />} USB_Descriptor_Configuration_t;<br /><br />/** Enum for the device interface descriptor IDs within the device. Each interface descriptor<br /> *  should have a unique ID index associated with it, which can be used to refer to the<br /> *  interface from other descriptors.<br /> */<br />enum InterfaceDescriptors_t<br />{<br />INTERFACE_ID_Joystick = 0, /**&lt; Joystick interface desciptor ID */<br />};<br /><br />/** Enum for the device string descriptor IDs within the device. Each string descriptor should<br /> *  have a unique ID index associated with it, which can be used to refer to the string from<br /> *  other descriptors.<br /> */<br />enum StringDescriptors_t<br />{<br />STRING_ID_Language     = 0, /**&lt; Supported Languages string descriptor ID (must be zero) */<br />STRING_ID_Manufacturer = 1, /**&lt; Manufacturer string ID */<br />STRING_ID_Product      = 2, /**&lt; Product string ID */<br />};<br /><br />/* Macros: */<br />/** Endpoint address of the Joystick HID reporting IN endpoint. */<br />#define JOYSTICK_EPADDR              (ENDPOINT_DIR_IN | 1)<br /><br />/** Size in bytes of the Joystick HID reporting IN endpoint. */<br />#define JOYSTICK_EPSIZE              8<br /><br />/* Function Prototypes: */<br />uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,<br />                                    const uint8_t wIndex,<br />                                    const void** const DescriptorAddress)<br />                                    ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);<br /><br />#endif[/syntax]<br /><br />joystick.c:<br /><br />[syntax]#include &quot;Joystick.h&quot;<br />#include&lt;LUFA/Drivers/Peripheral/ADC.h&gt;<br /><br />/** Buffer to hold the previously generated HID report, for comparison purposes inside the HID class driver. */<br />static uint8_t PrevJoystickHIDReportBuffer&#91;sizeof(USB_JoystickReport_Data_t)&#93;;<br /><br />/** LUFA HID Class driver interface configuration and state information. This structure is<br /> *  passed to all HID Class driver functions, so that multiple instances of the same class<br /> *  within a device can be differentiated from one another.<br /> */<br />USB_ClassInfo_HID_Device_t Joystick_HID_Interface =<br />{<br />.Config =<br />{<br />.InterfaceNumber              = 0,<br /><br />.ReportINEndpointNumber       = JOYSTICK_EPADDR,<br />.ReportINEndpointSize         = JOYSTICK_EPSIZE,<br />.ReportINEndpointDoubleBank   = false,<br /><br />.PrevReportINBuffer           = PrevJoystickHIDReportBuffer,<br />.PrevReportINBufferSize       = sizeof(PrevJoystickHIDReportBuffer),<br />},<br />};<br /><br /><br />/** Main program entry point. This routine contains the overall program flow, including initial<br /> *  setup of all components and the main program loop.<br /> */<br /><br />static int8_t y_ax;<br />static int8_t x_ax;<br />static int8_t z_ax;<br />int main(void)<br />{<br />SetupHardware();<br /><br />LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);<br />sei();<br /><br />for (;;)<br />{<br />// Suma kolejnych próbek poszczególnych kanałów ADC.<br />int16_t y_ax_sum = 0;<br />int16_t x_ax_sum = 0;<br />// Pętla pomiarowa. Napięcie poszczególnych kanałów zostanie zmierzone<br />// tyle razy, ile określono w stałej JOY_ADC_SAMPLES_NUM.<br />for( uint8_t i = 0; i &lt; JOY_ADC_SAMPLES_NUM; i++ )<br />{<br />// Wybór kanału zapisanego w stałej JOY_ADC_CHANNEL_Y.<br />ADC_SetupChannel( JOY_ADC_CHANNEL_Y );<br />// Pomiar napięcia wybranego kanału ADC. Parametr wywołania oznacza, że:<br />// a) napięcie odniesienia przetwornika pobierane jest z pinu AVCC (ADC_REFERENCE_AVCC)<br />// b) wynik pomiaru jest wyrównany do lewej strony (ADC_LEFT_ADJUSTED)<br />// c) wybrany zostaje kanał określony w stałej JOY_ADC_CHANNEL_Y<br />// Funkcja ADC_GetChannelReading() czeka w pętli na zakończenie konwersji. Wynik, przed dodaniem<br />// do zmiennej sumy próbek jest przesuwany o 8 bitów w prawo, ponieważ parametr ADC_LEFT_ADJUSTED<br />// oznacza, że 8 najbardziej znaczących bitów 10 bitowego wyniku pomiaru jest umieszczanych w<br />// bardziej znaczącym bajcie 16 bitowego wyniku zwracanego przez funkcję. Dzięki tym operacjom,<br />// wynik przetwarzania jest 8 bitowy, bazując na 10 bitowym przetworniku.<br />y_ax_sum += ADC_GetChannelReading( ADC_REFERENCE_AVCC | ADC_LEFT_ADJUSTED | JOY_ADC_CHANNEL_Y ) &gt;&gt; 8;<br />ADC_SetupChannel( JOY_ADC_CHANNEL_X );<br />x_ax_sum += ADC_GetChannelReading( ADC_REFERENCE_AVCC | ADC_LEFT_ADJUSTED | JOY_ADC_CHANNEL_X ) &gt;&gt; 8;<br />}<br />// Obliczenie pozycji potencjometrów osi X-Y. Po pierwsze, wynik pomiaru (suma próbek)<br />// poszczególnych kanałów jest uśredniany (dzielony przez JOY_ADC_SAMPLES_NUM). Następnie<br />// wartość bez znaku z zakresu 0-255 jest zamieniana na wartość ze znakiem z<br />// zakresu -128 - +127, poprzez odjęcie wartości 128 (255 - 128 = 127, 0 - 128 = -128).<br />y_ax = (y_ax_sum / JOY_ADC_SAMPLES_NUM) - 128;<br />x_ax = (x_ax_sum / JOY_ADC_SAMPLES_NUM) - 128;<br />z_ax=0;<br />HID_Device_USBTask(&amp;Joystick_HID_Interface);<br />USB_USBTask();<br />}<br />}<br /><br />/** Configures the board hardware and chip peripherals for the demo's functionality. */<br />void SetupHardware(void)<br />{<br />/* Disable watchdog if enabled by bootloader/fuses */<br />MCUSR &amp;= ~(1 &lt;&lt; WDRF);<br />wdt_disable();<br /><br />/* Disable clock division */<br />clock_prescale_set(clock_div_1);<br /><br />/* Hardware Initialization */<br />//Joystick_Init();<br />ADC_Init( ADC_SINGLE_CONVERSION | ADC_PRESCALE_128 );<br />LEDs_Init();<br />Buttons_Init();<br />USB_Init();<br />}<br /><br />/** Event handler for the library USB Connection event. */<br />void EVENT_USB_Device_Connect(void)<br />{<br />LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);<br />}<br /><br />/** Event handler for the library USB Disconnection event. */<br />void EVENT_USB_Device_Disconnect(void)<br />{<br />LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);<br />}<br /><br />/** Event handler for the library USB Configuration Changed event. */<br />void EVENT_USB_Device_ConfigurationChanged(void)<br />{<br />bool ConfigSuccess = true;<br /><br />ConfigSuccess &amp;= HID_Device_ConfigureEndpoints(&amp;Joystick_HID_Interface);<br /><br />USB_Device_EnableSOFEvents();<br /><br />LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);<br />}<br /><br />/** Event handler for the library USB Control Request reception event. */<br />void EVENT_USB_Device_ControlRequest(void)<br />{<br />HID_Device_ProcessControlRequest(&amp;Joystick_HID_Interface);<br />}<br /><br />/** Event handler for the USB device Start Of Frame event. */<br />void EVENT_USB_Device_StartOfFrame(void)<br />{<br />HID_Device_MillisecondElapsed(&amp;Joystick_HID_Interface);<br />}<br /><br />/** HID class driver callback function for the creation of HID reports to the host.<br /> *<br /> *  \param&#91;in&#93;     HIDInterfaceInfo  Pointer to the HID class interface configuration structure being referenced<br /> *  \param&#91;in,out&#93; ReportID    Report ID requested by the host if non-zero, otherwise callback should set to the generated report ID<br /> *  \param&#91;in&#93;     ReportType  Type of the report to create, either HID_REPORT_ITEM_In or HID_REPORT_ITEM_Feature<br /> *  \param&#91;out&#93;    ReportData  Pointer to a buffer where the created report should be stored<br /> *  \param&#91;out&#93;    ReportSize  Number of bytes written in the report (or zero if no report is to be sent)<br /> *<br /> *  \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent<br /> */<br />bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,<br />                                         uint8_t* const ReportID,<br />                                         const uint8_t ReportType,<br />                                         void* ReportData,<br />                                         uint16_t* const ReportSize)<br />{<br />USB_JoystickReport_Data_t* JoystickReport = (USB_JoystickReport_Data_t*)ReportData;<br />uint8_t ButtonStatus_LCL = Buttons_GetStatus();<br />JoystickReport-&gt;Y = y_ax;<br />JoystickReport-&gt;X = x_ax;<br />if (ButtonStatus_LCL &amp; BUTTONS_BUTTON2)<br />JoystickReport-&gt;Button |= (1 &lt;&lt; 1);<br />if (ButtonStatus_LCL &amp; BUTTONS_BUTTON1)<br />JoystickReport-&gt;Button |= (1 &lt;&lt; 0);<br />*ReportSize = sizeof(USB_JoystickReport_Data_t);<br />return false;<br />}<br /><br />/** HID class driver callback function for the processing of HID reports from the host.<br /> *<br /> *  \param&#91;in&#93; HIDInterfaceInfo  Pointer to the HID class interface configuration structure being referenced<br /> *  \param&#91;in&#93; ReportID    Report ID of the received report from the host<br /> *  \param&#91;in&#93; ReportType  The type of report that the host has sent, either HID_REPORT_ITEM_Out or HID_REPORT_ITEM_Feature<br /> *  \param&#91;in&#93; ReportData  Pointer to a buffer where the received report has been stored<br /> *  \param&#91;in&#93; ReportSize  Size in bytes of the received HID report<br /> */<br />void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,<br />                                          const uint8_t ReportID,<br />                                          const uint8_t ReportType,<br />                                          const void* ReportData,<br />                                          const uint16_t ReportSize)<br />{<br />// Unused (but mandatory for the HID class driver) in this demo, since there are no Host-&gt;Device reports<br />}[/syntax]<br /><br />joystick.h:<br />[syntax]#ifndef _JOYSTICK_H_<br />#define _JOYSTICK_H_<br /><br />/* Includes: */<br />#include &lt;avr/io.h&gt;<br />#include &lt;avr/wdt.h&gt;<br />#include &lt;avr/power.h&gt;<br />#include &lt;avr/interrupt.h&gt;<br />#include &lt;string.h&gt;<br /><br />#include &quot;Descriptors.h&quot;<br /><br />#include &lt;LUFA/Version.h&gt;<br />#include &lt;LUFA/Drivers/Board/Joystick.h&gt;<br />#include &lt;LUFA/Drivers/Board/LEDs.h&gt;<br />#include &lt;LUFA/Drivers/Board/Buttons.h&gt;<br />#include &lt;LUFA/Drivers/USB/USB.h&gt;<br /><br />/* Type Defines: */<br />/** Type define for the joystick HID report structure, for creating and sending HID reports to the host PC.<br /> *  This mirrors the layout described to the host in the HID report descriptor, in Descriptors.c.<br /> */<br />typedef struct<br />{<br />int8_t  X; /**&lt; Current absolute joystick X position, as a signed 8-bit integer */<br />int8_t  Y; /**&lt; Current absolute joystick Y position, as a signed 8-bit integer */<br />uint8_t Button; /**&lt; Bit mask of the currently pressed joystick buttons */<br />} USB_JoystickReport_Data_t;<br /><br />/* Macros: */<br />/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */<br />#define LEDMASK_USB_NOTREADY      LEDS_LED1<br /><br />/** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */<br />#define LEDMASK_USB_ENUMERATING  (LEDS_LED2 | LEDS_LED3)<br /><br />/** LED mask for the library LED driver, to indicate that the USB interface is ready. */<br />#define LEDMASK_USB_READY        (LEDS_LED2 | LEDS_LED4)<br /><br />/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */<br />#define LEDMASK_USB_ERROR        (LEDS_LED1 | LEDS_LED3)<br /><br />/* Function Prototypes: */<br />void SetupHardware(void);<br /><br />void EVENT_USB_Device_Connect(void);<br />void EVENT_USB_Device_Disconnect(void);<br />void EVENT_USB_Device_ConfigurationChanged(void);<br />void EVENT_USB_Device_ControlRequest(void);<br />void EVENT_USB_Device_StartOfFrame(void);<br /><br />bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,<br />                                         uint8_t* const ReportID,<br />                                         const uint8_t ReportType,<br />                                         void* ReportData,<br />                                         uint16_t* const ReportSize);<br />void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,<br />                                          const uint8_t ReportID,<br />                                          const uint8_t ReportType,<br />                                          const void* ReportData,<br />                                          const uint16_t ReportSize);<br /><br />#endif[/syntax]<br /><br />Z góry dziękuję za pomoc.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=13894">michal_c</a> — 9 maja 2016, o 08:39</p><hr />
]]></content>
</entry>
</feed>