| Line No. | Rev | Author | Line |
|---|---|---|---|
| 1 | 32 | kaklik | /***************************************************************************** |
| 2 | |||
| 3 | Microchip USB Host Printer Client Driver, Graphics Library Interfaces Layer |
||
| 4 | |||
| 5 | Summary: |
||
| 6 | This file contains the routines needed to utilize the Microchip Graphics |
||
| 7 | Library functions to create graphic images on a USB printer. |
||
| 8 | |||
| 9 | Description: |
||
| 10 | This file contains the routines needed to utilize the Microchip Graphics |
||
| 11 | Library functions to create graphic images on a USB printer. |
||
| 12 | |||
| 13 | The label USE_GRAPHICS_LIBRARY_PRINTER_INTERFACE must be defining in the |
||
| 14 | USB configuration header file usb_config.h to utilize these functions. |
||
| 15 | |||
| 16 | Remarks: |
||
| 17 | None |
||
| 18 | |||
| 19 | ******************************************************************************/ |
||
| 20 | //DOM-IGNORE-BEGIN |
||
| 21 | /****************************************************************************** |
||
| 22 | |||
| 23 | * FileName: usb_host_printer_primitives.c |
||
| 24 | * Dependencies: None |
||
| 25 | * Processor: PIC24/dsPIC30/dsPIC33/PIC32MX |
||
| 26 | * Compiler: C30 v3.10b/C32 v1.02 |
||
| 27 | * Company: Microchip Technology, Inc. |
||
| 28 | |||
| 29 | Software License Agreement |
||
| 30 | |||
| 31 | The software supplied herewith by Microchip Technology Incorporated |
||
| 32 | (the Company) for its PICmicro® Microcontroller is intended and |
||
| 33 | supplied to you, the Companys customer, for use solely and |
||
| 34 | exclusively on Microchip PICmicro Microcontroller products. The |
||
| 35 | software is owned by the Company and/or its supplier, and is |
||
| 36 | protected under applicable copyright laws. All rights are reserved. |
||
| 37 | Any use in violation of the foregoing restrictions may subject the |
||
| 38 | user to criminal sanctions under applicable laws, as well as to |
||
| 39 | civil liability for the breach of the terms and conditions of this |
||
| 40 | license. |
||
| 41 | |||
| 42 | THIS SOFTWARE IS PROVIDED IN AN AS IS CONDITION. NO WARRANTIES, |
||
| 43 | WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED |
||
| 44 | TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
||
| 45 | PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, |
||
| 46 | IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR |
||
| 47 | CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. |
||
| 48 | |||
| 49 | Change History: |
||
| 50 | Rev Description |
||
| 51 | ----- ----------------------------------- |
||
| 52 | 2.6a- No change |
||
| 53 | 2.7a |
||
| 54 | *******************************************************************************/ |
||
| 55 | //DOM-IGNORE-END |
||
| 56 | |||
| 57 | #ifndef _USB_HOST_PRINTER_PRIMITIVES_H |
||
| 58 | #define _USB_HOST_PRINTER_PRIMITIVES_H |
||
| 59 | |||
| 60 | |||
| 61 | #include "GenericTypedefs.h" |
||
| 62 | #include "USB\usb.h" |
||
| 63 | #include "USB\usb_host_printer.h" |
||
| 64 | |||
| 65 | |||
| 66 | // ***************************************************************************** |
||
| 67 | // ***************************************************************************** |
||
| 68 | // Section: USB Data Structures |
||
| 69 | // ***************************************************************************** |
||
| 70 | // ***************************************************************************** |
||
| 71 | |||
| 72 | // ***************************************************************************** |
||
| 73 | /* Print Screen Information |
||
| 74 | |||
| 75 | This structure is designed for use when the USB Embedded Host Printer support |
||
| 76 | is integrated with the graphics library. The structure contains the information |
||
| 77 | needed to print a portion of the graphics screen as a bitmapped graphic image. |
||
| 78 | */ |
||
| 79 | typedef struct |
||
| 80 | { |
||
| 81 | WORD xL; // X-axis position of the left side of the screen image. |
||
| 82 | WORD yT; // Y-axis position of the top of the screen image. |
||
| 83 | WORD xR; // X-axis position of the right side of the screen image. |
||
| 84 | WORD yB; // Y-axis position of the bottom of the screen image. |
||
| 85 | WORD colorBlack; // Screen color that should be printed as black. |
||
| 86 | USB_PRINTER_FUNCTION_SUPPORT printerType; // The capabilities of the |
||
| 87 | // current printer, so we know |
||
| 88 | // what structure members are |
||
| 89 | // valid. |
||
| 90 | USB_PRINTER_IMAGE_INFO printerInfo; // Store all the info needed to print |
||
| 91 | // the image. The width and height |
||
| 92 | // parameters will be determined by |
||
| 93 | // the screen coordinates specified |
||
| 94 | // above. The application must |
||
| 95 | // provide the other values. |
||
| 96 | } USB_PRINT_SCREEN_INFO; |
||
| 97 | |||
| 98 | |||
| 99 | // ***************************************************************************** |
||
| 100 | // ***************************************************************************** |
||
| 101 | // Section: Subroutines |
||
| 102 | // ***************************************************************************** |
||
| 103 | // ***************************************************************************** |
||
| 104 | |||
| 105 | /**************************************************************************** |
||
| 106 | Function: |
||
| 107 | SHORT PrintScreen( BYTE address, USB_PRINT_SCREEN_INFO *printScreenInfo ) |
||
| 108 | |||
| 109 | Summary: |
||
| 110 | This routine will extract the image that is currently on the specified |
||
| 111 | portion of the graphics display, and print it at the specified location. |
||
| 112 | |||
| 113 | Description: |
||
| 114 | This routine is intended for use in an application that is using the |
||
| 115 | Graphics Library to control a graphics display. This routine will |
||
| 116 | extract the image that is currently on the specified portion of |
||
| 117 | the graphics display, and print it at the specified location. |
||
| 118 | Since the display may be in color and the printer can print only black |
||
| 119 | and white, the pixel color to interpret as black must be specified in the |
||
| 120 | USB_PRINT_SCREEN_INFO structure. |
||
| 121 | |||
| 122 | The function can be compiled as either a blocking function or a |
||
| 123 | non-blocking function. When compiled as a blocking function, the routine |
||
| 124 | will wait to enqueue all printer instructions. If an error occurs, then |
||
| 125 | this function will return the error. If all printer instructions are |
||
| 126 | enqueued successfully, the function will return -1. When compiled as a |
||
| 127 | non-blocking function, this function will return 0 if the operation is |
||
| 128 | proceeding correctly but has not yet completed. The application must |
||
| 129 | continue to call this function, with the same parameters, until a |
||
| 130 | non-zero value is returned. A value of -1 indicates that all printer |
||
| 131 | instructions have been enqueued successfully. Any other value is an error |
||
| 132 | code, and the state machine will be set back to the beginning state. |
||
| 133 | |||
| 134 | Precondition: |
||
| 135 | None |
||
| 136 | |||
| 137 | Parameters: |
||
| 138 | BYTE address - USB address of the printer. |
||
| 139 | USB_PRINT_SCREEN_INFO *printScreenInfo - Information about the screen |
||
| 140 | area to print, how to interpret the screen image, |
||
| 141 | and how and where to print the image. Note that |
||
| 142 | the width and height members of the structure do |
||
| 143 | not need to be filled in by the application. |
||
| 144 | |||
| 145 | Return Values: |
||
| 146 | |||
| 147 | complete, but is proceeding normally. |
||
| 148 | (-1) - Image output was completed successfully. |
||
| 149 | other - Printing was aborted due to an error. See the return values |
||
| 150 | for USBHostPrinterCommand(). Note that the return code |
||
| 151 | USB_PRINTER_SUCCESS will not be returned. Instead, (-1) will |
||
| 152 | be returned upon successful completion. |
||
| 153 | |||
| 154 | Remarks: |
||
| 155 | None |
||
| 156 | ***************************************************************************/ |
||
| 157 | |||
| 158 | SHORT PrintScreen( BYTE address, USB_PRINT_SCREEN_INFO *printScreenInfo ); |
||
| 159 | |||
| 160 | |||
| 161 | |||
| 162 | |||
| 163 | #endif |
||
| 164 |
Powered by WebSVN v2.8.3