aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-12-15 11:12:38 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-12-15 11:12:38 +0000
commit4f74075fad7f1e7a35d04ff534d9d6a57d2b97fc (patch)
tree22b46d9c6bb3a662e17476c2407ebf95c8ea4ba9
parent2f6c096050ee0057ccbff0ee87d58f72fae75748 (diff)
downloadlufa-4f74075fad7f1e7a35d04ff534d9d6a57d2b97fc.tar.gz
lufa-4f74075fad7f1e7a35d04ff534d9d6a57d2b97fc.tar.bz2
lufa-4f74075fad7f1e7a35d04ff534d9d6a57d2b97fc.zip
Speed up bit-banged USART code in the AVRISP project.
Fix project text files to refer to "project" instead of "demo".
-rw-r--r--Projects/AVRISP/AVRISP.txt16
-rw-r--r--Projects/AVRISP/Lib/NVMTarget.c1
-rw-r--r--Projects/AVRISP/Lib/PDITarget.c41
-rw-r--r--Projects/AVRISP/makefile2
-rw-r--r--Projects/Benito/Benito.txt8
-rw-r--r--Projects/Magstripe/Magstripe.txt12
-rw-r--r--Projects/MissileLauncher/MissileLauncher.txt10
-rw-r--r--Projects/USBtoSerial/USBtoSerial.txt14
-rw-r--r--Projects/XPLAINBridge/XPLAINBridge.txt10
9 files changed, 59 insertions, 55 deletions
diff --git a/Projects/AVRISP/AVRISP.txt b/Projects/AVRISP/AVRISP.txt
index 2de8dd2e7..35cf93770 100644
--- a/Projects/AVRISP/AVRISP.txt
+++ b/Projects/AVRISP/AVRISP.txt
@@ -6,9 +6,9 @@
/** \mainpage AVRISP MKII Programmer Project
*
- * \section SSec_Compat Demo Compatibility:
+ * \section SSec_Compat Project Compatibility:
*
- * The following list indicates what microcontrollers are compatible with this demo.
+ * The following list indicates what microcontrollers are compatible with this project.
*
* - Series 7 USB AVRs
* - Series 6 USB AVRs
@@ -17,7 +17,7 @@
*
* \section SSec_Info USB Information:
*
- * The following table gives a rundown of the USB utilization of this demo.
+ * The following table gives a rundown of the USB utilization of this project.
*
* <table>
* <tr>
@@ -67,7 +67,7 @@
* While this application can be compiled for USB AVRs with as little as 8KB of FLASH, for full functionality 16KB or more
* of FLASH is required. On 8KB devices, either ISP or PDI programming support can be disabled to reduce program size.
*
- *
+ * \section Sec_ISP ISP Connections
* Connections to the device for SPI programming (when enabled):
*
* <table>
@@ -111,7 +111,7 @@
* <b><sup>1</sup></b> <i>Optional, see \ref SSec_Options section - for USB AVRs with ADC modules only</i> \n
* <b><sup>2</sup></b> <i>See \ref SSec_Options section</i>
*
- *
+ * \section Sec_PDI PDI Connections
* Connections to the device for PDI programming<b><sup>1</sup></b> (when enabled):
*
* <table>
@@ -152,12 +152,12 @@
* </tr>
* </table>
*
- * <b><sup>1</sup></b> When PDI_VIA_HARDWARE_USART is set, the AVR's Tx and Rx become the DATA line when connected together
- * via a pair of 300 ohm resistors, and the AVR's XCK pin becomes CLOCK.
+ * <b><sup>1</sup></b> <i>When PDI_VIA_HARDWARE_USART is set, the AVR's Tx and Rx become the DATA line when connected together
+ * via a pair of 300 ohm resistors, and the AVR's XCK pin becomes CLOCK.</i>
*
* \section SSec_Options Project Options
*
- * The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
+ * The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
*
* <table>
* <tr>
diff --git a/Projects/AVRISP/Lib/NVMTarget.c b/Projects/AVRISP/Lib/NVMTarget.c
index 9402b2b8a..10a911ff3 100644
--- a/Projects/AVRISP/Lib/NVMTarget.c
+++ b/Projects/AVRISP/Lib/NVMTarget.c
@@ -182,7 +182,6 @@ bool NVMTarget_ReadMemory(uint32_t ReadAddress, uint8_t* ReadBuffer, uint16_t Re
* \param[in] WriteCommand Command to send to the device to write each memory byte
* \param[in] WriteAddress Start address to write to within the target's address space
* \param[in] WriteBuffer Buffer to source data from
- * \param[in] WriteSize Number of bytes to write
*
* \return Boolean true if the command sequence complete successfully
*/
diff --git a/Projects/AVRISP/Lib/PDITarget.c b/Projects/AVRISP/Lib/PDITarget.c
index 28df55021..1bbb4d577 100644
--- a/Projects/AVRISP/Lib/PDITarget.c
+++ b/Projects/AVRISP/Lib/PDITarget.c
@@ -45,9 +45,8 @@ volatile bool IsSending;
/** Software USART raw frame bits for transmission/reception. */
volatile uint16_t SoftUSART_Data;
-/** Bits remaining to be sent or received via the software USART. */
-volatile uint8_t SoftUSART_BitCount;
-
+/** Bits remaining to be sent or received via the software USART - set as a GPIOR for speed. */
+#define SoftUSART_BitCount GPIOR2
/** ISR to manage the software USART when bit-banged USART mode is selected. */
ISR(TIMER1_COMPA_vect, ISR_BLOCK)
@@ -59,21 +58,13 @@ ISR(TIMER1_COMPA_vect, ISR_BLOCK)
if (!(SoftUSART_BitCount))
return;
- /* Check to see if the current clock state is on the rising or falling edge */
- bool IsRisingEdge = (BITBANG_PDICLOCK_PORT & BITBANG_PDICLOCK_MASK);
-
- if (IsSending && !IsRisingEdge)
- {
- if (SoftUSART_Data & 0x01)
- BITBANG_PDIDATA_PORT |= BITBANG_PDIDATA_MASK;
- else
- BITBANG_PDIDATA_PORT &= ~BITBANG_PDIDATA_MASK;
-
- SoftUSART_Data >>= 1;
- SoftUSART_BitCount--;
- }
- else if (!IsSending && IsRisingEdge)
+ /* Check to see if we are at a rising or falling edge of the clock */
+ if (BITBANG_PDICLOCK_PORT & BITBANG_PDICLOCK_MASK)
{
+ /* If at rising clock edge and we are in send mode, abort */
+ if (IsSending)
+ return;
+
/* Wait for the start bit when receiving */
if ((SoftUSART_BitCount == BITS_IN_FRAME) && (BITBANG_PDIDATA_PIN & BITBANG_PDIDATA_MASK))
return;
@@ -84,6 +75,20 @@ ISR(TIMER1_COMPA_vect, ISR_BLOCK)
SoftUSART_Data >>= 1;
SoftUSART_BitCount--;
}
+ else
+ {
+ /* If at falling clock edge and we are in receive mode, abort */
+ if (!IsSending)
+ return;
+
+ if (SoftUSART_Data & 0x01)
+ BITBANG_PDIDATA_PORT |= BITBANG_PDIDATA_MASK;
+ else
+ BITBANG_PDIDATA_PORT &= ~BITBANG_PDIDATA_MASK;
+
+ SoftUSART_Data >>= 1;
+ SoftUSART_BitCount--;
+ }
}
#endif
@@ -120,7 +125,7 @@ void PDITarget_EnableTargetPDI(void)
asm volatile ("NOP"::);
/* Fire timer compare ISR every 100 cycles to manage the software USART */
- OCR1A = 100;
+ OCR1A = 80;
TCCR1B = (1 << WGM12) | (1 << CS10);
TIMSK1 = (1 << OCIE1A);
diff --git a/Projects/AVRISP/makefile b/Projects/AVRISP/makefile
index 23e27c52d..2b6a1e858 100644
--- a/Projects/AVRISP/makefile
+++ b/Projects/AVRISP/makefile
@@ -66,7 +66,7 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, USER or blank for projects not requiring
# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
-BOARD = XPLAIN
+BOARD = USBKEY
# Processor frequency.
diff --git a/Projects/Benito/Benito.txt b/Projects/Benito/Benito.txt
index 128fba37c..248ca7763 100644
--- a/Projects/Benito/Benito.txt
+++ b/Projects/Benito/Benito.txt
@@ -6,9 +6,9 @@
/** \mainpage Benito Arduino Programmer Project
*
- * \section SSec_Compat Demo Compatibility:
+ * \section SSec_Compat Project Compatibility:
*
- * The following list indicates what microcontrollers are compatible with this demo.
+ * The following list indicates what microcontrollers are compatible with this project.
*
* - Series 7 USB AVRs
* - Series 6 USB AVRs
@@ -17,7 +17,7 @@
*
* \section SSec_Info USB Information:
*
- * The following table gives a rundown of the USB utilization of this demo.
+ * The following table gives a rundown of the USB utilization of this project.
*
* <table>
* <tr>
@@ -58,7 +58,7 @@
*
* \section SSec_Options Project Options
*
- * The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
+ * The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
*
* <table>
* <tr>
diff --git a/Projects/Magstripe/Magstripe.txt b/Projects/Magstripe/Magstripe.txt
index 19586277a..41c6b6e86 100644
--- a/Projects/Magstripe/Magstripe.txt
+++ b/Projects/Magstripe/Magstripe.txt
@@ -6,16 +6,16 @@
/** \mainpage Denver Gingerich's USBSnoop Magnetic Card Reader Project
*
- * \section SSec_Compat Demo Compatibility:
+ * \section SSec_Compat Project Compatibility:
*
- * The following list indicates what microcontrollers are compatible with this demo.
+ * The following list indicates what microcontrollers are compatible with this project.
*
* - AT90USB1287
* - AT90USB1286
*
* \section SSec_Info USB Information:
*
- * The following table gives a rundown of the USB utilization of this demo.
+ * The following table gives a rundown of the USB utilization of this project.
*
* <table>
* <tr>
@@ -87,17 +87,17 @@
* </tr>
* </table>
*
- * This project is based on the LUFA Keyboard demonstration application,
+ * This project is based on the LUFA Keyboard projectnstration application,
* written by Denver Gingerich.
*
* This application uses a keyboard HID driver to communicate the data collected
* a TTL magnetic stripe reader to the connected computer. The raw bitstream
* obtained from the magnetic stripe reader is "typed" through the keyboard
- * driver as 0's and 1's. After every card swipe, the demo will send a return key.
+ * driver as 0's and 1's. After every card swipe, the project will send a return key.
*
* \section SSec_Options Project Options
*
- * The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
+ * The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
*
* <table>
* <tr>
diff --git a/Projects/MissileLauncher/MissileLauncher.txt b/Projects/MissileLauncher/MissileLauncher.txt
index 1dfff2f99..519410ef1 100644
--- a/Projects/MissileLauncher/MissileLauncher.txt
+++ b/Projects/MissileLauncher/MissileLauncher.txt
@@ -4,17 +4,17 @@
* documentation pages. It is not a project source file.
*/
-/** \mainpage Missile Launcher
+/** \mainpage David Fletcher's Missile Launcher
*
- * \section SSec_Compat Demo Compatibility:
+ * \section SSec_Compat Project Compatibility:
*
- * The following list indicates what microcontrollers are compatible with this demo.
+ * The following list indicates what microcontrollers are compatible with this project.
*
* - Series 7 USB AVRs
*
* \section SSec_Info USB Information:
*
- * The following table gives a rundown of the USB utilization of this demo.
+ * The following table gives a rundown of the USB utilization of this project.
*
* <table>
* <tr>
@@ -47,7 +47,7 @@
*
* \section SSec_Options Project Options
*
- * The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
+ * The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
*
* <table>
* <tr>
diff --git a/Projects/USBtoSerial/USBtoSerial.txt b/Projects/USBtoSerial/USBtoSerial.txt
index f5378cced..10f0003c6 100644
--- a/Projects/USBtoSerial/USBtoSerial.txt
+++ b/Projects/USBtoSerial/USBtoSerial.txt
@@ -4,11 +4,11 @@
* documentation pages. It is not a project source file.
*/
-/** \mainpage USB to Serial Converter Project (via CDC-ACM class)
+/** \mainpage USB to Serial Converter Project
*
- * \section SSec_Compat Demo Compatibility:
+ * \section SSec_Compat Project Compatibility:
*
- * The following list indicates what microcontrollers are compatible with this demo.
+ * The following list indicates what microcontrollers are compatible with this project.
*
* - Series 7 USB AVRs
* - Series 6 USB AVRs
@@ -17,7 +17,7 @@
*
* \section SSec_Info USB Information:
*
- * The following table gives a rundown of the USB utilization of this demo.
+ * The following table gives a rundown of the USB utilization of this project.
*
* <table>
* <tr>
@@ -55,8 +55,8 @@
* error rates at the AVR's clock speed, data lengths other than 6, 7 or 8 bits,
* 1.5 stop bits, parity other than none, even or odd).
*
- * After running this demo for the first time on a new computer,
- * you will need to supply the .INF file located in this demo
+ * After running this project for the first time on a new computer,
+ * you will need to supply the .INF file located in this project
* project's directory as the device's driver when running under
* Windows. This will enable Windows to use its inbuilt CDC drivers,
* negating the need for custom drivers for the device. Other
@@ -65,7 +65,7 @@
*
* \section SSec_Options Project Options
*
- * The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
+ * The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
*
* <table>
* <tr>
diff --git a/Projects/XPLAINBridge/XPLAINBridge.txt b/Projects/XPLAINBridge/XPLAINBridge.txt
index e90a2d614..ec6eee7eb 100644
--- a/Projects/XPLAINBridge/XPLAINBridge.txt
+++ b/Projects/XPLAINBridge/XPLAINBridge.txt
@@ -6,15 +6,15 @@
/** \mainpage XPLAIN UART Bridge Project
*
- * \section SSec_Compat Demo Compatibility:
+ * \section SSec_Compat Project Compatibility:
*
- * The following list indicates what microcontrollers are compatible with this demo.
+ * The following list indicates what microcontrollers are compatible with this project.
*
* - AT90USB1287
*
* \section SSec_Info USB Information:
*
- * The following table gives a rundown of the USB utilization of this demo.
+ * The following table gives a rundown of the USB utilization of this project.
*
* <table>
* <tr>
@@ -46,14 +46,14 @@
* host. When inserted, the device will enumerate as a regular COM port on the host, which can then be opened and data exchanged
* between the XMEGA and Host as if the XMEGA was connected directly to the host's serial port.
*
- * After running this demo for the first time on a new computer, you will need to supply the .INF file located in this demo
+ * After running this project for the first time on a new computer, you will need to supply the .INF file located in this project
* project's directory as the device's driver when running under Windows. This will enable Windows to use its inbuilt CDC drivers,
* negating the need for custom drivers for the device. Other Operating Systems should automatically use their own inbuilt CDC-ACM
* drivers.
*
* \section SSec_Options Project Options
*
- * The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
+ * The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
*
* <table>
* <tr>