ucglib_xmega_hal  2.1
Xmega Hardware Abstraction Layer for Ucglib
ucglib_xmega_hal.h
Go to the documentation of this file.
1 
29 #ifndef _UCGLIB_HAL_XMEGA_H
30 #define _UCGLIB_HAL_XMEGA_H
31 
32 #include "csrc/ucg.h"
33 
34 #define UCG_XMEGA_USING_SPI 0
35 #define UCG_XMEGA_USING_BB 1
36 
37 #define UCG_XMEGA_BLK_CONNECT 0
38 #define UCG_XMEGA_BLK_EXTERN 1
39 #define UCG_XMEGA_BLK_DISABLED 2
40 
41 // start user specific part
42 #define UCG_XMEGA_USE UCG_XMEGA_USING_SPI
43 #define UCG_XMEGA_BLK UCG_XMEGA_BLK_DISABLED
44 
45 #define UCG_XMEGA_INTERFACE SPID
46 #define UCG_XMEGA_SPI_PORT PORTD
47 #define UCG_XMEGA_BB_PORT PORTD
48 
49 #define UCG_XMEGA_SPI_SCK_PORT UCG_XMEGA_SPI_PORT
50 #define UCG_XMEGA_SPI_MOSI_PORT UCG_XMEGA_SPI_PORT
51 #define UCG_XMEGA_SPI_MISO_PORT UCG_XMEGA_SPI_PORT
52 #define UCG_XMEGA_SPI_SS_PORT UCG_XMEGA_SPI_PORT
53 #define UCG_XMEGA_SPI_RESET_PORT UCG_XMEGA_SPI_PORT
54 #define UCG_XMEGA_SPI_CD_PORT UCG_XMEGA_SPI_PORT
55 #define UCG_XMEGA_SPI_BLK_PORT UCG_XMEGA_SPI_PORT
56 
57 #define UCG_XMEGA_BB_SCK_PORT UCG_XMEGA_BB_PORT
58 #define UCG_XMEGA_BB_SDA_PORT UCG_XMEGA_BB_PORT
59 #define UCG_XMEGA_BB_CS_PORT UCG_XMEGA_BB_PORT
60 #define UCG_XMEGA_BB_RESET_PORT UCG_XMEGA_BB_PORT
61 #define UCG_XMEGA_BB_CD_PORT UCG_XMEGA_BB_PORT
62 #define UCG_XMEGA_BB_BLK_PORT UCG_XMEGA_BB_PORT
63 
64 #define UCG_XMEGA_SPI_SCK_bp PIN7_bp
65 #define UCG_XMEGA_SPI_MISO_bp PIN6_bp
66 #define UCG_XMEGA_SPI_MOSI_bp PIN5_bp
67 #define UCG_XMEGA_SPI_SS_bp PIN4_bp
68 #define UCG_XMEGA_SPI_RESET_bp PIN3_bp
69 #define UCG_XMEGA_SPI_CD_bp PIN2_bp
70 #define UCG_XMEGA_SPI_BLK_bp PIN1_bp
71 
72 #define UCG_XMEGA_BB_SCK_bp PIN4_bp
73 #define UCG_XMEGA_BB_SDA_bp PIN3_bp
74 #define UCG_XMEGA_BB_CS_bp PIN0_bp
75 #define UCG_XMEGA_BB_RESET_bp PIN1_bp
76 #define UCG_XMEGA_BB_CD_bp PIN2_bp
77 #define UCG_XMEGA_BB_BLK_bp PIN5_bp
78 // end user specific part
79 
80 int16_t ucg_comm_xmega(ucg_t *ucg, int16_t msg, uint16_t arg, uint8_t *data);
81 
82 void ucg_PrintInit(ucg_t *ucg);
83 void ucg_SetPrintPos(ucg_t *ucg, ucg_int_t x, ucg_int_t y);
84 void ucg_SetPrintDir(ucg_t *ucg, uint8_t dir);
85 void ucg_Print(ucg_t *ucg, char *fmt, ...);
86 void ucg_GetPrintPos(ucg_t *ucg, ucg_int_t *x, ucg_int_t *y);
87 
88 void ucg_BitmapPrint(ucg_t *ucg, ucg_int_t xoffset, ucg_int_t yoffset,
89  ucg_int_t width, ucg_int_t height,
90  uint8_t ncolors, const __memx uint8_t *bitmap);
91 
92 #endif
void ucg_GetPrintPos(ucg_t *ucg, ucg_int_t *x, ucg_int_t *y)
Gets the current position of the 'print cursor'.
Definition: ucglib_xmega_hal.c:186
ucg_t ucg
ucg is a necessary global structure for ucg_lib
Definition: main.c:51
void ucg_SetPrintDir(ucg_t *ucg, uint8_t dir)
Sets the direction for next "print" command.
Definition: ucglib_xmega_hal.c:199
void ucg_BitmapPrint(ucg_t *ucg, ucg_int_t xoffset, ucg_int_t yoffset, ucg_int_t width, ucg_int_t height, uint8_t ncolors, const __memx uint8_t *bitmap)
Prints a bitmap to the display.
Definition: ucglib_xmega_hal.c:318
void ucg_SetPrintPos(ucg_t *ucg, ucg_int_t x, ucg_int_t y)
Sets the position for next "print" command.
Definition: ucglib_xmega_hal.c:172
void ucg_PrintInit(ucg_t *ucg)
Initializes the printing facilities compatible with Arduino/C++ version of library.
Definition: ucglib_xmega_hal.c:268
int16_t ucg_comm_xmega(ucg_t *ucg, int16_t msg, uint16_t arg, uint8_t *data)
The callback function for communication between the Xmega and the display.
Definition: ucglib_xmega_hal.c:358
void ucg_Print(ucg_t *ucg, char *fmt,...)
Put a formatted string to the display at the current position and in the current direction.
Definition: ucglib_xmega_hal.c:252