diff options
author | Dean Camera <[email protected]> | 2011-01-30 21:02:31 +0000 |
---|---|---|
committer | Dean Camera <[email protected]> | 2011-01-30 21:02:31 +0000 |
commit | 43c473530552acabcf5bb1db29555bfb5ea70b79 (patch) | |
tree | b67e5b8295633262ed839e1c74f81a65b4dd59ea /LUFA/Drivers/USB/Class/Host/Printer.c | |
parent | afd828c095f38753e989391eab670b8736e4bd6e (diff) | |
download | qmk_firmware-43c473530552acabcf5bb1db29555bfb5ea70b79.tar.gz qmk_firmware-43c473530552acabcf5bb1db29555bfb5ea70b79.zip |
Renamed the PRNT_Host_SendString(), CDC_Host_SendString() and CDC_Device_SendString() functions to *_SendData(), and added new versions of the *_SendString() routines that expect a null terminated string instead.
Added new Serial_SendData() function to the Serial driver.
Diffstat (limited to 'LUFA/Drivers/USB/Class/Host/Printer.c')
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/Printer.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/LUFA/Drivers/USB/Class/Host/Printer.c b/LUFA/Drivers/USB/Class/Host/Printer.c index 3994b97318..a086a53dfe 100644 --- a/LUFA/Drivers/USB/Class/Host/Printer.c +++ b/LUFA/Drivers/USB/Class/Host/Printer.c @@ -287,8 +287,31 @@ uint8_t PRNT_Host_SendByte(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, } uint8_t PRNT_Host_SendString(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, - void* Buffer, - const uint16_t Length) + void* String) +{ + uint8_t ErrorCode; + + if ((USB_HostState != HOST_STATE_Configured) || !(PRNTInterfaceInfo->State.IsActive)) + return PIPE_RWSTREAM_DeviceDisconnected; + + Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipeNumber); + Pipe_Unfreeze(); + + if ((ErrorCode = Pipe_Write_Stream_LE(String, strlen(String), NULL)) != PIPE_RWSTREAM_NoError) + return ErrorCode; + + Pipe_ClearOUT(); + + ErrorCode = Pipe_WaitUntilReady(); + + Pipe_Freeze(); + + return ErrorCode; +} + +uint8_t PRNT_Host_SendData(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, + void* Buffer, + const uint16_t Length) { uint8_t ErrorCode; |