projects
/
pub
/
USBasp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8a68203
)
Fix unfinished printer host demo - some printer languages use embedded NULLs and...
author
Dean Camera
<dean@fourwalledcubicle.com>
Mon, 20 Jul 2009 02:59:16 +0000
(
02:59
+0000)
committer
Dean Camera
<dean@fourwalledcubicle.com>
Mon, 20 Jul 2009 02:59:16 +0000
(
02:59
+0000)
Demos/Host/Incomplete/PrinterHost/Lib/PrinterCommands.c
patch
|
blob
|
blame
|
history
Demos/Host/Incomplete/PrinterHost/Lib/PrinterCommands.h
patch
|
blob
|
blame
|
history
Demos/Host/Incomplete/PrinterHost/PrinterHost.c
patch
|
blob
|
blame
|
history
Demos/Host/LowLevel/StillImageHost/StillImageHost.c
patch
|
blob
|
blame
|
history
diff --git
a/Demos/Host/Incomplete/PrinterHost/Lib/PrinterCommands.c
b/Demos/Host/Incomplete/PrinterHost/Lib/PrinterCommands.c
index
668421d
..
03d3070
100644
(file)
--- a/
Demos/Host/Incomplete/PrinterHost/Lib/PrinterCommands.c
+++ b/
Demos/Host/Incomplete/PrinterHost/Lib/PrinterCommands.c
@@
-37,14
+37,14
@@
*
\r
* \return A value from the Pipe_Stream_RW_ErrorCodes_t enum
\r
*/
\r
*
\r
* \return A value from the Pipe_Stream_RW_ErrorCodes_t enum
\r
*/
\r
-uint8_t Printer_SendData(char* PrinterCommands)
\r
+uint8_t Printer_SendData(char* PrinterCommands
, uint16_t DataLength
)
\r
{
\r
uint8_t ErrorCode;
\r
\r
Pipe_SelectPipe(PRINTER_DATA_OUT_PIPE);
\r
Pipe_Unfreeze();
\r
\r
{
\r
uint8_t ErrorCode;
\r
\r
Pipe_SelectPipe(PRINTER_DATA_OUT_PIPE);
\r
Pipe_Unfreeze();
\r
\r
- if ((ErrorCode = Pipe_Write_Stream_LE(PrinterCommands,
strlen(PrinterCommands)
)) != PIPE_RWSTREAM_NoError)
\r
+ if ((ErrorCode = Pipe_Write_Stream_LE(PrinterCommands,
DataLength
)) != PIPE_RWSTREAM_NoError)
\r
return ErrorCode;
\r
\r
Pipe_ClearOUT();
\r
return ErrorCode;
\r
\r
Pipe_ClearOUT();
\r
diff --git
a/Demos/Host/Incomplete/PrinterHost/Lib/PrinterCommands.h
b/Demos/Host/Incomplete/PrinterHost/Lib/PrinterCommands.h
index
01f1f14
..
b296d86
100644
(file)
--- a/
Demos/Host/Incomplete/PrinterHost/Lib/PrinterCommands.h
+++ b/
Demos/Host/Incomplete/PrinterHost/Lib/PrinterCommands.h
@@
-54,7
+54,7
@@
#define PRINTER_DATA_OUT_PIPE 2
\r
\r
/* Function Prototypes: */
\r
#define PRINTER_DATA_OUT_PIPE 2
\r
\r
/* Function Prototypes: */
\r
- uint8_t Printer_SendData(char* PrinterCommands);
\r
+ uint8_t Printer_SendData(char* PrinterCommands
, uint16_t DataLength
);
\r
uint8_t Printer_GetDeviceID(char* DeviceIDString, uint8_t BufferSize);
\r
uint8_t Printer_GetPortStatus(uint8_t* PortStatus);
\r
uint8_t Printer_SoftReset(void);
\r
uint8_t Printer_GetDeviceID(char* DeviceIDString, uint8_t BufferSize);
\r
uint8_t Printer_GetPortStatus(uint8_t* PortStatus);
\r
uint8_t Printer_SoftReset(void);
\r
diff --git
a/Demos/Host/Incomplete/PrinterHost/PrinterHost.c
b/Demos/Host/Incomplete/PrinterHost/PrinterHost.c
index
2200465
..
bff5e20
100644
(file)
--- a/
Demos/Host/Incomplete/PrinterHost/PrinterHost.c
+++ b/
Demos/Host/Incomplete/PrinterHost/PrinterHost.c
@@
-207,9
+207,9
@@
void USB_Printer_Host(void)
char PCL_Test_Page[] = "\033%-12345X\033E LUFA PCL Test Page \033E\033%-12345X";
\r
// char ESCP2_Test_Page[] = "\033@\033i\001\033X\001\060\000\r\nLUFA ESCP/2 Test Page\r\n";
\r
\r
char PCL_Test_Page[] = "\033%-12345X\033E LUFA PCL Test Page \033E\033%-12345X";
\r
// char ESCP2_Test_Page[] = "\033@\033i\001\033X\001\060\000\r\nLUFA ESCP/2 Test Page\r\n";
\r
\r
- printf_P(PSTR("Sending Test Page (%d bytes)...\r\n"),
strlen(PCL_Test_Page
));
\r
+ printf_P(PSTR("Sending Test Page (%d bytes)...\r\n"),
(sizeof(PCL_Test_Page) - 1
));
\r
\r
\r
- if ((ErrorCode = Printer_SendData(PCL_Test_Page)) != PIPE_RWSTREAM_NoError)
\r
+ if ((ErrorCode = Printer_SendData(PCL_Test_Page
, (sizeof(PCL_Test_Page) - 1)
)) != PIPE_RWSTREAM_NoError)
\r
{
\r
puts_P(PSTR(ESC_FG_RED "Error Sending Test Page.\r\n"));
\r
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
\r
{
\r
puts_P(PSTR(ESC_FG_RED "Error Sending Test Page.\r\n"));
\r
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
\r
diff --git
a/Demos/Host/LowLevel/StillImageHost/StillImageHost.c
b/Demos/Host/LowLevel/StillImageHost/StillImageHost.c
index
dfc7cb7
..
5cfaf46
100644
(file)
--- a/
Demos/Host/LowLevel/StillImageHost/StillImageHost.c
+++ b/
Demos/Host/LowLevel/StillImageHost/StillImageHost.c
@@
-352,7
+352,7
@@
void UnicodeToASCII(uint8_t* UnicodeString, char* Buffer)
/* Loop through the entire unicode string */
\r
while (CharactersRemaining--)
\r
{
\r
/* Loop through the entire unicode string */
\r
while (CharactersRemaining--)
\r
{
\r
- /* Load in the next unicode character (only the lower byte,
only Unicode coded ASCII
supported) */
\r
+ /* Load in the next unicode character (only the lower byte,
as only Unicode coded ASCII is
supported) */
\r
*(Buffer++) = *UnicodeString;
\r
\r
/* Jump to the next unicode character */
\r
*(Buffer++) = *UnicodeString;
\r
\r
/* Jump to the next unicode character */
\r