mirror of
https://github.com/adafruit/Adafruit-GFX-Library.git
synced 2024-10-03 18:18:46 -04:00
doxy gfxfont
This commit is contained in:
parent
4de9ba8f14
commit
836a499055
@ -1,4 +1,9 @@
|
|||||||
/***************************************************
|
/*!
|
||||||
|
* @file Adafruit_SPITFT.cpp
|
||||||
|
*
|
||||||
|
* @mainpage Adafruit SPI TFT Displays
|
||||||
|
*
|
||||||
|
* @section intro_sec Introduction
|
||||||
This is our library for generic SPI TFT Displays with
|
This is our library for generic SPI TFT Displays with
|
||||||
address windows and 16 bit color (e.g. ILI9341, HX8357D, ST7735...)
|
address windows and 16 bit color (e.g. ILI9341, HX8357D, ST7735...)
|
||||||
|
|
||||||
@ -11,7 +16,21 @@
|
|||||||
|
|
||||||
Written by Limor Fried/Ladyada for Adafruit Industries.
|
Written by Limor Fried/Ladyada for Adafruit Industries.
|
||||||
MIT license, all text above must be included in any redistribution
|
MIT license, all text above must be included in any redistribution
|
||||||
****************************************************/
|
* @section dependencies Dependencies
|
||||||
|
*
|
||||||
|
* This library depends on <a href="https://github.com/adafruit/Adafruit_GFX">
|
||||||
|
* Adafruit_GFX</a> being present on your system. Please make sure you have
|
||||||
|
* installed the latest version before using this library.
|
||||||
|
*
|
||||||
|
* @section author Author
|
||||||
|
*
|
||||||
|
* Written by Limor "ladyada" Fried for Adafruit Industries.
|
||||||
|
*
|
||||||
|
* @section license License
|
||||||
|
*
|
||||||
|
* BSD license, all text here must be included in any redistribution.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef __AVR_ATtiny85__ // NOT A CHANCE of this stuff working on ATtiny!
|
#ifndef __AVR_ATtiny85__ // NOT A CHANCE of this stuff working on ATtiny!
|
||||||
|
|
||||||
@ -28,11 +47,32 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Pass 8-bit (each) R,G,B, get back 16-bit packed color
|
/**************************************************************************/
|
||||||
uint16_t Adafruit_SPITFT::color565(uint8_t r, uint8_t g, uint8_t b) {
|
/*!
|
||||||
|
@brief Pass 8-bit (each) R,G,B, get back 16-bit packed color
|
||||||
|
This function converts 8-8-8 RGB data to 16-bit 5-6-5
|
||||||
|
@param red Red 8 bit color
|
||||||
|
@param green Green 8 bit color
|
||||||
|
@param blue Blue 8 bit color
|
||||||
|
@return Unsigned 16-bit down-sampled color in 5-6-5 format
|
||||||
|
*/
|
||||||
|
/**************************************************************************/
|
||||||
|
uint16_t Adafruit_SPITFT::color565(uint8_t red, uint8_t green, uint8_t blue) {
|
||||||
return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3);
|
return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/*!
|
||||||
|
@brief Instantiate Adafruit SPI display driver with software SPI
|
||||||
|
@param cs Chip select pin #
|
||||||
|
@param dc Data/Command pin #
|
||||||
|
@param mosi SPI MOSI pin #
|
||||||
|
@param sclk SPI Clock pin #
|
||||||
|
@param rst Reset pin # (optional, pass -1 if unused)
|
||||||
|
@param miso SPI MISO pin # (optional, pass -1 if unused)
|
||||||
|
*/
|
||||||
|
/**************************************************************************/
|
||||||
Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h,
|
Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h,
|
||||||
int8_t cs, int8_t dc, int8_t mosi,
|
int8_t cs, int8_t dc, int8_t mosi,
|
||||||
int8_t sclk, int8_t rst, int8_t miso)
|
int8_t sclk, int8_t rst, int8_t miso)
|
||||||
|
19
gfxfont.h
19
gfxfont.h
@ -8,17 +8,20 @@
|
|||||||
#define _GFXFONT_H_
|
#define _GFXFONT_H_
|
||||||
|
|
||||||
typedef struct { // Data stored PER GLYPH
|
typedef struct { // Data stored PER GLYPH
|
||||||
uint16_t bitmapOffset; // Pointer into GFXfont->bitmap
|
uint16_t bitmapOffset; ///< Pointer into GFXfont->bitmap
|
||||||
uint8_t width, height; // Bitmap dimensions in pixels
|
uint8_t width; ///< Bitmap dimensions in pixels
|
||||||
uint8_t xAdvance; // Distance to advance cursor (x axis)
|
uint8_t height; ///< Bitmap dimensions in pixels
|
||||||
int8_t xOffset, yOffset; // Dist from cursor pos to UL corner
|
uint8_t xAdvance; ///< Distance to advance cursor (x axis)
|
||||||
|
int8_t xOffset; ///< X dist from cursor pos to UL corner
|
||||||
|
int8_t yOffset; ///< Y dist from cursor pos to UL corner
|
||||||
} GFXglyph;
|
} GFXglyph;
|
||||||
|
|
||||||
typedef struct { // Data stored for FONT AS A WHOLE:
|
typedef struct { // Data stored for FONT AS A WHOLE:
|
||||||
uint8_t *bitmap; // Glyph bitmaps, concatenated
|
uint8_t *bitmap; ///< Glyph bitmaps, concatenated
|
||||||
GFXglyph *glyph; // Glyph array
|
GFXglyph *glyph; ///< Glyph array
|
||||||
uint8_t first, last; // ASCII extents
|
uint8_t first; ///< ASCII extents (first char)
|
||||||
uint8_t yAdvance; // Newline distance (y axis)
|
uint8_t last; ///< ASCII extents (last char)
|
||||||
|
uint8_t yAdvance; ///< Newline distance (y axis)
|
||||||
} GFXfont;
|
} GFXfont;
|
||||||
|
|
||||||
#endif // _GFXFONT_H_
|
#endif // _GFXFONT_H_
|
||||||
|
Loading…
Reference in New Issue
Block a user