diff options
author | Jack Humbert <jack.humb@gmail.com> | 2017-07-07 11:55:23 -0400 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2017-07-07 11:55:23 -0400 |
commit | 8655d4f4948b2deef7844503c8d690f23ac1a062 (patch) | |
tree | b2c6effc9d6cd5b5b43933a1e53b8bf17e9e82cf /lib/lufa/Projects/RelayBoard | |
parent | 1896c76a2928c96f9ab7947bec2ef8dd37623cff (diff) | |
parent | 60b30c036397cb5627fa374bb930794b225daa29 (diff) |
Merge commit '60b30c036397cb5627fa374bb930794b225daa29' as 'lib/lufa'
Diffstat (limited to 'lib/lufa/Projects/RelayBoard')
-rw-r--r-- | lib/lufa/Projects/RelayBoard/Config/LUFAConfig.h | 93 | ||||
-rw-r--r-- | lib/lufa/Projects/RelayBoard/Descriptors.c | 188 | ||||
-rw-r--r-- | lib/lufa/Projects/RelayBoard/Descriptors.h | 84 | ||||
-rw-r--r-- | lib/lufa/Projects/RelayBoard/RelayBoard.c | 145 | ||||
-rw-r--r-- | lib/lufa/Projects/RelayBoard/RelayBoard.h | 65 | ||||
-rw-r--r-- | lib/lufa/Projects/RelayBoard/RelayBoard.txt | 106 | ||||
-rw-r--r-- | lib/lufa/Projects/RelayBoard/asf.xml | 47 | ||||
-rw-r--r-- | lib/lufa/Projects/RelayBoard/doxyfile | 2395 | ||||
-rw-r--r-- | lib/lufa/Projects/RelayBoard/makefile | 43 |
9 files changed, 3166 insertions, 0 deletions
diff --git a/lib/lufa/Projects/RelayBoard/Config/LUFAConfig.h b/lib/lufa/Projects/RelayBoard/Config/LUFAConfig.h new file mode 100644 index 0000000000..4ffe5d9c11 --- /dev/null +++ b/lib/lufa/Projects/RelayBoard/Config/LUFAConfig.h @@ -0,0 +1,93 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2017. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2017 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 disclaims 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 LUFA Library Configuration Header File + * + * This header file is used to configure LUFA's compile time options, + * as an alternative to the compile time constants supplied through + * a makefile. + * + * For information on what each token does, refer to the LUFA + * manual section "Summary of Compile Tokens". + */ + +#ifndef _LUFA_CONFIG_H_ +#define _LUFA_CONFIG_H_ + + #if (ARCH == ARCH_AVR8) + + /* Non-USB Related Configuration Tokens: */ +// #define DISABLE_TERMINAL_CODES + + /* USB Class Driver Related Tokens: */ +// #define HID_HOST_BOOT_PROTOCOL_ONLY +// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here} +// #define HID_USAGE_STACK_DEPTH {Insert Value Here} +// #define HID_MAX_COLLECTIONS {Insert Value Here} +// #define HID_MAX_REPORTITEMS {Insert Value Here} +// #define HID_MAX_REPORT_IDS {Insert Value Here} +// #define NO_CLASS_DRIVER_AUTOFLUSH + + /* General USB Driver Related Tokens: */ +// #define ORDERED_EP_CONFIG + #define USE_STATIC_OPTIONS (USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL) + #define USB_DEVICE_ONLY +// #define USB_HOST_ONLY +// #define USB_STREAM_TIMEOUT_MS {Insert Value Here} +// #define NO_LIMITED_CONTROLLER_CONNECT +// #define NO_SOF_EVENTS + + /* USB Device Mode Driver Related Tokens: */ +// #define USE_RAM_DESCRIPTORS + #define USE_FLASH_DESCRIPTORS +// #define USE_EEPROM_DESCRIPTORS +// #define NO_INTERNAL_SERIAL + #define FIXED_CONTROL_ENDPOINT_SIZE 8 + #define DEVICE_STATE_AS_GPIOR 0 + #define FIXED_NUM_CONFIGURATIONS 1 + #define CONTROL_ONLY_DEVICE +// #define INTERRUPT_CONTROL_ENDPOINT +// #define NO_DEVICE_REMOTE_WAKEUP +// #define NO_DEVICE_SELF_POWER + + /* USB Host Mode Driver Related Tokens: */ +// #define HOST_STATE_AS_GPIOR 0 +// #define USB_HOST_TIMEOUT_MS {Insert Value Here} +// #define HOST_DEVICE_SETTLE_DELAY_MS {Insert Value Here} +// #define NO_AUTO_VBUS_MANAGEMENT +// #define INVERTED_VBUS_ENABLE_LINE + + #else + + #error Unsupported architecture for this LUFA configuration file. + + #endif +#endif diff --git a/lib/lufa/Projects/RelayBoard/Descriptors.c b/lib/lufa/Projects/RelayBoard/Descriptors.c new file mode 100644 index 0000000000..635e2ca7d8 --- /dev/null +++ b/lib/lufa/Projects/RelayBoard/Descriptors.c @@ -0,0 +1,188 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2017. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2010 OBinou (obconseil [at] gmail [dot] com) + Copyright 2017 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 disclaims 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 + * + * USB Device Descriptors, for library use when in USB device mode. Descriptors are special + * computer-readable structures which the host requests upon device enumeration, to determine + * the device's capabilities and functions. + */ + +#include "Descriptors.h" + +/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall + * device characteristics, including the supported USB version, control endpoint size and the + * number of device configurations. The descriptor is read out by the USB host when the enumeration + * process begins. + */ +const USB_Descriptor_Device_t PROGMEM RelayBoard_DeviceDescriptor = +{ + .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device}, + + .USBSpecification = VERSION_BCD(1,1,0), + .Class = USB_CSCP_VendorSpecificClass, + .SubClass = USB_CSCP_NoDeviceSubclass, + .Protocol = USB_CSCP_NoDeviceProtocol, + + .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, + + .VendorID = 0x04B4, + .ProductID = 0xFD11, + .ReleaseNumber = VERSION_BCD(2,0,0), + + .ManufacturerStrIndex = STRING_ID_Manufacturer, + .ProductStrIndex = STRING_ID_Product, + .SerialNumStrIndex = STRING_ID_Serial, + + .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS +}; + +/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage + * of the device in one of its supported configurations, including information about any device interfaces + * and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting + * a configuration so that the host may correctly communicate with the USB device. + */ +const USB_Descriptor_Configuration_t PROGMEM RelayBoard_ConfigurationDescriptor = +{ + .Config = + { + .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, + + .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), + .TotalInterfaces = 1, + + .ConfigurationNumber = 1, + .ConfigurationStrIndex = NO_DESCRIPTOR, + + .ConfigAttributes = USB_CONFIG_ATTR_RESERVED, + + .MaxPowerConsumption = USB_CONFIG_POWER_MA(500) + }, + + .RelayBoardInterface = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, + + .InterfaceNumber = INTERFACE_ID_RelayBoard, + .AlternateSetting = 0, + + .TotalEndpoints = 0, + + .Class = USB_CSCP_VendorSpecificClass, + .SubClass = 0x00, + .Protocol = 0x00, + + .InterfaceStrIndex = NO_DESCRIPTOR + }, +}; + +/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests + * the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate + * via the language ID table available at USB.org what languages the device supports for its string descriptors. + */ +const USB_Descriptor_String_t PROGMEM RelayBoard_LanguageString = +{ + .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String}, + + .UnicodeString = {LANGUAGE_ID_ENG} +}; + +/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable + * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device + * Descriptor. + */ +const USB_Descriptor_String_t PROGMEM RelayBoard_ManufacturerString = USB_STRING_DESCRIPTOR(L"SISPM"); + +/** Product descriptor string. This is a Unicode string containing the product's details in human readable form, + * and is read out upon request by the host when the appropriate string ID is requested, listed in the Device + * Descriptor. + */ +const USB_Descriptor_String_t PROGMEM RelayBoard_ProductString = USB_STRING_DESCRIPTOR(L"RelayBoard"); + +/** Serial number string. This is a Unicode string containing the device's unique serial number, expressed as a + * series of uppercase hexadecimal digits. + */ +const USB_Descriptor_String_t PROGMEM RelayBoard_SerialString = USB_STRING_DESCRIPTOR(L"00001"); + +/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors" + * documentation) by the application code so that the address and size of a requested descriptor can be given + * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function + * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the + * USB host. + */ +uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, + const uint16_t wIndex, + const void** const DescriptorAddress) +{ + const uint8_t DescriptorType = (wValue >> 8); + const uint8_t DescriptorNumber = (wValue & 0xFF); + + const void* Address = NULL; + uint16_t Size = NO_DESCRIPTOR; + + switch (DescriptorType) + { + case DTYPE_Device: + Address = &RelayBoard_DeviceDescriptor; + Size = sizeof(USB_Descriptor_Device_t); + break; + case DTYPE_Configuration: + Address = &RelayBoard_ConfigurationDescriptor; + Size = sizeof(USB_Descriptor_Configuration_t); + break; + case DTYPE_String: + switch (DescriptorNumber) + { + case STRING_ID_Language: + Address = &RelayBoard_LanguageString; + Size = pgm_read_byte(&RelayBoard_LanguageString.Header.Size); + break; + case STRING_ID_Manufacturer: + Address = &RelayBoard_ManufacturerString; + Size = pgm_read_byte(&RelayBoard_ManufacturerString.Header.Size); + break; + case STRING_ID_Product: + Address = &RelayBoard_ProductString; + Size = pgm_read_byte(&RelayBoard_ProductString.Header.Size); + break; + case STRING_ID_Serial: + Address = &RelayBoard_SerialString; + Size = pgm_read_byte(&RelayBoard_SerialString.Header.Size); + break; + } + + break; + } + + *DescriptorAddress = Address; + return Size; +} + diff --git a/lib/lufa/Projects/RelayBoard/Descriptors.h b/lib/lufa/Projects/RelayBoard/Descriptors.h new file mode 100644 index 0000000000..f763196a0d --- /dev/null +++ b/lib/lufa/Projects/RelayBoard/Descriptors.h @@ -0,0 +1,84 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2017. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2010 OBinou (obconseil [at] gmail [dot] com) + Copyright 2017 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 disclaims 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 + * + * Header file for Descriptors.c. + */ + +#ifndef _DESCRIPTORS_H_ +#define _DESCRIPTORS_H_ + + /* Includes: */ + #include <avr/pgmspace.h> + #include <LUFA/Drivers/USB/USB.h> + + /* Type Defines: */ + /** Type define for the device configuration descriptor structure. This must be defined in the + * application code, as the configuration descriptor contains several sub-descriptors which + * vary between devices, and which describe the device's usage to the host. + */ + typedef struct + { + USB_Descriptor_Configuration_Header_t Config; + + // Relay Board Interface + USB_Descriptor_Interface_t RelayBoardInterface; + } USB_Descriptor_Configuration_t; + + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_RelayBoard = 0, /**< Relay board interface descriptor ID */ + }; + + /** Enum for the device string descriptor IDs within the device. Each string descriptor should + * have a unique ID index associated with it, which can be used to refer to the string from + * other descriptors. + */ + enum StringDescriptors_t + { + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Serial = 3, /**< Serial number string ID */ + }; + + /* Function Prototypes: */ + uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, + const uint16_t wIndex, + const void** const DescriptorAddress) + ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); +#endif + diff --git a/lib/lufa/Projects/RelayBoard/RelayBoard.c b/lib/lufa/Projects/RelayBoard/RelayBoard.c new file mode 100644 index 0000000000..b69ee5710a --- /dev/null +++ b/lib/lufa/Projects/RelayBoard/RelayBoard.c @@ -0,0 +1,145 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2017. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2010 OBinou (obconseil [at] gmail [dot] com) + Copyright 2017 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 disclaims 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 + * + * Main source file for the RelayBoard program. This file contains the main tasks of + * the project and is responsible for the initial application hardware configuration. + */ + +#include "RelayBoard.h" + + +/** Main program entry point. This routine contains the overall program flow, including initial + * setup of all components and the main program loop. + */ +int main(void) +{ + SetupHardware(); + + GlobalInterruptEnable(); + + for (;;) + USB_USBTask(); +} + +/** Configures the board hardware and chip peripherals for the project's functionality. */ +void SetupHardware(void) +{ +#if (ARCH == ARCH_AVR8) + /* Disable watchdog if enabled by bootloader/fuses */ + MCUSR &= ~(1 << WDRF); + wdt_disable(); + + /* Disable clock division */ + clock_prescale_set(clock_div_1); +#endif + + /* Hardware Initialization */ + USB_Init(); + + /* Initialize Relays */ + DDRC |= ALL_RELAYS; + PORTC &= ~ALL_RELAYS; +} + +/** Event handler for the library USB Control Request reception event. */ +void EVENT_USB_Device_ControlRequest(void) +{ + const uint8_t SerialNumber[5] = { 0, 0, 0, 0, 1 }; + uint8_t ControlData[2] = { 0, 0 }; + + switch (USB_ControlRequest.bRequest) + { + case 0x09: + if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) + { + LEDs_ToggleLEDs(LEDS_LED1); + + Endpoint_ClearSETUP(); + + Endpoint_Read_Control_Stream_LE(ControlData, sizeof(ControlData)); + Endpoint_ClearIN(); + + switch (USB_ControlRequest.wValue) + { + case 0x303: + if (ControlData[1]) PORTC &= ~RELAY1; else PORTC |= RELAY1; + break; + case 0x306: + if (ControlData[1]) PORTC &= ~RELAY2; else PORTC |= RELAY2; + break; + case 0x309: + if (ControlData[1]) PORTC &= ~RELAY3; else PORTC |= RELAY3; + break; + case 0x30c: + if (ControlData[1]) PORTC &= ~RELAY4; else PORTC |= RELAY4; + break; + } + } + + break; + case 0x01: + if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) + { + LEDs_ToggleLEDs(LEDS_LED1); + + Endpoint_ClearSETUP(); + + switch (USB_ControlRequest.wValue) + { + case 0x301: + Endpoint_Write_Control_Stream_LE(SerialNumber, sizeof(SerialNumber)); + break; + case 0x303: + ControlData[1] = (PORTC & RELAY1) ? 2 : 3; + break; + case 0x306: + ControlData[1] = (PORTC & RELAY2) ? 2 : 3; + break; + case 0x309: + ControlData[1] = (PORTC & RELAY3) ? 2 : 3; + break; + case 0x30c: + ControlData[1] = (PORTC & RELAY4) ? 2 : 3; + break; + } + + if (ControlData[1]) + Endpoint_Write_Control_Stream_LE(ControlData, sizeof(ControlData)); + + Endpoint_ClearOUT(); + } + + break; + } +} + diff --git a/lib/lufa/Projects/RelayBoard/RelayBoard.h b/lib/lufa/Projects/RelayBoard/RelayBoard.h new file mode 100644 index 0000000000..31ea732982 --- /dev/null +++ b/lib/lufa/Projects/RelayBoard/RelayBoard.h @@ -0,0 +1,65 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2017. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2010 OBinou (obconseil [at] gmail [dot] com) + Copyright 2017 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 disclaims 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 + * + * Header file for RelayBoard.c. + */ + +#ifndef _RELAYBOARD_H_ +#define _RELAYBOARD_H_ + + /* Includes: */ + #include <avr/io.h> + #include <avr/wdt.h> + #include <avr/power.h> + #include <avr/interrupt.h> + + #include "Descriptors.h" + + #include <LUFA/Drivers/Board/LEDs.h> + #include <LUFA/Drivers/USB/USB.h> + #include <LUFA/Platform/Platform.h> + + /* Macros: */ + #define RELAY1 (1 << 7) + #define RELAY2 (1 << 6) + #define RELAY3 (1 << 5) + #define RELAY4 (1 << 4) + #define ALL_RELAYS (RELAY1 | RELAY2 | RELAY3 | RELAY4) + + /* Function Prototypes: */ + void SetupHardware(void); + + void EVENT_USB_Device_ControlRequest(void); + +#endif + diff --git a/lib/lufa/Projects/RelayBoard/RelayBoard.txt b/lib/lufa/Projects/RelayBoard/RelayBoard.txt new file mode 100644 index 0000000000..4b190dfe32 --- /dev/null +++ b/lib/lufa/Projects/RelayBoard/RelayBoard.txt @@ -0,0 +1,106 @@ +/** \file + * + * This file contains special DoxyGen information for the generation of the main page and other special + * documentation pages. It is not a project source file. + */ + +/** \mainpage OB's Quad-Relay outlet control using a Teensy2++ + * + * \section Sec_Compat Project Compatibility: + * + * The following list indicates what microcontrollers are compatible with this project. + * + * \li AT90USB1286 + * + * \section Sec_Info USB Information: + * + * The following table gives a rundown of the USB utilization of this project. + * + * <table> + * <tr> + * <td><b>USB Mode:</b></td> + * <td>Device</td> + * </tr> + * <tr> + * <td><b>USB Class:</b></td> + * <td>None</td> + * </tr> + * <tr> + * <td><b>USB Subclass:</b></td> + * <td>None</td> + * </tr> + * <tr> + * <td><b>Relevant Standards:</b></td> + * <td>USB Standards</td> + * </tr> + * <tr> + * <td><b>Supported USB Speeds:</b></td> + * <td>Low Speed Mode, Full Speed Mode</td> + * </tr> + * </table> + * + * \section Sec_Description Project Description: + * + * Firmware for a Teensy2++ AVR-based miniboard to control four relays, using the + * same protocol used by the commercially available Silver Shield PM power outlets + * ( http://sourceforge.net/projects/sispmctl ) sold for some time. Because this + * project mimics the original device, it can be controlled using the "sismpctl" + * package included in many Linux distributions - including router-orientated + * versions such as OpenWRT - to control the board's relays. + * + * Relays 1 to 4 are respectively wired to pins C4, C5, C6 and C7 of the Teensy++ V2, + * which are the PORTC bits 4 to 7 of the AT90USB1286. The relays MUST be wired through + * a transistor, and a diode must be added in antiparallel on the relay's coil pins to + * protect the transistor from back EMF generated from the relay when the coil is turned off. + * The transistor base pin is wired to the Teensy data port through a 10K resistor. A + * LED may be also be added as a relay status indicator on each channel. + * + * The Relay coil will be driven by the transistor, but the power will come from + * the 5V from the PC's USB port: Be careful in choosing the relay to avoid overloading + * the PC, as the maximum current used MUST remains under ~450mA @ 5V. + * + * The author's tested relays are 2 Finder 32.21.7.005.2000, coil il 125ohm, which can + * handle 5A @ 250VAC. Be careful to use proper isolation if high voltages are manipulated. + * The author used Hotglue to isolate all parts of the PCB in contact with high voltage. + * + * See <a>http://www.pjrc.com/teensy/</a> for the Teensy2++ website. + * + * <table> + * <tr> + * <td><b>Signal:</b></td> + * <td><b>AVR Port:</b></td> + * </tr> + * <tr> + * <td>Relay 1</td> + * <td>PORTC, Pin 4</td> + * </tr> + * <tr> + * <td>Relay 2</td> + * <td>PORTC, Pin 5</td> + * </tr> + * <tr> + * <td>Relay 3</td> + * <td>PORTC, Pin 6</td> + * </tr> + * <tr> + * <td>Relay 4</td> + * <td>PORTC, Pin 7</td> + * </tr> + * <tr> + * <td>Teensy2++ Yellow Led</td> + * <td>PORTD, pin 6</td> + * </tr> + * </table> + * + * \section Sec_Options Project Options + * + * The following defines can be found in this project, which can control the project behaviour when defined, or changed in value. + * + * <table> + * <tr> + * <td> + * None + * </td> + * </tr> + * </table> + */ diff --git a/lib/lufa/Projects/RelayBoard/asf.xml b/lib/lufa/Projects/RelayBoard/asf.xml new file mode 100644 index 0000000000..e3a2ef4b20 --- /dev/null +++ b/lib/lufa/Projects/RelayBoard/asf.xml @@ -0,0 +1,47 @@ +<asf xmlversion="1.0">
+ <project caption="Relay Board Controller" id="lufa.projects.relay_board.avr8">
+ <require idref="lufa.projects.relay_board"/>
+ <require idref="lufa.boards.dummy.avr8"/>
+ <generator value="as5_8"/>
+
+ <device-support value="at90usb1287"/>
+ <config name="lufa.drivers.board.name" value="usbkey"/>
+
+ <build type="define" name="F_CPU" value="8000000UL"/>
+ <build type="define" name="F_USB" value="8000000UL"/>
+ </project>
+
+ <module type="application" id="lufa.projects.relay_board" caption="Relay Board Controller">
+ <info type="description" value="summary">
+ Relay Board Controller project.
+ </info>
+
+ <info type="gui-flag" value="move-to-root"/>
+
+ <info type="keyword" value="Technology">
+ <keyword value="Low Level APIs"/>
+ <keyword value="USB Device"/>
+ </info>
+
+ <device-support-alias value="lufa_avr8"/>
+ <device-support-alias value="lufa_xmega"/>
+ <device-support-alias value="lufa_uc3"/>
+
+ <build type="distribute" subtype="user-file" value="doxyfile"/>
+ <build type="distribute" subtype="user-file" value="RelayBoard.txt"/>
+
+ <build type="c-source" value="RelayBoard.c"/>
+ <build type="c-source" value="Descriptors.c"/>
+ <build type="header-file" value="RelayBoard.h"/>
+ <build type="header-file" value="Descriptors.h"/>
+
+ <build type="module-config" subtype="path" value="Config"/>
+ <build type="header-file" value="Config/LUFAConfig.h"/>
+
+ <require idref="lufa.common"/>
+ <require idref="lufa.platform"/>
+ <require idref="lufa.drivers.usb"/>
+ <require idref="lufa.drivers.board"/>
+ <require idref="lufa.drivers.board.leds"/>
+ </module>
+</asf>
diff --git a/lib/lufa/Projects/RelayBoard/doxyfile b/lib/lufa/Projects/RelayBoard/doxyfile new file mode 100644 index 0000000000..12224900eb --- /dev/null +++ b/lib/lufa/Projects/RelayBoard/doxyfile @@ -0,0 +1,2395 @@ +# Doxyfile 1.8.9 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all text +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv +# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv +# for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = "OB's Dual-Relay Outlet Control Project" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = ./Documentation/ + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# |