Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lufa
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Erik Strand
lufa
Commits
9ea891ea
Commit
9ea891ea
authored
15 years ago
by
Dean Camera
Browse files
Options
Downloads
Patches
Plain Diff
Use clearer buffer names in the USBtoSerial project to prevent confusion.
parent
cf610c5c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Projects/USBtoSerial/USBtoSerial.c
+11
-11
11 additions, 11 deletions
Projects/USBtoSerial/USBtoSerial.c
with
11 additions
and
11 deletions
Projects/USBtoSerial/USBtoSerial.c
+
11
−
11
View file @
9ea891ea
...
@@ -37,10 +37,10 @@
...
@@ -37,10 +37,10 @@
#include
"USBtoSerial.h"
#include
"USBtoSerial.h"
/** Circular buffer to hold data from the host before it is sent to the device via the serial port. */
/** Circular buffer to hold data from the host before it is sent to the device via the serial port. */
RingBuff_t
Rx
_Buffer
;
RingBuff_t
USBtoUSART
_Buffer
;
/** Circular buffer to hold data from the serial port before it is sent to the host. */
/** Circular buffer to hold data from the serial port before it is sent to the host. */
RingBuff_t
Tx
_Buffer
;
RingBuff_t
USARTtoUSB
_Buffer
;
/** LUFA CDC Class driver interface configuration and state information. This structure is
/** LUFA CDC Class driver interface configuration and state information. This structure is
* passed to all CDC Class driver functions, so that multiple instances of the same class
* passed to all CDC Class driver functions, so that multiple instances of the same class
...
@@ -70,8 +70,8 @@ int main(void)
...
@@ -70,8 +70,8 @@ int main(void)
{
{
SetupHardware
();
SetupHardware
();
Buffer_Initialize
(
&
Rx
_Buffer
);
Buffer_Initialize
(
&
USBtoUSART
_Buffer
);
Buffer_Initialize
(
&
Tx
_Buffer
);
Buffer_Initialize
(
&
USARTtoUSB
_Buffer
);
LEDs_SetAllLEDs
(
LEDMASK_USB_NOTREADY
);
LEDs_SetAllLEDs
(
LEDMASK_USB_NOTREADY
);
...
@@ -80,19 +80,19 @@ int main(void)
...
@@ -80,19 +80,19 @@ int main(void)
/* Read bytes from the USB OUT endpoint into the USART transmit buffer */
/* Read bytes from the USB OUT endpoint into the USART transmit buffer */
for
(
uint8_t
DataBytesRem
=
CDC_Device_BytesReceived
(
&
VirtualSerial_CDC_Interface
);
DataBytesRem
!=
0
;
DataBytesRem
--
)
for
(
uint8_t
DataBytesRem
=
CDC_Device_BytesReceived
(
&
VirtualSerial_CDC_Interface
);
DataBytesRem
!=
0
;
DataBytesRem
--
)
{
{
if
(
!
(
BUFF_STATICSIZE
-
Rx
_Buffer
.
Elements
))
if
(
!
(
BUFF_STATICSIZE
-
USBtoUSART
_Buffer
.
Elements
))
break
;
break
;
Buffer_StoreElement
(
&
Rx
_Buffer
,
CDC_Device_ReceiveByte
(
&
VirtualSerial_CDC_Interface
));
Buffer_StoreElement
(
&
USBtoUSART
_Buffer
,
CDC_Device_ReceiveByte
(
&
VirtualSerial_CDC_Interface
));
}
}
/* Read bytes from the USART receive buffer into the USB IN endpoint */
/* Read bytes from the USART receive buffer into the USB IN endpoint */
if
(
Tx
_Buffer
.
Elements
)
if
(
USARTtoUSB
_Buffer
.
Elements
)
CDC_Device_SendByte
(
&
VirtualSerial_CDC_Interface
,
Buffer_GetElement
(
&
Tx
_Buffer
));
CDC_Device_SendByte
(
&
VirtualSerial_CDC_Interface
,
Buffer_GetElement
(
&
USARTtoUSB
_Buffer
));
/* Load bytes from the USART transmit buffer into the USART */
/* Load bytes from the USART transmit buffer into the USART */
if
(
Rx
_Buffer
.
Elements
)
if
(
USBtoUSART
_Buffer
.
Elements
)
Serial_TxByte
(
Buffer_GetElement
(
&
Rx
_Buffer
));
Serial_TxByte
(
Buffer_GetElement
(
&
USBtoUSART
_Buffer
));
CDC_Device_USBTask
(
&
VirtualSerial_CDC_Interface
);
CDC_Device_USBTask
(
&
VirtualSerial_CDC_Interface
);
USB_USBTask
();
USB_USBTask
();
...
@@ -150,7 +150,7 @@ ISR(USART1_RX_vect, ISR_BLOCK)
...
@@ -150,7 +150,7 @@ ISR(USART1_RX_vect, ISR_BLOCK)
uint8_t
ReceivedByte
=
UDR1
;
uint8_t
ReceivedByte
=
UDR1
;
if
(
USB_DeviceState
==
DEVICE_STATE_Configured
)
if
(
USB_DeviceState
==
DEVICE_STATE_Configured
)
Buffer_StoreElement
(
&
Tx
_Buffer
,
ReceivedByte
);
Buffer_StoreElement
(
&
USARTtoUSB
_Buffer
,
ReceivedByte
);
}
}
/** Event handler for the CDC Class driver Line Encoding Changed event.
/** Event handler for the CDC Class driver Line Encoding Changed event.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment