Hello, first forgiveness for my poor english. I buy a lcd 1.8' with st7735s.
I have a image that i want use for icon and create with GIMP 2 and export in xbm format. The code is:
#define pos_32x22_T_width 32
#define pos_32x22_T_height 22
static unsigned char pos_32x22_T_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x60, 0x1e, 0x00, 0x00, 0x78,
0x78, 0x00, 0x00, 0x1e, 0x60, 0x00, 0x00, 0x06, 0x00, 0x3e, 0x7c, 0x00,
0x00, 0x7e, 0x7e, 0x00, 0x00, 0x66, 0x66, 0x00, 0x00, 0x66, 0x66, 0x00,
0x00, 0x66, 0x66, 0x00, 0x7e, 0x66, 0x66, 0x7e, 0x7e, 0x66, 0x66, 0x7e,
0x00, 0x66, 0x66, 0x00, 0x00, 0x66, 0x66, 0x00, 0x00, 0x66, 0x66, 0x00,
0x00, 0x7e, 0x7e, 0x00, 0x00, 0x3e, 0x7c, 0x00, 0x60, 0x00, 0x00, 0x06,
0x78, 0x00, 0x00, 0x1e, 0x1e, 0x00, 0x00, 0x78, 0x06, 0x00, 0x00, 0x60,
0x00, 0x00, 0x00, 0x00 };
And my program code is:
#include <avr/pgmspace.h>
#define fontdatatype uint8_t
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SPI.h>
#define TFT_CS 10
#define TFT_RST 8
#define TFT_DC 9
#define TFT_SCLK 13
#define TFT_MOSI 11
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
fontdatatype pos1[] PROGMEM={
//static unsigned short pos[] = {
0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x60, 0x1e, 0x00, 0x00, 0x78,
0x78, 0x00, 0x00, 0x1e, 0x60, 0x00, 0x00, 0x06, 0x00, 0x3e, 0x7c, 0x00,
0x00, 0x7e, 0x7e, 0x00, 0x00, 0x66, 0x66, 0x00, 0x00, 0x66, 0x66, 0x00,
0x00, 0x66, 0x66, 0x00, 0x7e, 0x66, 0x66, 0x7e, 0x7e, 0x66, 0x66, 0x7e,
0x00, 0x66, 0x66, 0x00, 0x00, 0x66, 0x66, 0x00, 0x00, 0x66, 0x66, 0x00,
0x00, 0x7e, 0x7e, 0x00, 0x00, 0x3e, 0x7c, 0x00, 0x60, 0x00, 0x00, 0x06,
0x78, 0x00, 0x00, 0x1e, 0x1e, 0x00, 0x00, 0x78, 0x06, 0x00, 0x00, 0x60,
0x00, 0x00, 0x00, 0x00 };
#define YAMAHA 0xCCCC
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
void setup(void) {
tft.initR(INITR_BLACKTAB);
tft.fillScreen(ST7735_BLACK);
}
void loop() {
tft.setRotation(3);
tft.drawBitmap(5, 4, pos1, 32, 22, RED);
}
The problems is that the icon isn´t draw correcty.
If the icon is for example: "THHT" the lcd draw "HTTH".
Thanks for all. And forgiveness for my english.