S65Display
void init(uint8_t clock_div)
Initialize the microcontroller peripherals and the display.
clock_div - SPI clock divider (2, 4, 8, 16, 32), SPI clock = Main clock / clock_div
void setCursor(uint8_t x, uint8_t y)
Set cursor.
x - X postion
y - Y postion
void setArea(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1)
Set draw area.
x0 - X postion of 1st point (left top)
y0 - Y postion of 1st point (left top)
x1 - X postion of 2nd point (right bottom)
y1 - Y postion of 2nd point (right bottom)
void drawStart(void)
Start drawing.
void draw(uint16_t color)
Draw color.
void drawStop(void)
Stop drawing.
void clear(uint16_t color)
Clear the complete screen.
color - screen color
void drawPixel(uint8_t x0, uint8_t y0, uint16_t color)
Draw a pixel.
x0 - X postion of the pixel
y0 - Y postion of the pixel
color - Color
void drawLine(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, uint16_t color)
Draw a line.
x0 - X postion of 1st point
y0 - Y postion of 1st point
x1 - X postion of 2nd point
y1 - Y postion of 2nd point
color - Color
void drawRect(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, uint16_t color)
Draw a rectangle edge.
x0 - X postion of 1st point
y0 - Y postion of 1st point
x1 - X postion of 2nd point
y1 - Y postion of 2nd point
color - Color
void fillRect(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, uint16_t color)
Draw a filled rectangle.
x0 - X postion of 1st point
y0 - Y postion of 1st point
x1 - X postion of 2nd point
y1 - Y postion of 2nd point
color - Color
void drawCircle(uint8_t x0, uint8_t y0, uint8_t radius, uint16_t color)
Draw a circle.
x0 - X postion of middle point
y0 - Y postion of middle point
radius - Radius
color - Color
void fillCircle(uint8_t x0, uint8_t y0, uint8_t radius, uint16_t color)
Draw a filled circle.
x0 - X postion of middle point
y0 - Y postion of middle point
radius - Radius
color - Color
void drawChar(uint8_t x, uint8_t y, char c, uint8_t size, uint16_t color, uint16_t bg_color)
Draw a single character from RAM.
x - X postion (left top)
y - Y postion (left top)
c - Character (RAM)
size - Font size scale-up (1=normal size, 2=double size...)
color - Font color
bg_color - Background color
uint8_t drawText(uint8_t x, uint8_t y, char *s, uint8_t size, uint16_t color, uint16_t bg_color)
Draw a string from RAM. The return value is the X end postion of the text.
x - X postion (left top)
y - Y postion (left top)
s - Pointer to string (RAM)
size - Font size scale-up (1=normal size, 2=double size...)
color - Font color
bg_color - Background color
uint8_t drawTextPGM(uint8_t x, uint8_t y, PGM_P s, uint8_t size, uint16_t color, uint16_t bg_color)
Draw a string from Flash. The return value is the X end postion of the text.
x - X postion (left top)
y - Y postion (left top)
s - Pointer to string (Flash)
size - Font size scale-up (1=normal size, 2=double size...)
color - Font color
bg_color - Background color
uint8_t drawMLText(uint8_t x, uint8_t y, char *s, uint8_t size, uint16_t color, uint16_t bg_color)
Draw a multi-line string (line end = "\n") from RAM. The return value is the X end postion of the text.
x - X postion (left top)
y - Y postion (left top)
s - Pointer to string (RAM)
size - Font size scale-up (1=normal size, 2=double size...)
color - Font color
bg_color - Background color
uint8_t drawMLTextPGM(uint8_t x, uint8_t y, PGM_P s, uint8_t size, uint16_t color, uint16_t bg_color)
Draw a multi-line string (line end = "\n") from Flash. The return value is the X end postion of the text.
x - X postion (left top)
y - Y postion (left top)
s - Pointer to string (Flash)
size - Font size scale-up (1=normal size, 2=double size...)
color - Font color
bg_color - Background color
Note:
For colors you can use the RGB(red,green,blue) macro.
Examples: clear(RGB(255,50,100))
drawText(10, 10, "Hello world", RGB(0,0,255), RGB(255,50,100))
drawTextPGM(10, 20, PSTR("Hello world"), RGB(0,255,0), RGB(255,50,100))
To rotate or mirror the display uncomment the definitions S65_ROTATE or S65_MIRROR in /libraries/S65Display/S65Display.h
The text functions can draw characters from 0x20 to 0x7F and the default font is 8x12.
To change the font to 8x8 uncomment the FONT_8X8 definition and comment the FONT_8X12 definition in /libraries/S65Display/fonts.h
To support characters from 0x20 to 0xFF comment the FONT_END7F definition in /libraries/S65Display/fonts.h.
Use Umlaut characters as hex values, for example "Test \x84 \x94 \x81 \x8E \x99 \x9A" to display "Test ä ö ü Ä Ö Ü"
0x84 = ä
0x8E = Ä
0x94 = ö
0x99 = Ö
0x81 = ü
0x9A = Ü
RotaryEncoder
void init(void)
Initialize the microcontroller peripherals.
void service(void)
This function has to be called every 1 millisecond (1000 Hz).
int8_t step(void)
Get the step of the rotary encoder: -1, 0, +1
int8_t sw(void)
Get the state of the switch: 0, SW_PRESSED, SW_PRESSEDLONG
SDcard
void init(uint8_t clock_div)
<>Initialize the microcontroller peripherals.
clock_div - SPI clock divider (2, 4, 8, 16, 32), SPI clock = Main clock / clock_div
void service(void)
This function has to be called every 10 milliseconds (100 Hz).
uint8_t mount(void)
Initialize the memory card and mount it.
The return value is 0 if the mounting failed and 1 if the card is mounted successfully.
void unmount(void)
Unmount the memory card.
See also the FatFS Docu, for more information about the file system functions (f_open(), f-opendir()...):
/libraries/SDcard/doc/00index_e.html or ELM-Chan FatFs website
To enable LFN support (long file names) set _USE_LFN to 1 in /libraries/SDcard/ffconf.h. The Demo2 has also LFN support.
S65Shield
Examples for the libraries:
Demo1
Demo2
ImageDemo
MenuDemo
OpenFileDemo
SaveFileDemo
CNF