Add branch for the conversion of demos to use standard C header files for configuration, rather than makefile defined macros.
This commit is contained in:
parent
e8570c4a37
commit
359fbfe14d
395 changed files with 9912 additions and 2756 deletions
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific LED driver header for the Adafruit U4 Breakout board (http://ladyada.net/products/atmega32u4breakout).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTE.6</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -109,7 +114,7 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTE ^= LEDMask;
|
||||
PINE = LEDMask;
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific Buttons driver header for the Atmel ATAVRUSBRF01.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,12 @@
|
|||
*
|
||||
* Board specific LED driver header for the Atmel ATAVRUSBRF01.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>RX LED</td><td>High</td><td>PORTD.0</td></tr>
|
||||
* <tr><td>LEDS_LED2</td><td>Red</td><td>TX LED</td><td>High</td><td>PORTD.1</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -61,15 +67,6 @@
|
|||
#error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead.
|
||||
#endif
|
||||
|
||||
/* Private Interface - For use in library only: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
/* Macros: */
|
||||
#define LEDS_PORTD_LEDS (LEDS_LED1 | LEDS_LED2)
|
||||
#define LEDS_PORTE_LEDS (LEDS_LED3 | LEDS_LED4)
|
||||
|
||||
#define LEDS_PORTE_MASK_SHIFT 4
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** LED mask for the first LED on the board. */
|
||||
|
@ -121,7 +118,7 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTD ^= LEDMask;
|
||||
PIND = LEDMask;
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific Buttons driver header for the Tempusdictum Benito (http://dorkbotpdx.org/wiki/benito).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,12 @@
|
|||
*
|
||||
* Board specific LED driver header for the Tempusdictum Benito (http://dorkbotpdx.org/wiki/benito).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>TX LED</td><td>Low</td><td>PORTC.7</td></tr>
|
||||
* <tr><td>LEDS_LED2</td><td>Red</td><td>RX LED</td><td>Low</td><td>PORTC.6</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -112,7 +118,7 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTC ^= LEDMask;
|
||||
PINC = LEDMask;
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -42,6 +42,13 @@
|
|||
*
|
||||
* Board specific LED driver header for the Bitwizard Big-Multio (http://www.bitwizard.nl/wiki/index.php/Usbbigmultio).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Unknown</td><td>LED0</td><td>High</td><td>PORTF.6</td></tr>
|
||||
* <tr><td>LEDS_LED2</td><td>Unknown</td><td>LED1</td><td>High</td><td>PORTF.7</td></tr>
|
||||
* <tr><td>LEDS_LED3</td><td>Unknown</td><td>LED2</td><td>High</td><td>PORTE.2</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -132,8 +139,8 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTF ^= (LEDMask & LEDS_PORTF_LEDS);
|
||||
PORTE ^= (LEDMask & LEDS_PORTE_LEDS);
|
||||
PINF = (LEDMask & LEDS_PORTF_LEDS);
|
||||
PINE = (LEDMask & LEDS_PORTE_LEDS);
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -40,7 +40,13 @@
|
|||
* \defgroup Group_LEDs_BLACKCAT BLACKCAT
|
||||
* \brief Board specific LED driver header for the BLACKCAT USB JTAG.
|
||||
*
|
||||
* Board specific LED driver header for the TCNISO Blackcat USB JTAG (http://www.embeddedcomputers.net/products/BlackcatUSB/.
|
||||
* Board specific LED driver header for the TCNISO Blackcat USB JTAG (http://www.embeddedcomputers.net/products/BlackcatUSB).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Unknown</td><td>LED0</td><td>High</td><td>PORTD.6</td></tr>
|
||||
* <tr><td>LEDS_LED2</td><td>Unknown</td><td>LED1</td><td>High</td><td>PORTD.3</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
@ -112,7 +118,7 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTD ^= LEDMask;
|
||||
PIND = LEDMask;
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -42,6 +42,13 @@
|
|||
*
|
||||
* Board specific LED driver header for the Busware BUI (http://www.busware.de/tiki-index.php?page=BUI).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Red</td><td>RGB LED</td><td>High</td><td>PORTC.2</td></tr>
|
||||
* <tr><td>LEDS_LED2</td><td>Green</td><td>RGB LED</td><td>High</td><td>PORTC.3</td></tr>
|
||||
* <tr><td>LEDS_LED3</td><td>Blue</td><td>RGB LED</td><td>High</td><td>PORTC.4</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -115,7 +122,7 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTC ^= LEDMask;
|
||||
PINC = LEDMask;
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -44,6 +44,11 @@
|
|||
* third-party board does not include any on-board peripherals, but does have an officially recommended external peripheral
|
||||
* layout for buttons, LEDs and a Joystick.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -44,6 +44,11 @@
|
|||
* third-party board does not include any on-board peripherals, but does have an officially recommended external peripheral
|
||||
* layout for buttons, LEDs and a Joystick.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Left Port Pin</th><th>Up Port Pin</th><th>Right Port Pin</th><th>Down Port Pin</th><th>Press Port Pin</th></tr>
|
||||
* <tr><td>PORTD.2</td><td>PORTD.3</td><td>PORTD.0</td><td>PORTD.1</td><td>PORTD.4</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -44,6 +44,14 @@
|
|||
* third-party board does not include any on-board peripherals, but does have an officially recommended external
|
||||
* peripheral layout for buttons, LEDs and a Joystick.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>N/A</td><td>User Supplied</td><td>High</td><td>PORTB.4</td></tr>
|
||||
* <tr><td>LEDS_LED2</td><td>N/A</td><td>User Supplied</td><td>High</td><td>PORTB.5</td></tr>
|
||||
* <tr><td>LEDS_LED3</td><td>N/A</td><td>User Supplied</td><td>High</td><td>PORTB.6</td></tr>
|
||||
* <tr><td>LEDS_LED4</td><td>N/A</td><td>User Supplied</td><td>High</td><td>PORTB.7</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -120,7 +128,7 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTB ^= LEDMask;
|
||||
PINB = LEDMask;
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific Buttons driver header for the Busware CUL V3 (http://busware.de/tiki-index.php?page=CUL).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTE.2</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific LED driver header for the Busware CUL V3 (http://busware.de/tiki-index.php?page=CUL).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Yellow</td><td>General Indicator</td><td>High</td><td>PORTE.6</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -109,7 +114,7 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTE ^= LEDMask;
|
||||
PINE = LEDMask;
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
147
LUFA/Drivers/Board/AVR8/DUCE/LEDs.h
Normal file
147
LUFA/Drivers/Board/AVR8/DUCE/LEDs.h
Normal file
|
@ -0,0 +1,147 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Board specific LED driver header for the DorkbotPDX Duce.
|
||||
* \copydetails Group_LEDs_DUCE
|
||||
*
|
||||
* \note This file should not be included directly. It is automatically included as needed by the LEDs driver
|
||||
* dispatch header located in LUFA/Drivers/Board/LEDs.h.
|
||||
*/
|
||||
|
||||
/** \ingroup Group_LEDs
|
||||
* \defgroup Group_LEDs_DUCE DUCE
|
||||
* \brief Board specific LED driver header for the DorkbotPDX Duce.
|
||||
*
|
||||
* Board specific LED driver header for the DorkbotPDX Duce (http://dorkbotpdx.org/wiki/duce).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Red</td><td>Bicolor Indicator 1</td><td>High</td><td>PORTC.4</td></tr>
|
||||
* <tr><td>LEDS_LED2</td><td>Green</td><td>Bicolor Indicator 1</td><td>High</td><td>PORTC.5</td></tr>
|
||||
* <tr><td>LEDS_LED3</td><td>Red</td><td>Bicolor Indicator 2</td><td>High</td><td>PORTC.6</td></tr>
|
||||
* <tr><td>LEDS_LED4</td><td>Green</td><td>Bicolor Indicator 2</td><td>High</td><td>PORTC.7</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef __LEDS_DUCE_H__
|
||||
#define __LEDS_DUCE_H__
|
||||
|
||||
/* Includes: */
|
||||
#include "../../../../Common/Common.h"
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_LEDS_H)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** LED mask for the first LED on the board. */
|
||||
#define LEDS_LED1 (1 << 4)
|
||||
|
||||
/** LED mask for the second LED on the board. */
|
||||
#define LEDS_LED2 (1 << 5)
|
||||
|
||||
/** LED mask for the third LED on the board. */
|
||||
#define LEDS_LED3 (1 << 6)
|
||||
|
||||
/** LED mask for the fourth LED on the board. */
|
||||
#define LEDS_LED4 (1 << 7)
|
||||
|
||||
/** LED mask for all the LEDs on the board. */
|
||||
#define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4)
|
||||
|
||||
/** LED mask for none of the board LEDs. */
|
||||
#define LEDS_NO_LEDS 0
|
||||
|
||||
/* Inline Functions: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
static inline void LEDs_Init(void)
|
||||
{
|
||||
DDRC |= LEDS_ALL_LEDS;
|
||||
PORTC &= ~LEDS_ALL_LEDS;
|
||||
}
|
||||
|
||||
static inline void LEDs_Disable(void)
|
||||
{
|
||||
DDRC &= ~LEDS_ALL_LEDS;
|
||||
PORTC &= ~LEDS_ALL_LEDS;
|
||||
}
|
||||
|
||||
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTC |= LEDMask;
|
||||
}
|
||||
|
||||
static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTC &= ~LEDMask;
|
||||
}
|
||||
|
||||
static inline void LEDs_SetAllLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTC = ((PORTC & ~LEDS_ALL_LEDS) | LEDMask);
|
||||
}
|
||||
|
||||
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
|
||||
const uint8_t ActiveMask)
|
||||
{
|
||||
PORTC = ((PORTC & ~LEDMask) | ActiveMask);
|
||||
}
|
||||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PINC = LEDMask;
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint8_t LEDs_GetLEDs(void)
|
||||
{
|
||||
return (PORTC & LEDS_ALL_LEDS);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific Buttons driver header for the Atmel EVK527.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTE.2</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific Dataflash driver header for the Atmel EVK527.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Select Pin</th><th>SPI Port</th></tr>
|
||||
* <tr><td>DATAFLASH_CHIP1</td><td>AT45DB321C (4MB)</td><td>PORTE.6</td><td>SPI0</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific joystick driver header for the Atmel EVK527.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Left Port Pin</th><th>Up Port Pin</th><th>Right Port Pin</th><th>Down Port Pin</th><th>Press Port Pin</th></tr>
|
||||
* <tr><td>PORTF.4</td><td>PORTF.5</td><td>PORTF.7</td><td>PORTC.6</td><td>PORTF.6</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,13 @@
|
|||
*
|
||||
* Board specific LED driver header for the Atmel EVK527.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.5</td></tr>
|
||||
* <tr><td>LEDS_LED2</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.6</td></tr>
|
||||
* <tr><td>LEDS_LED3</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.7</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -115,7 +122,7 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTD ^= LEDMask;
|
||||
PIND = LEDMask;
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific Buttons driver header for the Mattairtech JM-DB-U2 (http://u2.mattair.net/index.html).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific LED driver header for the Mattairtech JM-DB-U2 (http://u2.mattair.net/index.html).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.4</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -109,7 +114,7 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTD ^= LEDMask;
|
||||
PIND = LEDMask;
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -42,6 +42,12 @@
|
|||
*
|
||||
* Board specific LED driver header for the Maximus (http://www.avrusb.com/).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>LG</td><td>High</td><td>PORTB.6</td></tr>
|
||||
* <tr><td>LEDS_LED2</td><td>Red</td><td>LR</td><td>High</td><td>PORTB.7</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -112,7 +118,7 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTB ^= LEDMask;
|
||||
PINB = LEDMask;
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -100,6 +100,18 @@
|
|||
*
|
||||
* Board specific Buttons driver header for the Micropendous 32U2 (https://code.google.com/p/micropendous/wiki/Micropendous_32U2).
|
||||
*
|
||||
* <b>BOARD_MICROPENDOUS_1 and BOARD_MICROPENDOUS_32U2</b>:
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* <b>Other Revisions</b>:
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTE.2</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -56,6 +56,18 @@
|
|||
*
|
||||
* Board specific LED driver header for the Micropendous 32U2 (https://code.google.com/p/micropendous/wiki/Micropendous_32U2).
|
||||
*
|
||||
* <b>BOARD_MICROPENDOUS_32U2</b>:
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.6</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* <b>Other Revisions</b>:
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTB.1</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -92,6 +104,7 @@
|
|||
#define _BOARD_LED_CONCAT(Reg, Letter) _BOARD_LED_CONCAT2(Reg, Letter)
|
||||
|
||||
#define _BOARD_LED_PORT _BOARD_LED_CONCAT(PORT, _BOARD_LED_PORTLETTER)
|
||||
#define _BOARD_LED_PIN _BOARD_LED_CONCAT(PIN, _BOARD_LED_PORTLETTER)
|
||||
#define _BOARD_LED_DDR _BOARD_LED_CONCAT(DDR, _BOARD_LED_PORTLETTER)
|
||||
#endif
|
||||
|
||||
|
@ -143,7 +156,7 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
_BOARD_LED_PORT ^= LEDMask;
|
||||
_BOARD_LED_PIN = LEDMask;
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific Buttons driver header for the Microsin AVR-USB162 board (http://microsin.ru/content/view/685/44/).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific LED driver header for the Microsin AVR-USB162 board (http://microsin.ru/content/view/685/44/).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>Low</td><td>PORTD.4</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -109,7 +114,7 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTD ^= LEDMask;
|
||||
PIND = LEDMask;
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific Buttons driver header for the MINIMUS.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,13 @@
|
|||
*
|
||||
* Board specific LED driver header for the Minimus USB (http://www.minimususb.com/).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Red</td><td>General Indicator</td><td>Low</td><td>PORTD.5</td></tr>
|
||||
* <tr><td>LEDS_LED2</td><td>Green</td><td>General Indicator</td><td>Low</td><td>PORTD.6</td></tr>
|
||||
* <tr><td>LEDS_LED3</td><td>Blue</td><td>General Indicator</td><td>Low</td><td>PORTD.7</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -69,11 +76,14 @@
|
|||
/** LED mask for the second LED on the board. */
|
||||
#define LEDS_LED2 (1 << 6)
|
||||
|
||||
/** LED mask for the third LED on the board. */
|
||||
#define LEDS_LED3 (1 << 7)
|
||||
|
||||
/** LED mask for all the LEDs on the board. */
|
||||
#define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2)
|
||||
#define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3)
|
||||
|
||||
/** LED mask for the none of the board LEDs. */
|
||||
#define LEDS_NO_LEDS 1
|
||||
#define LEDS_NO_LEDS 0
|
||||
|
||||
/* Inline Functions: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
|
@ -112,7 +122,7 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTD ^= LEDMask;
|
||||
PIND = LEDMask;
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -42,6 +42,13 @@
|
|||
*
|
||||
* Board specific LED driver header for the Bitwizard Multio (http://www.bitwizard.nl/wiki/index.php/USB-multio).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.0</td></tr>
|
||||
* <tr><td>LEDS_LED2</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTC.2</td></tr>
|
||||
* <tr><td>LEDS_LED3</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.7</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -132,8 +139,8 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTD ^= (LEDMask & LEDS_PORTD_LEDS);
|
||||
PORTC ^= (LEDMask & LEDS_PORTC_LEDS);
|
||||
PIND = (LEDMask & LEDS_PORTD_LEDS);
|
||||
PINC = (LEDMask & LEDS_PORTC_LEDS);
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific Buttons driver header for the Olimex AVR-USB-162 Development Board (http://www.olimex.com/dev/avr-usb-162.html).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific LED driver header for the Olimex AVR-USB-162 (http://www.olimex.com/dev/avr-usb-162.html).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Yellow</td><td>General Indicator</td><td>High</td><td>PORTD.4</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -109,7 +114,7 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTD ^= LEDMask;
|
||||
PIND = LEDMask;
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
103
LUFA/Drivers/Board/AVR8/OLIMEX32U4/Buttons.h
Normal file
103
LUFA/Drivers/Board/AVR8/OLIMEX32U4/Buttons.h
Normal file
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Board specific Buttons driver header for the Olimex AVR-USB-32U4 Development Board.
|
||||
* \copydetails Group_Buttons_OLIMEX32U4
|
||||
*
|
||||
* \note This file should not be included directly. It is automatically included as needed by the Buttons driver
|
||||
* dispatch header located in LUFA/Drivers/Board/Buttons.h.
|
||||
*/
|
||||
|
||||
/** \ingroup Group_Buttons
|
||||
* \defgroup Group_Buttons_OLIMEX32U4 OLIMEX32U4
|
||||
* \brief Board specific Buttons driver header for the Olimex AVR-USB-32U4 Development Board.
|
||||
*
|
||||
* Board specific Buttons driver header for the Olimex AVR-USB-32U4 Development Board (http://www.olimex.com/dev/olimexino-32u4.html).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTE.2</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef __BUTTONS_OLIMEX32U4_H__
|
||||
#define __BUTTONS_OLIMEX32U4_H__
|
||||
|
||||
/* Includes: */
|
||||
#include "../../../../Common/Common.h"
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_BUTTONS_H)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Button mask for the first button on the board. */
|
||||
#define BUTTONS_BUTTON1 (1 << 2)
|
||||
|
||||
/* Inline Functions: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
static inline void Buttons_Init(void)
|
||||
{
|
||||
DDRE &= ~BUTTONS_BUTTON1;
|
||||
PORTE |= BUTTONS_BUTTON1;
|
||||
}
|
||||
|
||||
static inline void Buttons_Disable(void)
|
||||
{
|
||||
DDRE &= ~BUTTONS_BUTTON1;
|
||||
PORTE &= ~BUTTONS_BUTTON1;
|
||||
}
|
||||
|
||||
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint8_t Buttons_GetStatus(void)
|
||||
{
|
||||
return ((PINE & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
179
LUFA/Drivers/Board/AVR8/OLIMEX32U4/LEDs.h
Normal file
179
LUFA/Drivers/Board/AVR8/OLIMEX32U4/LEDs.h
Normal file
|
@ -0,0 +1,179 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Board specific LED driver header for the Olimex AVR-USB-32U4.
|
||||
* \copydetails Group_LEDs_OLIMEX32U4
|
||||
*
|
||||
* \note This file should not be included directly. It is automatically included as needed by the LEDs driver
|
||||
* dispatch header located in LUFA/Drivers/Board/LEDs.h.
|
||||
*/
|
||||
|
||||
/** \ingroup Group_LEDs
|
||||
* \defgroup Group_LEDs_OLIMEX32U4 OLIMEX32U4
|
||||
* \brief Board specific LED driver header for the Olimex AVR-USB-32U4.
|
||||
*
|
||||
* Board specific LED driver header for the Olimex AVR-USB-32U4 (http://www.olimex.com/dev/olimexino-32u4.html).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>TX</td><td>High</td><td>PORTD.5</td></tr>
|
||||
* <tr><td>LEDS_LED2</td><td>Yellow</td><td>RX</td><td>High</td><td>PORTB.0</td></tr>
|
||||
* <tr><td>LEDS_LED3</td><td>Green</td><td>General Indicator (Default Unconnected)</td><td>High</td><td>PORTE.6</td></tr>
|
||||
* <tr><td>LEDS_LED4</td><td>Yellow</td><td>General Indicator (Default Unconnected)</td><td>High</td><td>PORTB.5</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef __LEDS_OLIMEX32U4_H__
|
||||
#define __LEDS_OLIMEX32U4_H__
|
||||
|
||||
/* Includes: */
|
||||
#include "../../../../Common/Common.h"
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_LEDS_H)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead.
|
||||
#endif
|
||||
|
||||
/* Private Interface - For use in library only: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
/* Macros: */
|
||||
#define LEDS_PORTB_LEDS (LEDS_LED2 | LEDS_LED4)
|
||||
#define LEDS_PORTD_LEDS (LEDS_LED1)
|
||||
#define LEDS_PORTE_LEDS (LEDS_LED3)
|
||||
|
||||
#define LEDS_PORTD_MASK_SHIFT 1
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** LED mask for the first LED on the board. */
|
||||
#define LEDS_LED1 ((1 << 5) >> LEDS_PORTD_MASK_SHIFT)
|
||||
|
||||
/** LED mask for the second LED on the board. */
|
||||
#define LEDS_LED2 (1 << 0)
|
||||
|
||||
/** LED mask for the third LED on the board. */
|
||||
#define LEDS_LED3 (1 << 5)
|
||||
|
||||
/** LED mask for the fourth LED on the board. */
|
||||
#define LEDS_LED4 (1 << 6)
|
||||
|
||||
/** LED mask for all the LEDs on the board. */
|
||||
#define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4)
|
||||
|
||||
/** LED mask for none of the board LEDs. */
|
||||
#define LEDS_NO_LEDS 0
|
||||
|
||||
/* Inline Functions: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
static inline void LEDs_Init(void)
|
||||
{
|
||||
DDRB |= LEDS_PORTB_LEDS;
|
||||
PORTB &= ~LEDS_PORTB_LEDS;
|
||||
DDRD |= (LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT);
|
||||
PORTD &= ~(LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT);
|
||||
DDRE |= LEDS_PORTE_LEDS;
|
||||
PORTE &= ~LEDS_PORTE_LEDS;
|
||||
}
|
||||
|
||||
static inline void LEDs_Disable(void)
|
||||
{
|
||||
DDRB &= LEDS_PORTB_LEDS;
|
||||
PORTB &= ~LEDS_PORTB_LEDS;
|
||||
DDRD &= (LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT);
|
||||
PORTD &= ~(LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT);
|
||||
DDRE &= LEDS_PORTE_LEDS;
|
||||
PORTE &= ~LEDS_PORTE_LEDS;
|
||||
}
|
||||
|
||||
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTB |= (LEDMask & LEDS_PORTB_LEDS);
|
||||
PORTD |= ((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT);
|
||||
PORTE |= (LEDMask & LEDS_PORTE_LEDS);
|
||||
}
|
||||
|
||||
static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTB &= ~(LEDMask & LEDS_PORTB_LEDS);
|
||||
PORTD &= ~((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT);
|
||||
PORTE &= ~(LEDMask & LEDS_PORTE_LEDS);
|
||||
}
|
||||
|
||||
static inline void LEDs_SetAllLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTB = ((PORTB & ~LEDS_PORTB_LEDS) | (LEDMask & LEDS_PORTB_LEDS));
|
||||
PORTD = ((PORTD & ~(LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT)) |
|
||||
((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT));
|
||||
PORTE = ((PORTE & ~LEDS_PORTE_LEDS) | (LEDMask & LEDS_PORTE_LEDS));
|
||||
}
|
||||
|
||||
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
|
||||
const uint8_t ActiveMask)
|
||||
{
|
||||
PORTB = ((PORTB & ~(LEDMask & LEDS_PORTB_LEDS)) | (ActiveMask & LEDS_PORTB_LEDS));
|
||||
PORTD = ((PORTD & ~((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT)) |
|
||||
((ActiveMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT));
|
||||
PORTE = ((PORTE & ~(LEDMask & LEDS_PORTE_LEDS)) | (ActiveMask & LEDS_PORTE_LEDS));
|
||||
}
|
||||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PINB = (LEDMask & LEDS_PORTB_LEDS);
|
||||
PIND = ((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT);
|
||||
PINE = (LEDMask & LEDS_PORTE_LEDS);
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint8_t LEDs_GetLEDs(void)
|
||||
{
|
||||
return ((PORTB & LEDS_PORTB_LEDS) |
|
||||
((PORTD & (LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT)) >> LEDS_PORTD_MASK_SHIFT) |
|
||||
(PORTE & LEDS_PORTE_LEDS));
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
103
LUFA/Drivers/Board/AVR8/OLIMEXT32U4/Buttons.h
Normal file
103
LUFA/Drivers/Board/AVR8/OLIMEXT32U4/Buttons.h
Normal file
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Board specific Buttons driver header for the Olimex AVR-USB-T32U4 Development Board.
|
||||
* \copydetails Group_Buttons_OLIMEXT32U4
|
||||
*
|
||||
* \note This file should not be included directly. It is automatically included as needed by the Buttons driver
|
||||
* dispatch header located in LUFA/Drivers/Board/Buttons.h.
|
||||
*/
|
||||
|
||||
/** \ingroup Group_Buttons
|
||||
* \defgroup Group_Buttons_OLIMEXT32U4 OLIMEXT32U4
|
||||
* \brief Board specific Buttons driver header for the Olimex AVR-USB-32U4 Development Board.
|
||||
*
|
||||
* Board specific Buttons driver header for the Olimex AVR-USB-T32U4 Development Board (http://www.olimex.com/dev/avr-t32u4.html).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTE.2</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef __BUTTONS_OLIMEXT32U4_H__
|
||||
#define __BUTTONS_OLIMEXT32U4_H__
|
||||
|
||||
/* Includes: */
|
||||
#include "../../../../Common/Common.h"
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_BUTTONS_H)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Button mask for the first button on the board. */
|
||||
#define BUTTONS_BUTTON1 (1 << 2)
|
||||
|
||||
/* Inline Functions: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
static inline void Buttons_Init(void)
|
||||
{
|
||||
DDRE &= ~BUTTONS_BUTTON1;
|
||||
PORTE |= BUTTONS_BUTTON1;
|
||||
}
|
||||
|
||||
static inline void Buttons_Disable(void)
|
||||
{
|
||||
DDRE &= ~BUTTONS_BUTTON1;
|
||||
PORTE &= ~BUTTONS_BUTTON1;
|
||||
}
|
||||
|
||||
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint8_t Buttons_GetStatus(void)
|
||||
{
|
||||
return ((PINE & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
169
LUFA/Drivers/Board/AVR8/OLIMEXT32U4/LEDs.h
Normal file
169
LUFA/Drivers/Board/AVR8/OLIMEXT32U4/LEDs.h
Normal file
|
@ -0,0 +1,169 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Board specific LED driver header for the Olimex AVR-USB-T32U4.
|
||||
* \copydetails Group_LEDs_OLIMEXT32U4
|
||||
*
|
||||
* \note This file should not be included directly. It is automatically included as needed by the LEDs driver
|
||||
* dispatch header located in LUFA/Drivers/Board/LEDs.h.
|
||||
*/
|
||||
|
||||
/** \ingroup Group_LEDs
|
||||
* \defgroup Group_LEDs_OLIMEXT32U4 OLIMEXT32U4
|
||||
* \brief Board specific LED driver header for the Olimex AVR-USB-T32U4.
|
||||
*
|
||||
* Board specific LED driver header for the Olimex AVR-USB-T32U4 (http://www.olimex.com/dev/avr-t32u4.html).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>TX</td><td>High</td><td>PORTD.5</td></tr>
|
||||
* <tr><td>LEDS_LED2</td><td>Yellow</td><td>RX</td><td>High</td><td>PORTB.0</td></tr>
|
||||
* <tr><td>LEDS_LED3</td><td>N/A</td><td>General Indicator (Not Mounted)</td><td>High</td><td>PORTE.6</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef __LEDS_OLIMEXT32U4_H__
|
||||
#define __LEDS_OLIMEXT32U4_H__
|
||||
|
||||
/* Includes: */
|
||||
#include "../../../../Common/Common.h"
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_LEDS_H)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead.
|
||||
#endif
|
||||
|
||||
/* Private Interface - For use in library only: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
/* Macros: */
|
||||
#define LEDS_PORTB_LEDS (LEDS_LED2)
|
||||
#define LEDS_PORTD_LEDS (LEDS_LED1)
|
||||
#define LEDS_PORTE_LEDS (LEDS_LED3)
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** LED mask for the first LED on the board. */
|
||||
#define LEDS_LED1 (1 << 5)
|
||||
|
||||
/** LED mask for the second LED on the board. */
|
||||
#define LEDS_LED2 (1 << 0)
|
||||
|
||||
/** LED mask for the third LED on the board. */
|
||||
#define LEDS_LED3 (1 << 6)
|
||||
|
||||
/** LED mask for all the LEDs on the board. */
|
||||
#define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3)
|
||||
|
||||
/** LED mask for none of the board LEDs. */
|
||||
#define LEDS_NO_LEDS 0
|
||||
|
||||
/* Inline Functions: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
static inline void LEDs_Init(void)
|
||||
{
|
||||
DDRB |= LEDS_PORTB_LEDS;
|
||||
PORTB &= ~LEDS_PORTB_LEDS;
|
||||
DDRD |= LEDS_PORTD_LEDS;
|
||||
PORTD &= ~LEDS_PORTD_LEDS;
|
||||
DDRE |= LEDS_PORTE_LEDS;
|
||||
PORTE &= ~LEDS_PORTE_LEDS;
|
||||
}
|
||||
|
||||
static inline void LEDs_Disable(void)
|
||||
{
|
||||
DDRB &= LEDS_PORTB_LEDS;
|
||||
PORTB &= ~LEDS_PORTB_LEDS;
|
||||
DDRD &= LEDS_PORTD_LEDS;
|
||||
PORTD &= ~LEDS_PORTD_LEDS;
|
||||
DDRE &= LEDS_PORTE_LEDS;
|
||||
PORTE &= ~LEDS_PORTE_LEDS;
|
||||
}
|
||||
|
||||
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTB |= (LEDMask & LEDS_PORTB_LEDS);
|
||||
PORTD |= (LEDMask & LEDS_PORTD_LEDS);
|
||||
PORTE |= (LEDMask & LEDS_PORTE_LEDS);
|
||||
}
|
||||
|
||||
static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTB &= ~(LEDMask & LEDS_PORTB_LEDS);
|
||||
PORTD &= ~(LEDMask & LEDS_PORTD_LEDS);
|
||||
PORTE &= ~(LEDMask & LEDS_PORTE_LEDS);
|
||||
}
|
||||
|
||||
static inline void LEDs_SetAllLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTB = ((PORTB & ~LEDS_PORTB_LEDS) | (LEDMask & LEDS_PORTB_LEDS));
|
||||
PORTD = ((PORTD & ~LEDS_PORTD_LEDS) | (LEDMask & LEDS_PORTD_LEDS));
|
||||
PORTE = ((PORTE & ~LEDS_PORTE_LEDS) | (LEDMask & LEDS_PORTE_LEDS));
|
||||
}
|
||||
|
||||
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
|
||||
const uint8_t ActiveMask)
|
||||
{
|
||||
PORTB = ((PORTB & ~(LEDMask & LEDS_PORTB_LEDS)) | (ActiveMask & LEDS_PORTB_LEDS));
|
||||
PORTD = ((PORTD & ~(LEDMask & LEDS_PORTD_LEDS)) | (ActiveMask & LEDS_PORTD_LEDS));
|
||||
PORTE = ((PORTE & ~(LEDMask & LEDS_PORTE_LEDS)) | (ActiveMask & LEDS_PORTE_LEDS));
|
||||
}
|
||||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PINB = (LEDMask & LEDS_PORTB_LEDS);
|
||||
PIND = (LEDMask & LEDS_PORTD_LEDS);
|
||||
PINE = (LEDMask & LEDS_PORTE_LEDS);
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint8_t LEDs_GetLEDs(void)
|
||||
{
|
||||
return ((PORTB & LEDS_PORTB_LEDS) | (PORTD & LEDS_PORTD_LEDS) | (PORTE & LEDS_PORTE_LEDS));
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
|
@ -42,6 +42,14 @@
|
|||
*
|
||||
* Board specific LED driver header for the Atmel RZUSBSTICK.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Blue</td><td>General Indicator</td><td>High</td><td>PORTD.7</td></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Red</td><td>General Indicator</td><td>Low</td><td>PORTD.5</td></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>Low</td><td>PORTE.6</td></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Yellow</td><td>General Indicator</td><td>Low</td><td>PORTE.7</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -144,8 +152,8 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTD ^= (LEDMask & LEDS_PORTD_LEDS);
|
||||
PORTE ^= ((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT);
|
||||
PIND = (LEDMask & LEDS_PORTD_LEDS);
|
||||
PINE = ((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT);
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific LED driver header for the Sparkfun ATMEGA8U2 breakout board (http://www.sparkfun.com/products/10277).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>Low</td><td>PORTB.4</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -109,7 +114,7 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTB ^= LEDMask;
|
||||
PINB = LEDMask;
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific Buttons driver header for the Atmel STK525.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTE.2</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific Dataflash driver header for the Atmel STK525.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Select Pin</th><th>SPI Port</th></tr>
|
||||
* <tr><td>DATAFLASH_CHIP1</td><td>AT45DB321C (4MB)</td><td>PORTB.4</td><td>SPI0</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific joystick driver header for the Atmel STK525.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Left Port Pin</th><th>Up Port Pin</th><th>Right Port Pin</th><th>Down Port Pin</th><th>Press Port Pin</th></tr>
|
||||
* <tr><td>PORTB.6</td><td>PORTB.7</td><td>PORTE.4</td><td>PORTE.5</td><td>PORTB.5</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -76,7 +81,7 @@
|
|||
#define JOY_LEFT (1 << 6)
|
||||
|
||||
/** Mask for the joystick being pushed in the right direction. */
|
||||
#define JOY_RIGHT ((1 << 4) >> 1)
|
||||
#define JOY_RIGHT ((1 << 4) >> JOY_PORTE_MASK_SHIFT)
|
||||
|
||||
/** Mask for the joystick being pushed in the upward direction. */
|
||||
#define JOY_UP (1 << 7)
|
||||
|
|
|
@ -42,6 +42,14 @@
|
|||
*
|
||||
* Board specific LED driver header for the Atmel STK525.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.4</td></tr>
|
||||
* <tr><td>LEDS_LED2</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.5</td></tr>
|
||||
* <tr><td>LEDS_LED3</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.6</td></tr>
|
||||
* <tr><td>LEDS_LED4</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.7</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -118,7 +126,7 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTD ^= LEDMask;
|
||||
PIND = LEDMask;
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific Buttons driver header for the Atmel STK526.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific Dataflash driver header for the Atmel STK525.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Select Pin</th><th>SPI Port</th></tr>
|
||||
* <tr><td>DATAFLASH_CHIP1</td><td>AT45DB642D (8MB)</td><td>PORTC.2</td><td>SPI0</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific joystick driver header for the Atmel STK526.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Left Port Pin</th><th>Up Port Pin</th><th>Right Port Pin</th><th>Down Port Pin</th><th>Press Port Pin</th></tr>
|
||||
* <tr><td>PORTB.4</td><td>PORTB.5</td><td>PORTB.6</td><td>PORTB.7</td><td>PORTB.0</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,14 @@
|
|||
*
|
||||
* Board specific LED driver header for the Atmel STK526.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.1</td></tr>
|
||||
* <tr><td>LEDS_LED2</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.0</td></tr>
|
||||
* <tr><td>LEDS_LED3</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.5</td></tr>
|
||||
* <tr><td>LEDS_LED4</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.4</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -118,7 +126,7 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTD ^= LEDMask;
|
||||
PIND = LEDMask;
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -51,6 +51,18 @@
|
|||
*
|
||||
* Board specific LED driver header for the PJRC Teensy boards (http://www.pjrc.com/teensy/index.html).
|
||||
*
|
||||
* <b>TEENSY</b>:
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.6</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* <b>TEENSY2</b>:
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>Low</td><td>PORTD.6</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -139,7 +151,7 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTD ^= LEDMask;
|
||||
PIND = LEDMask;
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific Buttons driver header for the Busware TUL (http://www.busware.de/tiki-index.php?page=TUL).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTE.2</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific LED driver header for the Busware TUL (http://www.busware.de/tiki-index.php?page=TUL).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTF.0</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -109,7 +114,7 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTF ^= LEDMask;
|
||||
PINF = LEDMask;
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific Buttons driver header for the Linnix UDIP (http://linnix.com/udip/).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,14 @@
|
|||
*
|
||||
* Board specific LED driver header for the Linnix UDIP (http://linnix.com/udip/).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>Bicolor Indicator 1</td><td>High</td><td>PORTB.6</td></tr>
|
||||
* <tr><td>LEDS_LED2</td><td>Red</td><td>Bicolor Indicator 1</td><td>High</td><td>PORTB.5</td></tr>
|
||||
* <tr><td>LEDS_LED3</td><td>Green</td><td>Bicolor Indicator 2</td><td>High</td><td>PORTD.5</td></tr>
|
||||
* <tr><td>LEDS_LED4</td><td>Red</td><td>Bicolor Indicator 2</td><td>High</td><td>PORTD.4</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -133,8 +141,8 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTB ^= (LEDMask & LEDS_PORTB_LEDS);
|
||||
PORTD ^= ((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT);
|
||||
PINB = (LEDMask & LEDS_PORTB_LEDS);
|
||||
PIND = ((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT);
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -42,6 +42,12 @@
|
|||
*
|
||||
* Board specific LED driver header for the Arduino Uno (http://arduino.cc/en/Main/ArduinoBoardUno).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Yellow</td><td>RX</td><td>Low</td><td>PORTD.4</td></tr>
|
||||
* <tr><td>LEDS_LED2</td><td>Yellow</td><td>TX</td><td>Low</td><td>PORTD.5</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -112,7 +118,7 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTD ^= LEDMask;
|
||||
PIND = LEDMask;
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -51,6 +51,11 @@
|
|||
*
|
||||
* Board specific Buttons driver header for the Paranoid Studio USB2AX (http://paranoidstudio.assembla.com/wiki/show/paranoidstudio/USB2AX).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -51,6 +51,18 @@
|
|||
*
|
||||
* Board specific LED driver header for the Paranoid Studio USB2AX (http://paranoidstudio.assembla.com/wiki/show/paranoidstudio/USB2AX).
|
||||
*
|
||||
* <b>USB2AX</b>:
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTC.6</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* <b>USB2AX_V3</b>:
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>High</td><td>PORTD.1</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -96,11 +108,11 @@
|
|||
static inline void LEDs_Init(void)
|
||||
{
|
||||
#if (BOARD == BOARD_USB2AX)
|
||||
DDRC |= LEDS_ALL_LEDS;
|
||||
PORTC |= LEDS_ALL_LEDS;
|
||||
DDRC |= LEDS_ALL_LEDS;
|
||||
PORTC &= ~LEDS_ALL_LEDS;
|
||||
#else
|
||||
DDRD |= LEDS_ALL_LEDS;
|
||||
PORTD |= LEDS_ALL_LEDS;
|
||||
DDRD |= LEDS_ALL_LEDS;
|
||||
PORTD &= ~LEDS_ALL_LEDS;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -118,27 +130,27 @@
|
|||
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
#if (BOARD == BOARD_USB2AX)
|
||||
PORTC &= ~LEDMask;
|
||||
PORTC |= LEDMask;
|
||||
#else
|
||||
PORTD &= ~LEDMask;
|
||||
PORTD |= LEDMask;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
#if (BOARD == BOARD_USB2AX)
|
||||
PORTC |= LEDMask;
|
||||
PORTC &= ~LEDMask;
|
||||
#else
|
||||
PORTD |= LEDMask;
|
||||
PORTD &= ~LEDMask;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void LEDs_SetAllLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
#if (BOARD == BOARD_USB2AX)
|
||||
PORTC = ((PORTC | LEDS_ALL_LEDS) & ~LEDMask);
|
||||
PORTC = ((PORTC & ~LEDS_ALL_LEDS) | LEDMask);
|
||||
#else
|
||||
PORTD = ((PORTD | LEDS_ALL_LEDS) & ~LEDMask);
|
||||
PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -146,18 +158,18 @@
|
|||
const uint8_t ActiveMask)
|
||||
{
|
||||
#if (BOARD == BOARD_USB2AX)
|
||||
PORTC = ((PORTC | LEDMask) & ~ActiveMask);
|
||||
PORTC = ((PORTC & ~LEDMask) | ActiveMask);
|
||||
#else
|
||||
PORTD = ((PORTD | LEDMask) & ~ActiveMask);
|
||||
PORTD = ((PORTD & ~LEDMask) | ActiveMask);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
#if (BOARD == BOARD_USB2AX)
|
||||
PORTC ^= LEDMask;
|
||||
PINC = LEDMask;
|
||||
#else
|
||||
PORTD ^= LEDMask;
|
||||
PIND = LEDMask;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -165,9 +177,9 @@
|
|||
static inline uint8_t LEDs_GetLEDs(void)
|
||||
{
|
||||
#if (BOARD == BOARD_USB2AX)
|
||||
return (~PORTC & LEDS_ALL_LEDS);
|
||||
return (PORTC & LEDS_ALL_LEDS);
|
||||
#else
|
||||
return (~PORTD & LEDS_ALL_LEDS);
|
||||
return (PORTD & LEDS_ALL_LEDS);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific Buttons driver header for the Kernel Concepts USBFOO (http://shop.kernelconcepts.de/product_info.php?products_id=102).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific LED driver header for the Kernel Concepts USBFOO (http://shop.kernelconcepts.de/product_info.php?products_id=102).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>Low</td><td>PORTD.4</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -109,7 +114,7 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTD ^= LEDMask;
|
||||
PIND = LEDMask;
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific Buttons driver header for the Atmel USBKEY.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTE.2</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,12 @@
|
|||
*
|
||||
* Board specific Dataflash driver header for the Atmel USBKEY board.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Select Pin</th><th>SPI Port</th></tr>
|
||||
* <tr><td>DATAFLASH_CHIP1</td><td>AT45DB642D (8MB)</td><td>PORTE.0</td><td>SPI0</td></tr>
|
||||
* <tr><td>DATAFLASH_CHIP2</td><td>AT45DB642D (8MB)</td><td>PORTE.1</td><td>SPI0</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific joystick driver header for the Atmel USBKEY.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Left Port Pin</th><th>Up Port Pin</th><th>Right Port Pin</th><th>Down Port Pin</th><th>Press Port Pin</th></tr>
|
||||
* <tr><td>PORTB.6</td><td>PORTB.7</td><td>PORTE.4</td><td>PORTE.5</td><td>PORTB.5</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,14 @@
|
|||
*
|
||||
* Board specific LED driver header for the Atmel USBKEY.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Red</td><td>Bicolor Indicator 1</td><td>Low</td><td>PORTD.4</td></tr>
|
||||
* <tr><td>LEDS_LED2</td><td>Green</td><td>Bicolor Indicator 1</td><td>Low</td><td>PORTD.5</td></tr>
|
||||
* <tr><td>LEDS_LED3</td><td>Red</td><td>Bicolor Indicator 2</td><td>Low</td><td>PORTD.6</td></tr>
|
||||
* <tr><td>LEDS_LED4</td><td>Green</td><td>Bicolor Indicator 2</td><td>Low</td><td>PORTD.7</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -118,7 +126,7 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTD ^= LEDMask;
|
||||
PIND = LEDMask;
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific Buttons driver header for Tom's USBTINY MKII (http://tom-itx.dyndns.org:81/~webpage/).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>HWB Button</td><td>Low</td><td>PORTD.7</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,13 @@
|
|||
*
|
||||
* Board specific LED driver header for Tom's USBTINY MKII (http://tom-itx.dyndns.org:81/~webpage/).
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Red</td><td>Bicolor Indicator 1</td><td>High</td><td>PORTB.6</td></tr>
|
||||
* <tr><td>LEDS_LED2</td><td>Green</td><td>Bicolor Indicator 1</td><td>High</td><td>PORTB.7</td></tr>
|
||||
* <tr><td>LEDS_LED3</td><td>Red</td><td>Target Power</td><td>High</td><td>PORTB.5</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -115,7 +122,7 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTB ^= LEDMask;
|
||||
PINB = LEDMask;
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -51,6 +51,18 @@
|
|||
*
|
||||
* Board specific Dataflash driver header for the Atmel XPLAIN.
|
||||
*
|
||||
* <b>Revision 1 Boards</b>:
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Select Pin</th><th>SPI Port</th></tr>
|
||||
* <tr><td>DATAFLASH_CHIP1</td><td>AT45DB041D (512KB)</td><td>PORTB.5</td><td>SPI0</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* <b>Other Board Revisions</b>:
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Select Pin</th><th>SPI Port</th></tr>
|
||||
* <tr><td>DATAFLASH_CHIP1</td><td>AT45DB642D (8MB)</td><td>PORTB.5</td><td>SPI0</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -59,6 +71,7 @@
|
|||
|
||||
/* Includes: */
|
||||
#include "../../../../Common/Common.h"
|
||||
|
||||
#include "../../../Misc/AT45DB642D.h"
|
||||
#include "../../../Peripheral/SPI.h"
|
||||
|
||||
|
|
|
@ -49,6 +49,11 @@
|
|||
*
|
||||
* Board specific LED driver header for the Atmel XPLAIN.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>Low</td><td>PORTB.6</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -116,7 +121,7 @@
|
|||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
PORTB ^= LEDMask;
|
||||
PINB = LEDMask;
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -143,6 +143,10 @@
|
|||
#include "AVR8/MICROPENDOUS/Buttons.h"
|
||||
#elif (BOARD == BOARD_B1_XPLAINED)
|
||||
#include "XMEGA/B1_XPLAINED/Buttons.h"
|
||||
#elif (BOARD == BOARD_OLIMEX32U4)
|
||||
#include "AVR8/OLIMEX32U4/Buttons.h"
|
||||
#elif (BOARD == BOARD_OLIMEXT32U4)
|
||||
#include "AVR8/OLIMEXT32U4/Buttons.h"
|
||||
#else
|
||||
#include "Board/Buttons.h"
|
||||
#endif
|
||||
|
|
|
@ -80,11 +80,11 @@
|
|||
* // Turn on each of the four LEDs in turn
|
||||
* LEDs_SetAllLEDs(LEDS_LED1);
|
||||
* Delay_MS(500);
|
||||
* LEDs_SetAllLEDs(LEDS_LED1);
|
||||
* LEDs_SetAllLEDs(LEDS_LED2);
|
||||
* Delay_MS(500);
|
||||
* LEDs_SetAllLEDs(LEDS_LED1);
|
||||
* LEDs_SetAllLEDs(LEDS_LED3);
|
||||
* Delay_MS(500);
|
||||
* LEDs_SetAllLEDs(LEDS_LED1);
|
||||
* LEDs_SetAllLEDs(LEDS_LED4);
|
||||
* Delay_MS(500);
|
||||
*
|
||||
* // Turn on all LEDs
|
||||
|
@ -185,6 +185,12 @@
|
|||
#include "AVR8/MULTIO/LEDs.h"
|
||||
#elif (BOARD == BOARD_BIGMULTIO)
|
||||
#include "AVR8/BIGMULTIO/LEDs.h"
|
||||
#elif (BOARD == BOARD_DUCE)
|
||||
#include "AVR8/DUCE/LEDs.h"
|
||||
#elif (BOARD == BOARD_OLIMEX32U4)
|
||||
#include "AVR8/OLIMEX32U4/LEDs.h"
|
||||
#elif (BOARD == BOARD_OLIMEXT32U4)
|
||||
#include "AVR8/OLIMEXT32U4/LEDs.h"
|
||||
#else
|
||||
#include "Board/LEDs.h"
|
||||
#endif
|
||||
|
|
|
@ -42,6 +42,13 @@
|
|||
*
|
||||
* Board specific Buttons driver header for the Atmel EVK1100.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>SW0 Button</td><td>Low</td><td>GPIO88</td></tr>
|
||||
* <tr><td>BUTTONS_BUTTON2</td><td>SW1 Button</td><td>Low</td><td>GPIO85</td></tr>
|
||||
* <tr><td>BUTTONS_BUTTON3</td><td>SW2 Button</td><td>Low</td><td>GPIO82</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific joystick driver header for the Atmel EVK1100.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Left Port Pin</th><th>Up Port Pin</th><th>Right Port Pin</th><th>Down Port Pin</th><th>Press Port Pin</th></tr>
|
||||
* <tr><td>GPIO25</td><td>GPIO26</td><td>GPIO28</td><td>GPIO27</td><td>GPIO20</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,18 @@
|
|||
*
|
||||
* Board specific LED driver header for the Atmel EVK1100.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>LED0 LED</td><td>Low</td><td>GPIO51</td></tr>
|
||||
* <tr><td>LEDS_LED2</td><td>Green</td><td>LED1 LED</td><td>Low</td><td>GPIO52</td></tr>
|
||||
* <tr><td>LEDS_LED3</td><td>Green</td><td>LED2 LED</td><td>Low</td><td>GPIO53</td></tr>
|
||||
* <tr><td>LEDS_LED4</td><td>Green</td><td>LED3 LED</td><td>Low</td><td>GPIO54</td></tr>
|
||||
* <tr><td>LEDS_LED5</td><td>Green</td><td>LED4 LED</td><td>Low</td><td>GPIO59</td></tr>
|
||||
* <tr><td>LEDS_LED6</td><td>Green</td><td>LED5 LED</td><td>Low</td><td>GPIO60</td></tr>
|
||||
* <tr><td>LEDS_LED7</td><td>Green</td><td>LED6 LED</td><td>Low</td><td>GPIO61</td></tr>
|
||||
* <tr><td>LEDS_LED8</td><td>Green</td><td>LED7 LED</td><td>Low</td><td>GPIO62</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,12 @@
|
|||
*
|
||||
* Board specific Buttons driver header for the Atmel EVK1101.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>SW0 Button</td><td>Low</td><td>GPIO34</td></tr>
|
||||
* <tr><td>BUTTONS_BUTTON2</td><td>SW1 Button</td><td>Low</td><td>GPIO35</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific joystick driver header for the Atmel EVK1101.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Left Port Pin</th><th>Up Port Pin</th><th>Right Port Pin</th><th>Down Port Pin</th><th>Press Port Pin</th></tr>
|
||||
* <tr><td>GPIO38</td><td>GPIO39</td><td>GPIO41</td><td>GPIO40</td><td>GPIO13</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,14 @@
|
|||
*
|
||||
* Board specific LED driver header for the Atmel EVK1101.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>LED0 LED</td><td>Low</td><td>GPIO7</td></tr>
|
||||
* <tr><td>LEDS_LED2</td><td>Green</td><td>LED1 LED</td><td>Low</td><td>GPIO8</td></tr>
|
||||
* <tr><td>LEDS_LED3</td><td>Green</td><td>LED2 LED</td><td>Low</td><td>GPIO21</td></tr>
|
||||
* <tr><td>LEDS_LED4</td><td>Green</td><td>LED3 LED</td><td>Low</td><td>GPIO22</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific Buttons driver header for the Atmel EVK1104.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>SW0 Button</td><td>Low</td><td>GPIO42</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,14 @@
|
|||
*
|
||||
* Board specific LED driver header for the Atmel EVK1104.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Green</td><td>LED0 LED</td><td>Low</td><td>GPIO67</td></tr>
|
||||
* <tr><td>LEDS_LED2</td><td>Green</td><td>LED1 LED</td><td>Low</td><td>GPIO101</td></tr>
|
||||
* <tr><td>LEDS_LED3</td><td>Green</td><td>LED2 LED</td><td>Low</td><td>GPIO102</td></tr>
|
||||
* <tr><td>LEDS_LED4</td><td>Green</td><td>LED3 LED</td><td>Low</td><td>GPIO105</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,13 @@
|
|||
*
|
||||
* Board specific Buttons driver header for the Atmel XMEGA A3BU Xplained.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>SW0 Button</td><td>Low</td><td>PORTE.5</td></tr>
|
||||
* <tr><td>BUTTONS_BUTTON2</td><td>SW1 Button</td><td>Low</td><td>PORTF.1</td></tr>
|
||||
* <tr><td>BUTTONS_BUTTON3</td><td>SW2 Button</td><td>Low</td><td>PORTF.2</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific Dataflash driver header for the Atmel XMEGA B1 Xplained board.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Select Pin</th><th>SPI Port</th></tr>
|
||||
* <tr><td>DATAFLASH_CHIP1</td><td>AT45DB642D (8MB)</td><td>PORTF.4</td><td>USARTD0 (In SPI Mode)</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -71,10 +76,10 @@
|
|||
#define DATAFLASH_TOTALCHIPS 1
|
||||
|
||||
/** Mask for no dataflash chip selected. */
|
||||
#define DATAFLASH_NO_CHIP DATAFLASH_CHIPCS_MASK
|
||||
#define DATAFLASH_NO_CHIP 0
|
||||
|
||||
/** Mask for the first dataflash chip selected. */
|
||||
#define DATAFLASH_CHIP1 0
|
||||
#define DATAFLASH_CHIP1 (1 << 4)
|
||||
|
||||
/** Internal main memory page size for the board's dataflash ICs. */
|
||||
#define DATAFLASH_PAGE_SIZE 1024
|
||||
|
@ -88,8 +93,10 @@
|
|||
*/
|
||||
static inline void Dataflash_Init(void)
|
||||
{
|
||||
DATAFLASH_CHIPCS_PORT.DIRSET = DATAFLASH_CHIPCS_MASK;
|
||||
DATAFLASH_CHIPCS_PORT.OUTSET = DATAFLASH_CHIPCS_MASK;
|
||||
DATAFLASH_CHIPCS_PORT.DIRSET = DATAFLASH_CHIPCS_MASK;
|
||||
|
||||
PORTCFG.MPCMASK = DATAFLASH_CHIPCS_MASK;
|
||||
DATAFLASH_CHIPCS_PORT.PIN0CTRL = PORT_INVEN_bm;
|
||||
}
|
||||
|
||||
/** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash.
|
||||
|
@ -143,7 +150,8 @@
|
|||
static inline void Dataflash_SelectChip(const uint8_t ChipMask) ATTR_ALWAYS_INLINE;
|
||||
static inline void Dataflash_SelectChip(const uint8_t ChipMask)
|
||||
{
|
||||
DATAFLASH_CHIPCS_PORT.OUT = ((DATAFLASH_CHIPCS_PORT.OUT & ~DATAFLASH_CHIPCS_MASK) | ChipMask);
|
||||
DATAFLASH_CHIPCS_PORT.OUTCLR = DATAFLASH_CHIPCS_MASK;
|
||||
DATAFLASH_CHIPCS_PORT.OUTSET = ChipMask;
|
||||
}
|
||||
|
||||
/** Deselects the current dataflash chip, so that no dataflash is selected. */
|
||||
|
|
|
@ -42,6 +42,12 @@
|
|||
*
|
||||
* Board specific LED driver header for the Atmel XMEGA A3BU Xplained.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Yellow</td><td>LED0 LED</td><td>Low</td><td>PORTR.0</td></tr>
|
||||
* <tr><td>LEDS_LED2</td><td>Yellow</td><td>LED1 LED</td><td>Low</td><td>PORTR.1</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,14 @@
|
|||
*
|
||||
* Board specific Buttons driver header for the Atmel XMEGA B1 Xplained.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>BUTTONS_BUTTON1</td><td>Touch CS0 Button</td><td>Low</td><td>PORTE.0</td></tr>
|
||||
* <tr><td>BUTTONS_BUTTON2</td><td>Touch CS1 Button</td><td>Low</td><td>PORTE.1</td></tr>
|
||||
* <tr><td>BUTTONS_BUTTON3</td><td>Touch CS2 Button</td><td>Low</td><td>PORTE.2</td></tr>
|
||||
* <tr><td>BUTTONS_BUTTON4</td><td>Touch CS3 Button</td><td>Low</td><td>PORTE.3</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
*
|
||||
* Board specific Dataflash driver header for the Atmel XMEGA A3BU Xplained board.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Info</th><th>Select Pin</th><th>SPI Port</th></tr>
|
||||
* <tr><td>DATAFLASH_CHIP1</td><td>AT45DB642D (8MB)</td><td>PORTD.2</td><td>USARTC0 (In SPI Mode, Remapped)</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -71,10 +76,10 @@
|
|||
#define DATAFLASH_TOTALCHIPS 1
|
||||
|
||||
/** Mask for no dataflash chip selected. */
|
||||
#define DATAFLASH_NO_CHIP DATAFLASH_CHIPCS_MASK
|
||||
#define DATAFLASH_NO_CHIP 0
|
||||
|
||||
/** Mask for the first dataflash chip selected. */
|
||||
#define DATAFLASH_CHIP1 0
|
||||
#define DATAFLASH_CHIP1 (1 << 2)
|
||||
|
||||
/** Internal main memory page size for the board's dataflash ICs. */
|
||||
#define DATAFLASH_PAGE_SIZE 1024
|
||||
|
@ -88,10 +93,12 @@
|
|||
*/
|
||||
static inline void Dataflash_Init(void)
|
||||
{
|
||||
DATAFLASH_CHIPCS_PORT.DIRSET = DATAFLASH_CHIPCS_MASK;
|
||||
DATAFLASH_CHIPCS_PORT.OUTSET = DATAFLASH_CHIPCS_MASK;
|
||||
DATAFLASH_CHIPCS_PORT.DIRSET = DATAFLASH_CHIPCS_MASK;
|
||||
|
||||
PORTE.REMAP |= PORT_USART0_bm;
|
||||
PORTCFG.MPCMASK = DATAFLASH_CHIPCS_MASK;
|
||||
DATAFLASH_CHIPCS_PORT.PIN0CTRL = PORT_INVEN_bm;
|
||||
|
||||
PORTC.REMAP |= PORT_USART0_bm;
|
||||
}
|
||||
|
||||
/** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash.
|
||||
|
@ -103,7 +110,7 @@
|
|||
static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
|
||||
static inline uint8_t Dataflash_TransferByte(const uint8_t Byte)
|
||||
{
|
||||
return SerialSPI_TransferByte(&USARTE0, Byte);
|
||||
return SerialSPI_TransferByte(&USARTC0, Byte);
|
||||
}
|
||||
|
||||
/** Sends a byte to the currently selected dataflash IC, and ignores the next byte from the dataflash.
|
||||
|
@ -113,7 +120,7 @@
|
|||
static inline void Dataflash_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
|
||||
static inline void Dataflash_SendByte(const uint8_t Byte)
|
||||
{
|
||||
SerialSPI_SendByte(&USARTE0, Byte);
|
||||
SerialSPI_SendByte(&USARTC0, Byte);
|
||||
}
|
||||
|
||||
/** Sends a dummy byte to the currently selected dataflash IC, and returns the next byte from the dataflash.
|
||||
|
@ -123,7 +130,7 @@
|
|||
static inline uint8_t Dataflash_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint8_t Dataflash_ReceiveByte(void)
|
||||
{
|
||||
return SerialSPI_ReceiveByte(&USARTE0);
|
||||
return SerialSPI_ReceiveByte(&USARTC0);
|
||||
}
|
||||
|
||||
/** Determines the currently selected dataflash chip.
|
||||
|
@ -145,7 +152,8 @@
|
|||
static inline void Dataflash_SelectChip(const uint8_t ChipMask) ATTR_ALWAYS_INLINE;
|
||||
static inline void Dataflash_SelectChip(const uint8_t ChipMask)
|
||||
{
|
||||
DATAFLASH_CHIPCS_PORT.OUT = ((DATAFLASH_CHIPCS_PORT.OUT & ~DATAFLASH_CHIPCS_MASK) | ChipMask);
|
||||
DATAFLASH_CHIPCS_PORT.OUTCLR = DATAFLASH_CHIPCS_MASK;
|
||||
DATAFLASH_CHIPCS_PORT.OUTSET = (ChipMask & DATAFLASH_CHIPCS_MASK);
|
||||
}
|
||||
|
||||
/** Deselects the current dataflash chip, so that no dataflash is selected. */
|
||||
|
|
|
@ -42,6 +42,15 @@
|
|||
*
|
||||
* Board specific LED driver header for the Atmel XMEGA B1 Xplained.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
|
||||
* <tr><td>LEDS_LED1</td><td>Yellow</td><td>LED0 LED</td><td>High</td><td>PORTB.4</td></tr>
|
||||
* <tr><td>LEDS_LED2</td><td>Yellow</td><td>LED1 LED</td><td>High</td><td>PORTB.5</td></tr>
|
||||
* <tr><td>LEDS_LED3</td><td>Yellow</td><td>LED2 LED</td><td>High</td><td>PORTB.6</td></tr>
|
||||
* <tr><td>LEDS_LED4</td><td>Yellow</td><td>LED3 LED</td><td>High</td><td>PORTB.7</td></tr>
|
||||
* <tr><td>LEDS_LED5</td><td>Green</td><td>USB LED</td><td>Low</td><td>PORTE.4</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -176,9 +176,7 @@
|
|||
*/
|
||||
static inline void SerialSPI_SendByte(const uint8_t DataByte)
|
||||
{
|
||||
UDR1 = DataByte;
|
||||
while (!(UCSR1A & (1 << TXC1)));
|
||||
UCSR1A = (1 << TXC1);
|
||||
SerialSPI_TransferByte(DataByte);
|
||||
}
|
||||
|
||||
/** Sends a dummy byte through the USART SPI interface, blocking until the transfer is complete. The response
|
||||
|
@ -188,10 +186,7 @@
|
|||
*/
|
||||
static inline uint8_t SerialSPI_ReceiveByte(void)
|
||||
{
|
||||
UDR1 = 0;
|
||||
while (!(UCSR1A & (1 << TXC1)));
|
||||
UCSR1A = (1 << TXC1);
|
||||
return UDR1;
|
||||
return SerialSPI_TransferByte(0);
|
||||
}
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
*
|
||||
* \code
|
||||
* // Initialize the Master SPI mode USART driver before first use, with 1Mbit baud
|
||||
* SerialSPI_Init(&USARTD0, (USART_SPI_SCK_LEAD_RISING | SPI_SAMPLE_LEADING | SPI_ORDER_MSB_FIRST), 1000000);
|
||||
* SerialSPI_Init(&USARTD0, (USART_SPI_SCK_LEAD_RISING | USART_SPI_SAMPLE_LEADING | USART_SPI_ORDER_MSB_FIRST), 1000000);
|
||||
*
|
||||
* // Send several bytes, ignoring the returned data
|
||||
* SerialSPI_SendByte(&USARTD0, 0x01);
|
||||
|
@ -177,9 +177,7 @@
|
|||
static inline void SerialSPI_SendByte(USART_t* const USART,
|
||||
const uint8_t DataByte)
|
||||
{
|
||||
USART->DATA = DataByte;
|
||||
while (!(USART->STATUS & USART_TXCIF_bm));
|
||||
USART->STATUS = USART_TXCIF_bm;
|
||||
SerialSPI_TransferByte(USART, DataByte);
|
||||
}
|
||||
|
||||
/** Sends a dummy byte through the USART SPI interface, blocking until the transfer is complete. The response
|
||||
|
@ -191,10 +189,7 @@
|
|||
*/
|
||||
static inline uint8_t SerialSPI_ReceiveByte(USART_t* const USART)
|
||||
{
|
||||
USART->DATA = 0;
|
||||
while (!(USART->STATUS & USART_TXCIF_bm));
|
||||
USART->STATUS = USART_TXCIF_bm;
|
||||
return USART->DATA;
|
||||
return SerialSPI_TransferByte(USART, 0);
|
||||
}
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
|
|
|
@ -84,8 +84,20 @@
|
|||
* addresses are zero-indexed. This converts a natural MIDI channel number into the logical channel address.
|
||||
*
|
||||
* \param[in] channel MIDI channel number to address.
|
||||
*
|
||||
* \return Constructed MIDI channel ID.
|
||||
*/
|
||||
#define MIDI_CHANNEL(channel) ((channel) - 1)
|
||||
|
||||
/** Constructs a MIDI event ID from a given MIDI command and a virtual MIDI cable index. This can then be
|
||||
* used to create and decode \ref MIDI_EventPacket_t MIDI event packets.
|
||||
*
|
||||
* \param[in] virtualcable Index of the virtual MIDI cable the event relates to
|
||||
* \param[in] command MIDI command to send through the virtual MIDI cable
|
||||
*
|
||||
* \return Constructed MIDI event ID.
|
||||
*/
|
||||
#define MIDI_EVENT(virtualcable, command) ((virtualcable << 4) | (command >> 4))
|
||||
|
||||
/* Enums: */
|
||||
/** Enum for the possible MIDI jack types in a MIDI device jack descriptor. */
|
||||
|
@ -290,8 +302,7 @@
|
|||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned Command : 4; /**< Upper nibble of the MIDI command being sent or received in the event packet. */
|
||||
unsigned CableNumber : 4; /**< Virtual cable number of the event being sent or received in the given MIDI interface. */
|
||||
uint8_t Event; /**< MIDI event type, constructed with the \ref MIDI_EVENT() macro. */
|
||||
|
||||
uint8_t Data1; /**< First byte of data in the MIDI event. */
|
||||
uint8_t Data2; /**< Second byte of data in the MIDI event. */
|
||||
|
|
|
@ -48,15 +48,16 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi
|
|||
|
||||
if ((InterfaceIndex != AudioInterfaceInfo->Config.ControlInterfaceNumber) &&
|
||||
(InterfaceIndex != AudioInterfaceInfo->Config.StreamingInterfaceNumber))
|
||||
|
||||
return;
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_ENDPOINT)
|
||||
{
|
||||
uint8_t EndpointIndex = (USB_ControlRequest.wIndex & 0xFF);
|
||||
uint8_t EndpointAddress = (USB_ControlRequest.wIndex & 0xFF);
|
||||
|
||||
if ((EndpointIndex != (ENDPOINT_DIR_IN | AudioInterfaceInfo->Config.DataINEndpointNumber)) &&
|
||||
(EndpointIndex != (ENDPOINT_DIR_OUT | AudioInterfaceInfo->Config.DataOUTEndpointNumber)))
|
||||
if ((EndpointAddress != AudioInterfaceInfo->Config.DataINEndpoint.Address) &&
|
||||
(EndpointAddress != AudioInterfaceInfo->Config.DataOUTEndpoint.Address))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -88,7 +89,7 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi
|
|||
case AUDIO_REQ_SetMinimum:
|
||||
case AUDIO_REQ_SetMaximum:
|
||||
case AUDIO_REQ_SetResolution:
|
||||
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_ENDPOINT))
|
||||
if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_ENDPOINT)
|
||||
{
|
||||
uint8_t EndpointProperty = USB_ControlRequest.bRequest;
|
||||
uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex;
|
||||
|
@ -108,7 +109,7 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi
|
|||
EndpointControl, &ValueLength, Value);
|
||||
}
|
||||
}
|
||||
else if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
|
||||
else if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_INTERFACE)
|
||||
{
|
||||
uint8_t Property = USB_ControlRequest.bRequest;
|
||||
uint8_t Entity = (USB_ControlRequest.wIndex >> 8);
|
||||
|
@ -134,7 +135,7 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi
|
|||
case AUDIO_REQ_GetMinimum:
|
||||
case AUDIO_REQ_GetMaximum:
|
||||
case AUDIO_REQ_GetResolution:
|
||||
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_ENDPOINT))
|
||||
if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_ENDPOINT)
|
||||
{
|
||||
uint8_t EndpointProperty = USB_ControlRequest.bRequest;
|
||||
uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex;
|
||||
|
@ -150,7 +151,7 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi
|
|||
Endpoint_ClearOUT();
|
||||
}
|
||||
}
|
||||
else if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
|
||||
else if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_INTERFACE)
|
||||
{
|
||||
uint8_t Property = USB_ControlRequest.bRequest;
|
||||
uint8_t Entity = (USB_ControlRequest.wIndex >> 8);
|
||||
|
@ -174,39 +175,15 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi
|
|||
bool Audio_Device_ConfigureEndpoints(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo)
|
||||
{
|
||||
memset(&AudioInterfaceInfo->State, 0x00, sizeof(AudioInterfaceInfo->State));
|
||||
|
||||
AudioInterfaceInfo->Config.DataINEndpoint.Type = EP_TYPE_ISOCHRONOUS;
|
||||
AudioInterfaceInfo->Config.DataOUTEndpoint.Type = EP_TYPE_ISOCHRONOUS;
|
||||
|
||||
for (uint8_t EndpointNum = 1; EndpointNum < ENDPOINT_TOTAL_ENDPOINTS; EndpointNum++)
|
||||
{
|
||||
uint16_t Size;
|
||||
uint8_t Type;
|
||||
uint8_t Direction;
|
||||
bool DoubleBanked;
|
||||
if (!(Endpoint_ConfigureEndpointTable(&AudioInterfaceInfo->Config.DataINEndpoint, 1)))
|
||||
return false;
|
||||
|
||||
if (EndpointNum == AudioInterfaceInfo->Config.DataINEndpointNumber)
|
||||
{
|
||||
Size = AudioInterfaceInfo->Config.DataINEndpointSize;
|
||||
Direction = ENDPOINT_DIR_IN;
|
||||
Type = EP_TYPE_ISOCHRONOUS;
|
||||
DoubleBanked = true;
|
||||
}
|
||||
else if (EndpointNum == AudioInterfaceInfo->Config.DataOUTEndpointNumber)
|
||||
{
|
||||
Size = AudioInterfaceInfo->Config.DataOUTEndpointSize;
|
||||
Direction = ENDPOINT_DIR_OUT;
|
||||
Type = EP_TYPE_ISOCHRONOUS;
|
||||
DoubleBanked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
|
||||
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!(Endpoint_ConfigureEndpointTable(&AudioInterfaceInfo->Config.DataOUTEndpoint, 1)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -86,19 +86,8 @@
|
|||
* structure controls.
|
||||
*/
|
||||
|
||||
uint8_t DataINEndpointNumber; /**< Endpoint number of the incoming Audio Streaming data, if available
|
||||
* (zero if unused).
|
||||
*/
|
||||
uint16_t DataINEndpointSize; /**< Size in bytes of the incoming Audio Streaming data endpoint, if available
|
||||
* (zero if unused).
|
||||
*/
|
||||
|
||||
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the outgoing Audio Streaming data, if available
|
||||
* (zero if unused).
|
||||
*/
|
||||
uint16_t DataOUTEndpointSize; /**< Size in bytes of the outgoing Audio Streaming data endpoint, if available
|
||||
* (zero if unused).
|
||||
*/
|
||||
USB_Endpoint_Table_t DataINEndpoint; /**< Data IN endpoint configuration table. */
|
||||
USB_Endpoint_Table_t DataOUTEndpoint; /**< Data OUT endpoint configuration table. */
|
||||
} Config; /**< Config data for the USB class interface within the device. All elements in this section
|
||||
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
|
||||
*/
|
||||
|
@ -226,7 +215,7 @@
|
|||
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(AudioInterfaceInfo->State.InterfaceEnabled))
|
||||
return false;
|
||||
|
||||
Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataOUTEndpointNumber);
|
||||
Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataOUTEndpoint.Address);
|
||||
return Endpoint_IsOUTReceived();
|
||||
}
|
||||
|
||||
|
@ -247,7 +236,7 @@
|
|||
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(AudioInterfaceInfo->State.InterfaceEnabled))
|
||||
return false;
|
||||
|
||||
Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataINEndpointNumber);
|
||||
Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataINEndpoint.Address);
|
||||
return Endpoint_IsINReady();
|
||||
}
|
||||
|
||||
|
@ -341,7 +330,7 @@
|
|||
{
|
||||
Endpoint_Write_8(Sample);
|
||||
|
||||
if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpointSize)
|
||||
if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpoint.Size)
|
||||
Endpoint_ClearIN();
|
||||
}
|
||||
|
||||
|
@ -360,7 +349,7 @@
|
|||
{
|
||||
Endpoint_Write_16_LE(Sample);
|
||||
|
||||
if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpointSize)
|
||||
if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpoint.Size)
|
||||
Endpoint_ClearIN();
|
||||
}
|
||||
|
||||
|
@ -380,7 +369,7 @@
|
|||
Endpoint_Write_16_LE(Sample);
|
||||
Endpoint_Write_8(Sample >> 16);
|
||||
|
||||
if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpointSize)
|
||||
if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpoint.Size)
|
||||
Endpoint_ClearIN();
|
||||
}
|
||||
|
||||
|
|
|
@ -69,8 +69,12 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter
|
|||
{
|
||||
Endpoint_ClearSETUP();
|
||||
|
||||
while (!(Endpoint_IsOUTReceived()));
|
||||
|
||||
while (!(Endpoint_IsOUTReceived()))
|
||||
{
|
||||
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
||||
return;
|
||||
}
|
||||
|
||||
CDCInterfaceInfo->State.LineEncoding.BaudRateBPS = Endpoint_Read_32_LE();
|
||||
CDCInterfaceInfo->State.LineEncoding.CharFormat = Endpoint_Read_8();
|
||||
CDCInterfaceInfo->State.LineEncoding.ParityType = Endpoint_Read_8();
|
||||
|
@ -112,45 +116,18 @@ bool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_Device_t* const CDCInterfac
|
|||
{
|
||||
memset(&CDCInterfaceInfo->State, 0x00, sizeof(CDCInterfaceInfo->State));
|
||||
|
||||
for (uint8_t EndpointNum = 1; EndpointNum < ENDPOINT_TOTAL_ENDPOINTS; EndpointNum++)
|
||||
{
|
||||
uint16_t Size;
|
||||
uint8_t Type;
|
||||
uint8_t Direction;
|
||||
bool DoubleBanked;
|
||||
CDCInterfaceInfo->Config.DataINEndpoint.Type = EP_TYPE_BULK;
|
||||
CDCInterfaceInfo->Config.DataOUTEndpoint.Type = EP_TYPE_BULK;
|
||||
CDCInterfaceInfo->Config.NotificationEndpoint.Type = EP_TYPE_INTERRUPT;
|
||||
|
||||
if (EndpointNum == CDCInterfaceInfo->Config.DataINEndpointNumber)
|
||||
{
|
||||
Size = CDCInterfaceInfo->Config.DataINEndpointSize;
|
||||
Direction = ENDPOINT_DIR_IN;
|
||||
Type = EP_TYPE_BULK;
|
||||
DoubleBanked = CDCInterfaceInfo->Config.DataINEndpointDoubleBank;
|
||||
}
|
||||
else if (EndpointNum == CDCInterfaceInfo->Config.DataOUTEndpointNumber)
|
||||
{
|
||||
Size = CDCInterfaceInfo->Config.DataOUTEndpointSize;
|
||||
Direction = ENDPOINT_DIR_OUT;
|
||||
Type = EP_TYPE_BULK;
|
||||
DoubleBanked = CDCInterfaceInfo->Config.DataOUTEndpointDoubleBank;
|
||||
}
|
||||
else if (EndpointNum == CDCInterfaceInfo->Config.NotificationEndpointNumber)
|
||||
{
|
||||
Size = CDCInterfaceInfo->Config.NotificationEndpointSize;
|
||||
Direction = ENDPOINT_DIR_IN;
|
||||
Type = EP_TYPE_INTERRUPT;
|
||||
DoubleBanked = CDCInterfaceInfo->Config.NotificationEndpointDoubleBank;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!(Endpoint_ConfigureEndpointTable(&CDCInterfaceInfo->Config.DataINEndpoint, 1)))
|
||||
return false;
|
||||
|
||||
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
|
||||
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!(Endpoint_ConfigureEndpointTable(&CDCInterfaceInfo->Config.DataOUTEndpoint, 1)))
|
||||
return false;
|
||||
|
||||
if (!(Endpoint_ConfigureEndpointTable(&CDCInterfaceInfo->Config.NotificationEndpoint, 1)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -171,7 +148,7 @@ uint8_t CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo
|
|||
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))
|
||||
return ENDPOINT_RWSTREAM_DeviceDisconnected;
|
||||
|
||||
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber);
|
||||
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpoint.Address);
|
||||
return Endpoint_Write_Stream_LE(String, strlen(String), NULL);
|
||||
}
|
||||
|
||||
|
@ -182,7 +159,7 @@ uint8_t CDC_Device_SendData(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo,
|
|||
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))
|
||||
return ENDPOINT_RWSTREAM_DeviceDisconnected;
|
||||
|
||||
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber);
|
||||
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpoint.Address);
|
||||
return Endpoint_Write_Stream_LE(Buffer, Length, NULL);
|
||||
}
|
||||
|
||||
|
@ -192,7 +169,7 @@ uint8_t CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo,
|
|||
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))
|
||||
return ENDPOINT_RWSTREAM_DeviceDisconnected;
|
||||
|
||||
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber);
|
||||
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpoint.Address);
|
||||
|
||||
if (!(Endpoint_IsReadWriteAllowed()))
|
||||
{
|
||||
|
@ -215,7 +192,7 @@ uint8_t CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
|
|||
|
||||
uint8_t ErrorCode;
|
||||
|
||||
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber);
|
||||
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpoint.Address);
|
||||
|
||||
if (!(Endpoint_BytesInEndpoint()))
|
||||
return ENDPOINT_READYWAIT_NoError;
|
||||
|
@ -240,7 +217,7 @@ uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_Device_t* const CDCInterface
|
|||
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))
|
||||
return 0;
|
||||
|
||||
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpointNumber);
|
||||
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpoint.Address);
|
||||
|
||||
if (Endpoint_IsOUTReceived())
|
||||
{
|
||||
|
@ -267,7 +244,7 @@ int16_t CDC_Device_ReceiveByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInf
|
|||
|
||||
int16_t ReceivedByte = -1;
|
||||
|
||||
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpointNumber);
|
||||
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpoint.Address);
|
||||
|
||||
if (Endpoint_IsOUTReceived())
|
||||
{
|
||||
|
@ -286,7 +263,7 @@ void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_Device_t* const CDC
|
|||
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))
|
||||
return;
|
||||
|
||||
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.NotificationEndpointNumber);
|
||||
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.NotificationEndpoint.Address);
|
||||
|
||||
USB_Request_Header_t Notification = (USB_Request_Header_t)
|
||||
{
|
||||
|
|
|
@ -99,19 +99,11 @@
|
|||
{
|
||||
struct
|
||||
{
|
||||
uint8_t ControlInterfaceNumber; /**< Interface number of the CDC control interface within the device. */
|
||||
|
||||
uint8_t DataINEndpointNumber; /**< Endpoint number of the CDC interface's IN data endpoint. */
|
||||
uint16_t DataINEndpointSize; /**< Size in bytes of the CDC interface's IN data endpoint. */
|
||||
bool DataINEndpointDoubleBank; /**< Indicates if the CDC interface's IN data endpoint should use double banking. */
|
||||
|
||||
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the CDC interface's OUT data endpoint. */
|
||||
uint16_t DataOUTEndpointSize; /**< Size in bytes of the CDC interface's OUT data endpoint. */
|
||||
bool DataOUTEndpointDoubleBank; /**< Indicates if the CDC interface's OUT data endpoint should use double banking. */
|
||||
|
||||
uint8_t NotificationEndpointNumber; /**< Endpoint number of the CDC interface's IN notification endpoint, if used. */
|
||||
uint16_t NotificationEndpointSize; /**< Size in bytes of the CDC interface's IN notification endpoint, if used. */
|
||||
bool NotificationEndpointDoubleBank; /**< Indicates if the CDC interface's notification endpoint should use double banking. */
|
||||
uint8_t ControlInterfaceNumber; /**< Interface number of the CDC control interface within the device. */
|
||||
|
||||
USB_Endpoint_Table_t DataINEndpoint; /**< Data IN endpoint configuration table. */
|
||||
USB_Endpoint_Table_t DataOUTEndpoint; /**< Data OUT endpoint configuration table. */
|
||||
USB_Endpoint_Table_t NotificationEndpoint; /**< Notification IN Endpoint configuration table. */
|
||||
} Config; /**< Config data for the USB class interface within the device. All elements in this section
|
||||
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
|
||||
*/
|
||||
|
|
|
@ -141,13 +141,11 @@ bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* const HIDInterfac
|
|||
HIDInterfaceInfo->State.UsingReportProtocol = true;
|
||||
HIDInterfaceInfo->State.IdleCount = 500;
|
||||
|
||||
if (!(Endpoint_ConfigureEndpoint(HIDInterfaceInfo->Config.ReportINEndpointNumber, EP_TYPE_INTERRUPT,
|
||||
ENDPOINT_DIR_IN, HIDInterfaceInfo->Config.ReportINEndpointSize,
|
||||
HIDInterfaceInfo->Config.ReportINEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
HIDInterfaceInfo->Config.ReportINEndpoint.Type = EP_TYPE_INTERRUPT;
|
||||
|
||||
if (!(Endpoint_ConfigureEndpointTable(&HIDInterfaceInfo->Config.ReportINEndpoint, 1)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -159,7 +157,7 @@ void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
|
|||
if (HIDInterfaceInfo->State.PrevFrameNum == USB_Device_GetFrameNumber())
|
||||
return;
|
||||
|
||||
Endpoint_SelectEndpoint(HIDInterfaceInfo->Config.ReportINEndpointNumber);
|
||||
Endpoint_SelectEndpoint(HIDInterfaceInfo->Config.ReportINEndpoint.Address);
|
||||
|
||||
if (Endpoint_IsReadWriteAllowed())
|
||||
{
|
||||
|
@ -184,7 +182,7 @@ void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
|
|||
{
|
||||
HIDInterfaceInfo->State.IdleMSRemaining = HIDInterfaceInfo->State.IdleCount;
|
||||
|
||||
Endpoint_SelectEndpoint(HIDInterfaceInfo->Config.ReportINEndpointNumber);
|
||||
Endpoint_SelectEndpoint(HIDInterfaceInfo->Config.ReportINEndpoint.Address);
|
||||
|
||||
if (ReportID)
|
||||
Endpoint_Write_8(ReportID);
|
||||
|
|
|
@ -85,9 +85,7 @@
|
|||
{
|
||||
uint8_t InterfaceNumber; /**< Interface number of the HID interface within the device. */
|
||||
|
||||
uint8_t ReportINEndpointNumber; /**< Endpoint number of the HID interface's IN report endpoint. */
|
||||
uint16_t ReportINEndpointSize; /**< Size in bytes of the HID interface's IN report endpoint. */
|
||||
bool ReportINEndpointDoubleBank; /**< Indicates if the HID interface's IN report endpoint should use double banking. */
|
||||
USB_Endpoint_Table_t ReportINEndpoint; /**< Data IN HID report endpoint configuration table. */
|
||||
|
||||
void* PrevReportINBuffer; /**< Pointer to a buffer where the previously created HID input report can be
|
||||
* stored by the driver, for comparison purposes to detect report changes that
|
||||
|
|
|
@ -41,38 +41,14 @@ bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInter
|
|||
{
|
||||
memset(&MIDIInterfaceInfo->State, 0x00, sizeof(MIDIInterfaceInfo->State));
|
||||
|
||||
for (uint8_t EndpointNum = 1; EndpointNum < ENDPOINT_TOTAL_ENDPOINTS; EndpointNum++)
|
||||
{
|
||||
uint16_t Size;
|
||||
uint8_t Type;
|
||||
uint8_t Direction;
|
||||
bool DoubleBanked;
|
||||
MIDIInterfaceInfo->Config.DataINEndpoint.Type = EP_TYPE_BULK;
|
||||
MIDIInterfaceInfo->Config.DataOUTEndpoint.Type = EP_TYPE_BULK;
|
||||
|
||||
if (EndpointNum == MIDIInterfaceInfo->Config.DataINEndpointNumber)
|
||||
{
|
||||
Size = MIDIInterfaceInfo->Config.DataINEndpointSize;
|
||||
Direction = ENDPOINT_DIR_IN;
|
||||
Type = EP_TYPE_BULK;
|
||||
DoubleBanked = MIDIInterfaceInfo->Config.DataINEndpointDoubleBank;
|
||||
}
|
||||
else if (EndpointNum == MIDIInterfaceInfo->Config.DataOUTEndpointNumber)
|
||||
{
|
||||
Size = MIDIInterfaceInfo->Config.DataOUTEndpointSize;
|
||||
Direction = ENDPOINT_DIR_OUT;
|
||||
Type = EP_TYPE_BULK;
|
||||
DoubleBanked = MIDIInterfaceInfo->Config.DataOUTEndpointDoubleBank;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!(Endpoint_ConfigureEndpointTable(&MIDIInterfaceInfo->Config.DataINEndpoint, 1)))
|
||||
return false;
|
||||
|
||||
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
|
||||
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!(Endpoint_ConfigureEndpointTable(&MIDIInterfaceInfo->Config.DataOUTEndpoint, 1)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -95,7 +71,7 @@ uint8_t MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInter
|
|||
|
||||
uint8_t ErrorCode;
|
||||
|
||||
Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpointNumber);
|
||||
Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpoint.Address);
|
||||
|
||||
if ((ErrorCode = Endpoint_Write_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NULL)) != ENDPOINT_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
@ -113,7 +89,7 @@ uint8_t MIDI_Device_Flush(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo)
|
|||
|
||||
uint8_t ErrorCode;
|
||||
|
||||
Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpointNumber);
|
||||
Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpoint.Address);
|
||||
|
||||
if (Endpoint_BytesInEndpoint())
|
||||
{
|
||||
|
@ -132,7 +108,7 @@ bool MIDI_Device_ReceiveEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInter
|
|||
if (USB_DeviceState != DEVICE_STATE_Configured)
|
||||
return false;
|
||||
|
||||
Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataOUTEndpointNumber);
|
||||
Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataOUTEndpoint.Address);
|
||||
|
||||
if (!(Endpoint_IsReadWriteAllowed()))
|
||||
return false;
|
||||
|
|
|
@ -81,13 +81,8 @@
|
|||
{
|
||||
uint8_t StreamingInterfaceNumber; /**< Index of the Audio Streaming interface within the device this structure controls. */
|
||||
|
||||
uint8_t DataINEndpointNumber; /**< Endpoint number of the incoming MIDI IN data, if available (zero if unused). */
|
||||
uint16_t DataINEndpointSize; /**< Size in bytes of the incoming MIDI IN data endpoint, if available (zero if unused). */
|
||||
bool DataINEndpointDoubleBank; /**< Indicates if the MIDI interface's IN data endpoint should use double banking. */
|
||||
|
||||
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the outgoing MIDI OUT data, if available (zero if unused). */
|
||||
uint16_t DataOUTEndpointSize; /**< Size in bytes of the outgoing MIDI OUT data endpoint, if available (zero if unused). */
|
||||
bool DataOUTEndpointDoubleBank; /**< Indicates if the MIDI interface's OUT data endpoint should use double banking. */
|
||||
USB_Endpoint_Table_t DataINEndpoint; /**< Data IN endpoint configuration table. */
|
||||
USB_Endpoint_Table_t DataOUTEndpoint; /**< Data OUT endpoint configuration table. */
|
||||
} Config; /**< Config data for the USB class interface within the device. All elements in this section
|
||||
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
|
||||
*/
|
||||
|
|
|
@ -75,38 +75,14 @@ bool MS_Device_ConfigureEndpoints(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
|
|||
{
|
||||
memset(&MSInterfaceInfo->State, 0x00, sizeof(MSInterfaceInfo->State));
|
||||
|
||||
for (uint8_t EndpointNum = 1; EndpointNum < ENDPOINT_TOTAL_ENDPOINTS; EndpointNum++)
|
||||
{
|
||||
uint16_t Size;
|
||||
uint8_t Type;
|
||||
uint8_t Direction;
|
||||
bool DoubleBanked;
|
||||
MSInterfaceInfo->Config.DataINEndpoint.Type = EP_TYPE_BULK;
|
||||
MSInterfaceInfo->Config.DataOUTEndpoint.Type = EP_TYPE_BULK;
|
||||
|
||||
if (EndpointNum == MSInterfaceInfo->Config.DataINEndpointNumber)
|
||||
{
|
||||
Size = MSInterfaceInfo->Config.DataINEndpointSize;
|
||||
Direction = ENDPOINT_DIR_IN;
|
||||
Type = EP_TYPE_BULK;
|
||||
DoubleBanked = MSInterfaceInfo->Config.DataINEndpointDoubleBank;
|
||||
}
|
||||
else if (EndpointNum == MSInterfaceInfo->Config.DataOUTEndpointNumber)
|
||||
{
|
||||
Size = MSInterfaceInfo->Config.DataOUTEndpointSize;
|
||||
Direction = ENDPOINT_DIR_OUT;
|
||||
Type = EP_TYPE_BULK;
|
||||
DoubleBanked = MSInterfaceInfo->Config.DataOUTEndpointDoubleBank;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!(Endpoint_ConfigureEndpointTable(&MSInterfaceInfo->Config.DataINEndpoint, 1)))
|
||||
return false;
|
||||
|
||||
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
|
||||
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!(Endpoint_ConfigureEndpointTable(&MSInterfaceInfo->Config.DataOUTEndpoint, 1)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -116,14 +92,14 @@ void MS_Device_USBTask(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
|
|||
if (USB_DeviceState != DEVICE_STATE_Configured)
|
||||
return;
|
||||
|
||||
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber);
|
||||
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpoint.Address);
|
||||
|
||||
if (Endpoint_IsReadWriteAllowed())
|
||||
if (Endpoint_IsOUTReceived())
|
||||
{
|
||||
if (MS_Device_ReadInCommandBlock(MSInterfaceInfo))
|
||||
{
|
||||
if (MSInterfaceInfo->State.CommandBlock.Flags & MS_COMMAND_DIR_DATA_IN)
|
||||
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber);
|
||||
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpoint.Address);
|
||||
|
||||
bool SCSICommandResult = CALLBACK_MS_Device_SCSICommandReceived(MSInterfaceInfo);
|
||||
|
||||
|
@ -141,13 +117,13 @@ void MS_Device_USBTask(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
|
|||
|
||||
if (MSInterfaceInfo->State.IsMassStoreReset)
|
||||
{
|
||||
Endpoint_ResetEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber);
|
||||
Endpoint_ResetEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber);
|
||||
Endpoint_ResetEndpoint(MSInterfaceInfo->Config.DataOUTEndpoint.Address);
|
||||
Endpoint_ResetEndpoint(MSInterfaceInfo->Config.DataINEndpoint.Address);
|
||||
|
||||
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber);
|
||||
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpoint.Address);
|
||||
Endpoint_ClearStall();
|
||||
Endpoint_ResetDataToggle();
|
||||
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber);
|
||||
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpoint.Address);
|
||||
Endpoint_ClearStall();
|
||||
Endpoint_ResetDataToggle();
|
||||
|
||||
|
@ -159,8 +135,8 @@ static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInte
|
|||
{
|
||||
uint16_t BytesProcessed;
|
||||
|
||||
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber);
|
||||
|
||||
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpoint.Address);
|
||||
|
||||
BytesProcessed = 0;
|
||||
while (Endpoint_Read_Stream_LE(&MSInterfaceInfo->State.CommandBlock,
|
||||
(sizeof(MS_CommandBlockWrapper_t) - 16), &BytesProcessed) ==
|
||||
|
@ -175,9 +151,9 @@ static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInte
|
|||
(MSInterfaceInfo->State.CommandBlock.Flags & 0x1F) ||
|
||||
(MSInterfaceInfo->State.CommandBlock.SCSICommandLength == 0) ||
|
||||
(MSInterfaceInfo->State.CommandBlock.SCSICommandLength > 16))
|
||||
{
|
||||
{
|
||||
Endpoint_StallTransaction();
|
||||
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber);
|
||||
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpoint.Address);
|
||||
Endpoint_StallTransaction();
|
||||
|
||||
return false;
|
||||
|
@ -199,7 +175,7 @@ static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInte
|
|||
|
||||
static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
|
||||
{
|
||||
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber);
|
||||
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpoint.Address);
|
||||
|
||||
while (Endpoint_IsStalled())
|
||||
{
|
||||
|
@ -211,7 +187,7 @@ static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_Device_t* const MSInt
|
|||
return;
|
||||
}
|
||||
|
||||
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber);
|
||||
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpoint.Address);
|
||||
|
||||
while (Endpoint_IsStalled())
|
||||
{
|
||||
|
|
|
@ -81,13 +81,8 @@
|
|||
{
|
||||
uint8_t InterfaceNumber; /**< Interface number of the Mass Storage interface within the device. */
|
||||
|
||||
uint8_t DataINEndpointNumber; /**< Endpoint number of the Mass Storage interface's IN data endpoint. */
|
||||
uint16_t DataINEndpointSize; /**< Size in bytes of the Mass Storage interface's IN data endpoint. */
|
||||
bool DataINEndpointDoubleBank; /**< Indicates if the Mass Storage interface's IN data endpoint should use double banking. */
|
||||
|
||||
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the Mass Storage interface's OUT data endpoint. */
|
||||
uint16_t DataOUTEndpointSize; /**< Size in bytes of the Mass Storage interface's OUT data endpoint. */
|
||||
bool DataOUTEndpointDoubleBank; /**< Indicates if the Mass Storage interface's OUT data endpoint should use double banking. */
|
||||
USB_Endpoint_Table_t DataINEndpoint; /**< Data IN endpoint configuration table. */
|
||||
USB_Endpoint_Table_t DataOUTEndpoint; /**< Data OUT endpoint configuration table. */
|
||||
|
||||
uint8_t TotalLUNs; /**< Total number of logical drives in the Mass Storage interface. */
|
||||
} Config; /**< Config data for the USB class interface within the device. All elements in this section
|
||||
|
|
|
@ -115,45 +115,18 @@ bool RNDIS_Device_ConfigureEndpoints(USB_ClassInfo_RNDIS_Device_t* const RNDISIn
|
|||
{
|
||||
memset(&RNDISInterfaceInfo->State, 0x00, sizeof(RNDISInterfaceInfo->State));
|
||||
|
||||
for (uint8_t EndpointNum = 1; EndpointNum < ENDPOINT_TOTAL_ENDPOINTS; EndpointNum++)
|
||||
{
|
||||
uint16_t Size;
|
||||
uint8_t Type;
|
||||
uint8_t Direction;
|
||||
bool DoubleBanked;
|
||||
RNDISInterfaceInfo->Config.DataINEndpoint.Type = EP_TYPE_BULK;
|
||||
RNDISInterfaceInfo->Config.DataOUTEndpoint.Type = EP_TYPE_BULK;
|
||||
RNDISInterfaceInfo->Config.NotificationEndpoint.Type = EP_TYPE_INTERRUPT;
|
||||
|
||||
if (EndpointNum == RNDISInterfaceInfo->Config.DataINEndpointNumber)
|
||||
{
|
||||
Size = RNDISInterfaceInfo->Config.DataINEndpointSize;
|
||||
Direction = ENDPOINT_DIR_IN;
|
||||
Type = EP_TYPE_BULK;
|
||||
DoubleBanked = RNDISInterfaceInfo->Config.DataINEndpointDoubleBank;
|
||||
}
|
||||
else if (EndpointNum == RNDISInterfaceInfo->Config.DataOUTEndpointNumber)
|
||||
{
|
||||
Size = RNDISInterfaceInfo->Config.DataOUTEndpointSize;
|
||||
Direction = ENDPOINT_DIR_OUT;
|
||||
Type = EP_TYPE_BULK;
|
||||
DoubleBanked = RNDISInterfaceInfo->Config.DataOUTEndpointDoubleBank;
|
||||
}
|
||||
else if (EndpointNum == RNDISInterfaceInfo->Config.NotificationEndpointNumber)
|
||||
{
|
||||
Size = RNDISInterfaceInfo->Config.NotificationEndpointSize;
|
||||
Direction = ENDPOINT_DIR_IN;
|
||||
Type = EP_TYPE_INTERRUPT;
|
||||
DoubleBanked = RNDISInterfaceInfo->Config.NotificationEndpointDoubleBank;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!(Endpoint_ConfigureEndpointTable(&RNDISInterfaceInfo->Config.DataINEndpoint, 1)))
|
||||
return false;
|
||||
|
||||
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
|
||||
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!(Endpoint_ConfigureEndpointTable(&RNDISInterfaceInfo->Config.DataOUTEndpoint, 1)))
|
||||
return false;
|
||||
|
||||
if (!(Endpoint_ConfigureEndpointTable(&RNDISInterfaceInfo->Config.NotificationEndpoint, 1)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -163,7 +136,7 @@ void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo
|
|||
if (USB_DeviceState != DEVICE_STATE_Configured)
|
||||
return;
|
||||
|
||||
Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.NotificationEndpointNumber);
|
||||
Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.NotificationEndpoint.Address);
|
||||
|
||||
if (Endpoint_IsINReady() && RNDISInterfaceInfo->State.ResponseReady)
|
||||
{
|
||||
|
@ -454,7 +427,7 @@ bool RNDIS_Device_IsPacketReceived(USB_ClassInfo_RNDIS_Device_t* const RNDISInte
|
|||
return false;
|
||||
}
|
||||
|
||||
Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.DataOUTEndpointNumber);
|
||||
Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.DataOUTEndpoint.Address);
|
||||
return Endpoint_IsOUTReceived();
|
||||
}
|
||||
|
||||
|
@ -468,7 +441,7 @@ uint8_t RNDIS_Device_ReadPacket(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfa
|
|||
return ENDPOINT_RWSTREAM_DeviceDisconnected;
|
||||
}
|
||||
|
||||
Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.DataOUTEndpointNumber);
|
||||
Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.DataOUTEndpoint.Address);
|
||||
|
||||
*PacketLength = 0;
|
||||
|
||||
|
@ -505,7 +478,7 @@ uint8_t RNDIS_Device_SendPacket(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfa
|
|||
return ENDPOINT_RWSTREAM_DeviceDisconnected;
|
||||
}
|
||||
|
||||
Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.DataINEndpointNumber);
|
||||
Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.DataINEndpoint.Address);
|
||||
|
||||
if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError)
|
||||
return ErrorCode;
|
||||
|
|
|
@ -81,17 +81,9 @@
|
|||
{
|
||||
uint8_t ControlInterfaceNumber; /**< Interface number of the RNDIS control interface within the device. */
|
||||
|
||||
uint8_t DataINEndpointNumber; /**< Endpoint number of the RNDIS interface's IN data endpoint. */
|
||||
uint16_t DataINEndpointSize; /**< Size in bytes of the RNDIS interface's IN data endpoint. */
|
||||
bool DataINEndpointDoubleBank; /**< Indicates if the RNDIS interface's IN data endpoint should use double banking. */
|
||||
|
||||
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the RNDIS interface's OUT data endpoint. */
|
||||
uint16_t DataOUTEndpointSize; /**< Size in bytes of the RNDIS interface's OUT data endpoint. */
|
||||
bool DataOUTEndpointDoubleBank; /**< Indicates if the RNDIS interface's OUT data endpoint should use double banking. */
|
||||
|
||||
uint8_t NotificationEndpointNumber; /**< Endpoint number of the RNDIS interface's IN notification endpoint, if used. */
|
||||
uint16_t NotificationEndpointSize; /**< Size in bytes of the RNDIS interface's IN notification endpoint, if used. */
|
||||
bool NotificationEndpointDoubleBank; /**< Indicates if the RNDIS interface's notification endpoint should use double banking. */
|
||||
USB_Endpoint_Table_t DataINEndpoint; /**< Data IN endpoint configuration table. */
|
||||
USB_Endpoint_Table_t DataOUTEndpoint; /**< Data OUT endpoint configuration table. */
|
||||
USB_Endpoint_Table_t NotificationEndpoint; /**< Notification IN Endpoint configuration table. */
|
||||
|
||||
char* AdapterVendorDescription; /**< String description of the adapter vendor. */
|
||||
MAC_Address_t AdapterMACAddress; /**< MAC address of the adapter. */
|
||||
|
|
|
@ -89,45 +89,19 @@ uint8_t AOA_Host_ConfigurePipes(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo
|
|||
DataOUTEndpoint = EndpointData;
|
||||
}
|
||||
|
||||
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
|
||||
{
|
||||
uint16_t Size;
|
||||
uint8_t Type;
|
||||
uint8_t Token;
|
||||
uint8_t EndpointAddress;
|
||||
bool DoubleBanked;
|
||||
|
||||
if (PipeNum == AOAInterfaceInfo->Config.DataINPipeNumber)
|
||||
{
|
||||
Size = le16_to_cpu(DataINEndpoint->EndpointSize);
|
||||
EndpointAddress = DataINEndpoint->EndpointAddress;
|
||||
Token = PIPE_TOKEN_IN;
|
||||
Type = EP_TYPE_BULK;
|
||||
DoubleBanked = AOAInterfaceInfo->Config.DataINPipeDoubleBank;
|
||||
|
||||
AOAInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
|
||||
}
|
||||
else if (PipeNum == AOAInterfaceInfo->Config.DataOUTPipeNumber)
|
||||
{
|
||||
Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
|
||||
EndpointAddress = DataOUTEndpoint->EndpointAddress;
|
||||
Token = PIPE_TOKEN_OUT;
|
||||
Type = EP_TYPE_BULK;
|
||||
DoubleBanked = AOAInterfaceInfo->Config.DataOUTPipeDoubleBank;
|
||||
|
||||
AOAInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size,
|
||||
DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE)))
|
||||
{
|
||||
return AOA_ENUMERROR_PipeConfigurationFailed;
|
||||
}
|
||||
}
|
||||
AOAInterfaceInfo->Config.DataINPipe.Size = le16_to_cpu(DataINEndpoint->EndpointSize);
|
||||
AOAInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress;
|
||||
AOAInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_BULK;
|
||||
|
||||
AOAInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
|
||||
AOAInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress;
|
||||
AOAInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK;
|
||||
|
||||
if (!(Pipe_ConfigurePipeTable(&AOAInterfaceInfo->Config.DataINPipe, 1)))
|
||||
return false;
|
||||
|
||||
if (!(Pipe_ConfigurePipeTable(&AOAInterfaceInfo->Config.DataOUTPipe, 1)))
|
||||
return false;
|
||||
|
||||
AOAInterfaceInfo->State.IsActive = true;
|
||||
AOAInterfaceInfo->State.InterfaceNumber = AOAInterface->InterfaceNumber;
|
||||
|
@ -260,7 +234,7 @@ uint8_t AOA_Host_SendData(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo,
|
|||
|
||||
uint8_t ErrorCode;
|
||||
|
||||
Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address);
|
||||
|
||||
Pipe_Unfreeze();
|
||||
ErrorCode = Pipe_Write_Stream_LE(Buffer, Length, NULL);
|
||||
|
@ -277,7 +251,7 @@ uint8_t AOA_Host_SendString(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo,
|
|||
|
||||
uint8_t ErrorCode;
|
||||
|
||||
Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address);
|
||||
|
||||
Pipe_Unfreeze();
|
||||
ErrorCode = Pipe_Write_Stream_LE(String, strlen(String), NULL);
|
||||
|
@ -294,7 +268,7 @@ uint8_t AOA_Host_SendByte(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo,
|
|||
|
||||
uint8_t ErrorCode;
|
||||
|
||||
Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
if (!(Pipe_IsReadWriteAllowed()))
|
||||
|
@ -316,7 +290,7 @@ uint16_t AOA_Host_BytesReceived(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo
|
|||
if ((USB_HostState != HOST_STATE_Configured) || !(AOAInterfaceInfo->State.IsActive))
|
||||
return 0;
|
||||
|
||||
Pipe_SelectPipe(AOAInterfaceInfo->Config.DataINPipeNumber);
|
||||
Pipe_SelectPipe(AOAInterfaceInfo->Config.DataINPipe.Address);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
if (Pipe_IsINReceived())
|
||||
|
@ -348,7 +322,7 @@ int16_t AOA_Host_ReceiveByte(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo)
|
|||
|
||||
int16_t ReceivedByte = -1;
|
||||
|
||||
Pipe_SelectPipe(AOAInterfaceInfo->Config.DataINPipeNumber);
|
||||
Pipe_SelectPipe(AOAInterfaceInfo->Config.DataINPipe.Address);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
if (Pipe_IsINReceived())
|
||||
|
@ -372,7 +346,7 @@ uint8_t AOA_Host_Flush(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo)
|
|||
|
||||
uint8_t ErrorCode;
|
||||
|
||||
Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
if (!(Pipe_BytesInPipe()))
|
||||
|
|
|
@ -85,11 +85,8 @@
|
|||
{
|
||||
struct
|
||||
{
|
||||
uint8_t DataINPipeNumber; /**< Pipe number of the AOA interface's IN data pipe. */
|
||||
bool DataINPipeDoubleBank; /**< Indicates if the AOA interface's IN data pipe should use double banking. */
|
||||
|
||||
uint8_t DataOUTPipeNumber; /**< Pipe number of the AOA interface's OUT data pipe. */
|
||||
bool DataOUTPipeDoubleBank; /**< Indicates if the AOA interface's OUT data pipe should use double banking. */
|
||||
USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */
|
||||
USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */
|
||||
|
||||
char* PropertyStrings[AOA_STRING_TOTAL_STRINGS]; /**< Android Accessory property strings, sent to identify the accessory when the
|
||||
* Android device is switched into Open Accessory mode. */
|
||||
|
@ -103,9 +100,6 @@
|
|||
* Configured state.
|
||||
*/
|
||||
uint8_t InterfaceNumber; /**< Interface index of the AOA interface within the attached device. */
|
||||
|
||||
uint16_t DataINPipeSize; /**< Size in bytes of the AOA interface's IN data pipe. */
|
||||
uint16_t DataOUTPipeSize; /**< Size in bytes of the AOA interface's OUT data pipe. */
|
||||
} State; /**< State data for the USB class interface within the device. All elements in this section
|
||||
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
|
||||
* the interface is enumerated.
|
||||
|
|
|
@ -51,8 +51,8 @@ uint8_t Audio_Host_ConfigurePipes(USB_ClassInfo_Audio_Host_t* const AudioInterfa
|
|||
if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration)
|
||||
return AUDIO_ENUMERROR_InvalidConfigDescriptor;
|
||||
|
||||
while ((AudioInterfaceInfo->Config.DataINPipeNumber && !(DataINEndpoint)) ||
|
||||
(AudioInterfaceInfo->Config.DataOUTPipeNumber && !(DataOUTEndpoint)))
|
||||
while ((AudioInterfaceInfo->Config.DataINPipe.Address && !(DataINEndpoint)) ||
|
||||
(AudioInterfaceInfo->Config.DataOUTPipe.Address && !(DataOUTEndpoint)))
|
||||
{
|
||||
if (!(AudioControlInterface) ||
|
||||
USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
|
||||
|
@ -93,45 +93,21 @@ uint8_t Audio_Host_ConfigurePipes(USB_ClassInfo_Audio_Host_t* const AudioInterfa
|
|||
DataOUTEndpoint = EndpointData;
|
||||
}
|
||||
|
||||
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
|
||||
{
|
||||
uint16_t Size;
|
||||
uint8_t Type;
|
||||
uint8_t Token;
|
||||
uint8_t EndpointAddress;
|
||||
bool DoubleBanked;
|
||||
|
||||
if (PipeNum == AudioInterfaceInfo->Config.DataINPipeNumber)
|
||||
{
|
||||
Size = le16_to_cpu(DataINEndpoint->EndpointSize);
|
||||
EndpointAddress = DataINEndpoint->EndpointAddress;
|
||||
Token = PIPE_TOKEN_IN;
|
||||
Type = EP_TYPE_ISOCHRONOUS;
|
||||
DoubleBanked = true;
|
||||
|
||||
AudioInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
|
||||
}
|
||||
else if (PipeNum == AudioInterfaceInfo->Config.DataOUTPipeNumber)
|
||||
{
|
||||
Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
|
||||
EndpointAddress = DataOUTEndpoint->EndpointAddress;
|
||||
Token = PIPE_TOKEN_OUT;
|
||||
Type = EP_TYPE_ISOCHRONOUS;
|
||||
DoubleBanked = true;
|
||||
|
||||
AudioInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size,
|
||||
DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE)))
|
||||
{
|
||||
return AUDIO_ENUMERROR_PipeConfigurationFailed;
|
||||
}
|
||||
}
|
||||
AudioInterfaceInfo->Config.DataINPipe.Size = le16_to_cpu(DataINEndpoint->EndpointSize);
|
||||
AudioInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress;
|
||||
AudioInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_ISOCHRONOUS;
|
||||
AudioInterfaceInfo->Config.DataINPipe.Banks = 2;
|
||||
|
||||
AudioInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
|
||||
AudioInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress;
|
||||
AudioInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_ISOCHRONOUS;
|
||||
AudioInterfaceInfo->Config.DataOUTPipe.Banks = 2;
|
||||
|
||||
if (!(Pipe_ConfigurePipeTable(&AudioInterfaceInfo->Config.DataINPipe, 1)))
|
||||
return false;
|
||||
|
||||
if (!(Pipe_ConfigurePipeTable(&AudioInterfaceInfo->Config.DataOUTPipe, 1)))
|
||||
return false;
|
||||
|
||||
AudioInterfaceInfo->State.ControlInterfaceNumber = AudioControlInterface->InterfaceNumber;
|
||||
AudioInterfaceInfo->State.StreamingInterfaceNumber = AudioStreamingInterface->InterfaceNumber;
|
||||
|
|
|
@ -79,14 +79,8 @@
|
|||
{
|
||||
struct
|
||||
{
|
||||
uint8_t DataINPipeNumber; /**< Pipe number of the Audio interface's IN data pipe. If this interface should not
|
||||
* bind to an IN endpoint, this may be set to 0 to disable audio input streaming for
|
||||
* this driver instance.
|
||||
*/
|
||||
uint8_t DataOUTPipeNumber; /**< Pipe number of the Audio interface's OUT data pipe. If this interface should not
|
||||
* bind to an OUT endpoint, this may be set to 0 to disable audio output streaming for
|
||||
* this driver instance.
|
||||
*/
|
||||
USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */
|
||||
USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */
|
||||
} Config; /**< Config data for the USB class interface within the device. All elements in this section
|
||||
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
|
||||
*/
|
||||
|
@ -100,9 +94,6 @@
|
|||
uint8_t StreamingInterfaceNumber; /**< Interface index of the Audio Streaming interface within the attached device. */
|
||||
|
||||
uint8_t EnabledStreamingAltIndex; /**< Alternative setting index of the Audio Streaming interface when the stream is enabled. */
|
||||
|
||||
uint16_t DataINPipeSize; /**< Size in bytes of the Audio interface's IN data pipe. */
|
||||
uint16_t DataOUTPipeSize; /**< Size in bytes of the Audio interface's OUT data pipe. */
|
||||
} State; /**< State data for the USB class interface within the device. All elements in this section
|
||||
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
|
||||
* the interface is enumerated.
|
||||
|
@ -201,7 +192,7 @@
|
|||
|
||||
bool SampleReceived = false;
|
||||
|
||||
Pipe_SelectPipe(AudioInterfaceInfo->Config.DataINPipeNumber);
|
||||
Pipe_SelectPipe(AudioInterfaceInfo->Config.DataINPipe.Address);
|
||||
Pipe_Unfreeze();
|
||||
SampleReceived = Pipe_IsINReceived();
|
||||
Pipe_Freeze();
|
||||
|
@ -226,7 +217,7 @@
|
|||
if ((USB_HostState != HOST_STATE_Configured) || !(AudioInterfaceInfo->State.IsActive))
|
||||
return false;
|
||||
|
||||
Pipe_SelectPipe(AudioInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_SelectPipe(AudioInterfaceInfo->Config.DataOUTPipe.Address);
|
||||
return Pipe_IsOUTReady();
|
||||
}
|
||||
|
||||
|
|
|
@ -99,62 +99,26 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
|
|||
}
|
||||
}
|
||||
|
||||
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
|
||||
{
|
||||
uint16_t Size;
|
||||
uint8_t Type;
|
||||
uint8_t Token;
|
||||
uint8_t EndpointAddress;
|
||||
uint8_t InterruptPeriod;
|
||||
bool DoubleBanked;
|
||||
CDCInterfaceInfo->Config.DataINPipe.Size = le16_to_cpu(DataINEndpoint->EndpointSize);
|
||||
CDCInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress;
|
||||
CDCInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_BULK;
|
||||
|
||||
CDCInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
|
||||
CDCInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress;
|
||||
CDCInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK;
|
||||
|
||||
CDCInterfaceInfo->Config.NotificationPipe.Size = le16_to_cpu(NotificationEndpoint->EndpointSize);
|
||||
CDCInterfaceInfo->Config.NotificationPipe.EndpointAddress = NotificationEndpoint->EndpointAddress;
|
||||
CDCInterfaceInfo->Config.NotificationPipe.Type = EP_TYPE_INTERRUPT;
|
||||
|
||||
if (PipeNum == CDCInterfaceInfo->Config.DataINPipeNumber)
|
||||
{
|
||||
Size = le16_to_cpu(DataINEndpoint->EndpointSize);
|
||||
EndpointAddress = DataINEndpoint->EndpointAddress;
|
||||
Token = PIPE_TOKEN_IN;
|
||||
Type = EP_TYPE_BULK;
|
||||
DoubleBanked = CDCInterfaceInfo->Config.DataINPipeDoubleBank;
|
||||
InterruptPeriod = 0;
|
||||
if (!(Pipe_ConfigurePipeTable(&CDCInterfaceInfo->Config.DataINPipe, 1)))
|
||||
return false;
|
||||
|
||||
if (!(Pipe_ConfigurePipeTable(&CDCInterfaceInfo->Config.DataOUTPipe, 1)))
|
||||
return false;
|
||||
|
||||
CDCInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
|
||||
}
|
||||
else if (PipeNum == CDCInterfaceInfo->Config.DataOUTPipeNumber)
|
||||
{
|
||||
Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
|
||||
EndpointAddress = DataOUTEndpoint->EndpointAddress;
|
||||
Token = PIPE_TOKEN_OUT;
|
||||
Type = EP_TYPE_BULK;
|
||||
DoubleBanked = CDCInterfaceInfo->Config.DataOUTPipeDoubleBank;
|
||||
InterruptPeriod = 0;
|
||||
|
||||
CDCInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
|
||||
}
|
||||
else if (PipeNum == CDCInterfaceInfo->Config.NotificationPipeNumber)
|
||||
{
|
||||
Size = le16_to_cpu(NotificationEndpoint->EndpointSize);
|
||||
EndpointAddress = NotificationEndpoint->EndpointAddress;
|
||||
Token = PIPE_TOKEN_IN;
|
||||
Type = EP_TYPE_INTERRUPT;
|
||||
DoubleBanked = CDCInterfaceInfo->Config.NotificationPipeDoubleBank;
|
||||
InterruptPeriod = NotificationEndpoint->PollingIntervalMS;
|
||||
|
||||
CDCInterfaceInfo->State.NotificationPipeSize = NotificationEndpoint->EndpointSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size,
|
||||
DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE)))
|
||||
{
|
||||
return CDC_ENUMERROR_PipeConfigurationFailed;
|
||||
}
|
||||
|
||||
if (InterruptPeriod)
|
||||
Pipe_SetInterruptPeriod(InterruptPeriod);
|
||||
}
|
||||
if (!(Pipe_ConfigurePipeTable(&CDCInterfaceInfo->Config.NotificationPipe, 1)))
|
||||
return false;
|
||||
|
||||
CDCInterfaceInfo->State.ControlInterfaceNumber = CDCControlInterface->InterfaceNumber;
|
||||
CDCInterfaceInfo->State.ControlLineStates.HostToDevice = (CDC_CONTROL_LINE_OUT_RTS | CDC_CONTROL_LINE_OUT_DTR);
|
||||
|
@ -231,7 +195,7 @@ void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)
|
|||
if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))
|
||||
return;
|
||||
|
||||
Pipe_SelectPipe(CDCInterfaceInfo->Config.NotificationPipeNumber);
|
||||
Pipe_SelectPipe(CDCInterfaceInfo->Config.NotificationPipe.Address);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
if (Pipe_IsINReceived())
|
||||
|
@ -321,7 +285,7 @@ uint8_t CDC_Host_SendData(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
|
|||
|
||||
uint8_t ErrorCode;
|
||||
|
||||
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipe.Address);
|
||||
|
||||
Pipe_Unfreeze();
|
||||
ErrorCode = Pipe_Write_Stream_LE(Buffer, Length, NULL);
|
||||
|
@ -338,7 +302,7 @@ uint8_t CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
|
|||
|
||||
uint8_t ErrorCode;
|
||||
|
||||
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipe.Address);
|
||||
|
||||
Pipe_Unfreeze();
|
||||
ErrorCode = Pipe_Write_Stream_LE(String, strlen(String), NULL);
|
||||
|
@ -355,7 +319,7 @@ uint8_t CDC_Host_SendByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
|
|||
|
||||
uint8_t ErrorCode;
|
||||
|
||||
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipe.Address);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
if (!(Pipe_IsReadWriteAllowed()))
|
||||
|
@ -377,7 +341,7 @@ uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
|
|||
if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))
|
||||
return 0;
|
||||
|
||||
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipeNumber);
|
||||
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipe.Address);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
if (Pipe_IsINReceived())
|
||||
|
@ -409,7 +373,7 @@ int16_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)
|
|||
|
||||
int16_t ReceivedByte = -1;
|
||||
|
||||
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipeNumber);
|
||||
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipe.Address);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
if (Pipe_IsINReceived())
|
||||
|
@ -433,7 +397,7 @@ uint8_t CDC_Host_Flush(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)
|
|||
|
||||
uint8_t ErrorCode;
|
||||
|
||||
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipe.Address);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
if (!(Pipe_BytesInPipe()))
|
||||
|
|
|
@ -81,14 +81,9 @@
|
|||
{
|
||||
struct
|
||||
{
|
||||
uint8_t DataINPipeNumber; /**< Pipe number of the CDC interface's IN data pipe. */
|
||||
bool DataINPipeDoubleBank; /**< Indicates if the CDC interface's IN data pipe should use double banking. */
|
||||
|
||||
uint8_t DataOUTPipeNumber; /**< Pipe number of the CDC interface's OUT data pipe. */
|
||||
bool DataOUTPipeDoubleBank; /**< Indicates if the CDC interface's OUT data pipe should use double banking. */
|
||||
|
||||
uint8_t NotificationPipeNumber; /**< Pipe number of the CDC interface's IN notification endpoint, if used. */
|
||||
bool NotificationPipeDoubleBank; /**< Indicates if the CDC interface's notification pipe should use double banking. */
|
||||
USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */
|
||||
USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */
|
||||
USB_Pipe_Table_t NotificationPipe; /**< Notification IN Pipe configuration table. */
|
||||
} Config; /**< Config data for the USB class interface within the device. All elements in this section
|
||||
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
|
||||
*/
|
||||
|
@ -100,10 +95,6 @@
|
|||
*/
|
||||
uint8_t ControlInterfaceNumber; /**< Interface index of the CDC-ACM control interface within the attached device. */
|
||||
|
||||
uint16_t DataINPipeSize; /**< Size in bytes of the CDC interface's IN data pipe. */
|
||||
uint16_t DataOUTPipeSize; /**< Size in bytes of the CDC interface's OUT data pipe. */
|
||||
uint16_t NotificationPipeSize; /**< Size in bytes of the CDC interface's IN notification pipe, if used. */
|
||||
|
||||
struct
|
||||
{
|
||||
uint16_t HostToDevice; /**< Control line states from the host to device, as a set of \c CDC_CONTROL_LINE_OUT_*
|
||||
|
|
|
@ -94,55 +94,19 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
|
|||
DataOUTEndpoint = EndpointData;
|
||||
}
|
||||
|
||||
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
|
||||
{
|
||||
uint16_t Size;
|
||||
uint8_t Type;
|
||||
uint8_t Token;
|
||||
uint8_t EndpointAddress;
|
||||
uint8_t InterruptPeriod;
|
||||
bool DoubleBanked;
|
||||
|
||||
if (PipeNum == HIDInterfaceInfo->Config.DataINPipeNumber)
|
||||
{
|
||||
Size = le16_to_cpu(DataINEndpoint->EndpointSize);
|
||||
EndpointAddress = DataINEndpoint->EndpointAddress;
|
||||
Token = PIPE_TOKEN_IN;
|
||||
Type = EP_TYPE_INTERRUPT;
|
||||
DoubleBanked = HIDInterfaceInfo->Config.DataINPipeDoubleBank;
|
||||
InterruptPeriod = DataINEndpoint->PollingIntervalMS;
|
||||
|
||||
HIDInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
|
||||
}
|
||||
else if (PipeNum == HIDInterfaceInfo->Config.DataOUTPipeNumber)
|
||||
{
|
||||
if (DataOUTEndpoint == NULL)
|
||||
continue;
|
||||
|
||||
Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
|
||||
EndpointAddress = DataOUTEndpoint->EndpointAddress;
|
||||
Token = PIPE_TOKEN_OUT;
|
||||
Type = EP_TYPE_INTERRUPT;
|
||||
DoubleBanked = HIDInterfaceInfo->Config.DataOUTPipeDoubleBank;
|
||||
InterruptPeriod = DataOUTEndpoint->PollingIntervalMS;
|
||||
|
||||
HIDInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
|
||||
HIDInterfaceInfo->State.DeviceUsesOUTPipe = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size,
|
||||
DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE)))
|
||||
{
|
||||
return HID_ENUMERROR_PipeConfigurationFailed;
|
||||
}
|
||||
|
||||
if (InterruptPeriod)
|
||||
Pipe_SetInterruptPeriod(InterruptPeriod);
|
||||
}
|
||||
HIDInterfaceInfo->Config.DataINPipe.Size = le16_to_cpu(DataINEndpoint->EndpointSize);
|
||||
HIDInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress;
|
||||
HIDInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_INTERRUPT;
|
||||
|
||||
HIDInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
|
||||
HIDInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress;
|
||||
HIDInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_INTERRUPT;
|
||||
|
||||
if (!(Pipe_ConfigurePipeTable(&HIDInterfaceInfo->Config.DataINPipe, 1)))
|
||||
return false;
|
||||
|
||||
if (!(Pipe_ConfigurePipeTable(&HIDInterfaceInfo->Config.DataOUTPipe, 1)))
|
||||
return false;
|
||||
|
||||
HIDInterfaceInfo->State.InterfaceNumber = HIDInterface->InterfaceNumber;
|
||||
HIDInterfaceInfo->State.HIDReportSize = LE16_TO_CPU(HIDDescriptor->HIDReportLength);
|
||||
|
@ -227,7 +191,7 @@ uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo,
|
|||
|
||||
uint8_t ErrorCode;
|
||||
|
||||
Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipeNumber);
|
||||
Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipe.Address);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
uint16_t ReportSize;
|
||||
|
@ -277,7 +241,7 @@ uint8_t HID_Host_SendReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
|
|||
{
|
||||
uint8_t ErrorCode;
|
||||
|
||||
Pipe_SelectPipe(HIDInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_SelectPipe(HIDInterfaceInfo->Config.DataOUTPipe.Address);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
if (ReportID)
|
||||
|
@ -320,7 +284,7 @@ bool HID_Host_IsReportReceived(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo)
|
|||
|
||||
bool ReportReceived;
|
||||
|
||||
Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipeNumber);
|
||||
Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipe.Address);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
ReportReceived = Pipe_IsINReceived();
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue