Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <stdbool.h>
- #include <dirent.h>
- #include <fcntl.h>
- #include <assert.h>
- #include <sched.h> // To set the priority on linux
- #include <sys/mman.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <unistd.h>
- #include <math.h>
- // Define which Raspberry Pi board are you using. Take care to have defined only one at time.
- #define RPI
- //#define RPI2
- #ifdef RPI
- #define BCM2708_PERI_BASE 0x20000000
- #define GPIO_BASE (BCM2708_PERI_BASE + 0x200000) // GPIO controller
- //#define BSC0_BASE (BCM2708_PERI_BASE + 0x205000) // I2C0 controller
- #define BSC0_BASE (BCM2708_PERI_BASE + 0x804000) // I2C1 controller
- #define SYST_BASE (BCM2708_PERI_BASE + 0x3000)
- #endif
- #ifdef RPI2
- #define BCM2708_PERI_BASE 0x3F000000
- #define GPIO_BASE (BCM2708_PERI_BASE + 0x200000) // GPIO controller. Maybe wrong. Need to be tested.
- #define BSC0_BASE (BCM2708_PERI_BASE + 0x804000) // I2C controller
- #endif
- #define PAGE_SIZE (4*1024)
- #define BLOCK_SIZE (4*1024)
- #define SYST_CS 0
- #define SYST_CLO 1
- #define SYST_CHI 2
- // IO Acces
- struct bcm2835_peripheral {
- unsigned long addr_p;
- int mem_fd;
- void *map;
- volatile unsigned int *addr;
- };
- struct bcm2835_peripheral gpio = {GPIO_BASE};
- struct bcm2835_peripheral bsc0 = {BSC0_BASE};
- struct bcm2835_peripheral syst = {SYST_BASE};
- // GPIO setup macros. Always use INP_GPIO(x) before using OUT_GPIO(x) or SET_GPIO_ALT(x,y)
- #define INP_GPIO(g) *(gpio.addr + ((g)/10)) &= ~(7<<(((g)%10)*3))
- #define OUT_GPIO(g) *(gpio.addr + ((g)/10)) |= (1<<(((g)%10)*3))
- #define SET_GPIO_ALT(g,a) *(gpio.addr + (((g)/10))) |= (((a)<=3?(a) + 4:(a)==4?3:2)<<(((g)%10)*3))
- #define GPIO_SET *(gpio.addr + 7) // sets bits which are 1 ignores bits which are 0
- #define GPIO_CLR *(gpio.addr + 10) // clears bits which are 1 ignores bits which are 0
- #define GPIO_READ(g) *(gpio.addr + 13) &= (1<<(g))
- // I2C macros
- // The following parameters relate to registers in the Boardcom Serial Controller #0 (BSC0) - they are pointers to the BSC0 address plus an offset relating to a specific register
- #define BSC0_C *(bsc0.addr + 0x00) // Control register address
- #define BSC0_S *(bsc0.addr + 0x01) // Status register address
- #define BSC0_DLEN *(bsc0.addr + 0x02) // Data length register address
- #define BSC0_A *(bsc0.addr + 0x03) // Slave register register address
- #define BSC0_FIFO *(bsc0.addr + 0x04) // First In First Out buffer address
- // The following parameters relate to specific bits of the Control Register
- // These are set via bitwise left shifting of the value 1 via the logical operator <<
- #define BSC_C_I2CEN (1 << 15) // enables BSC operations - 0 prevents transfers but register accesses is still permitted
- #define BSC_C_INTR (1 << 10) // enable/Disable interrupt on RX - 0 prevents interrupts on RXR condition - 1 generates an interrupt while RXR = 1
- #define BSC_C_INTT (1 << 9) // writing a 0 disables interrupts on TXW - 1 enables; TXW indicates whether the FIFO is full and ready for transfer/reading
- #define BSC_C_INTD (1 << 8) // 1 enables interrupts to alter the DONE condition on completion of a transfer (0 disables). The interrupt remains active until the DONE condition is cleared by writing a 1 to the I2CS.DONE field.
- #define BSC_C_ST (1 << 7) // starts a new data transfer - writing to this field is a one-shot operation (it always reads as zero)
- #define BSC_C_CLEAR (1 << 4) // clears the FIFO - writing to this field is a one-shot operation (it always reads as zero)
- #define BSC_C_READ 1 // specifies transfer type as read
- // The logical OR opporator, | , is used here to combine the bits above into commands for the control register
- #define START_READ BSC_C_I2CEN|BSC_C_ST|BSC_C_CLEAR|BSC_C_READ // Initialisation of the control register before reading
- #define START_WRITE BSC_C_I2CEN|BSC_C_ST // Initialisation of the control register before writing
- // The following parameters relate to specific bits of the Status Register
- // These indicate the status of the First In First Out (FIFO) buffer and current data transfer in general
- // These are again set via bitwise left shifting of the value 1 via the logical operator <<
- #define BSC_S_CLKT (1 << 9) // is set to indicate that the slave is holding the SCL signal high for an extended time period (clock stretching) - reset by writing a 1 (writing a 0 to the field has no effect)
- #define BSC_S_ERR (1 << 8) // is set to indicate that the slave has failed to acknowledge either its address or a data byte written to it - reset by writing a 1 (writing a 0 to the field has no effect)
- #define BSC_S_RXF (1 << 7) // is set to indicate that the FIFO is full
- #define BSC_S_TXE (1 << 6) // is set to indicate that the FIFO is empty
- #define BSC_S_RXD (1 << 5) // is set to indicate that the FIFO contains at least one byte of data
- #define BSC_S_TXD (1 << 4) // is set to indicate that the FIFO has space for at least one more byte of data
- #define BSC_S_RXR (1 << 3) // generate interrupt to read data from the FIFO before it becomes full
- #define BSC_S_TXW (1 << 2) // generate an interrupt to write more data to the FIFO to complete the current transfer
- #define BSC_S_DONE (1 << 1) // is set to indicate that the transfer has completed
- #define BSC_S_TA 1 // is set to indicate the activity of the BSC (1 when busy, 0 when idle)
- // The logical OR opporator | is used here to combine the bits above into command to clear the status register
- #define CLEAR_STATUS BSC_S_CLKT|BSC_S_ERR|BSC_S_DONE // reset/initialise ready for fresh transfer
- // Exposes the physical address defined in the passed structure using mmap on /dev/mem
- unsigned short map_peripheral(struct bcm2835_peripheral *p)
- {
- // Open /dev/mem
- if ((p->mem_fd = open("/dev/mem", O_RDWR|O_SYNC) ) < 0) {
- printf("Failed to open /dev/mem, try checking permissions.\n");
- return 0;
- }
- p->map = mmap(
- NULL,
- BLOCK_SIZE,
- PROT_READ|PROT_WRITE,
- MAP_SHARED,
- p->mem_fd, // File descriptor to physical memory virtual file '/dev/mem'
- p->addr_p // Address in physical map that we want this memory block to expose
- );
- if (p->map == MAP_FAILED) {
- perror("mmap");
- return 0;
- }
- p->addr = (volatile unsigned int *)p->map;
- return 1;
- }
- void unmap_peripheral(struct bcm2835_peripheral *p)
- {
- munmap(p->map, BLOCK_SIZE);
- close(p->mem_fd);
- }
- void dump_bsc_status(void)
- {
- unsigned int s = BSC0_S;
- printf("BSC0_S: ERR=%d RXF=%d TXE=%d RXD=%d TXD=%d RXR=%d TXW=%d DONE=%d TA=%d\n",
- (s & BSC_S_ERR) != 0,
- (s & BSC_S_RXF) != 0,
- (s & BSC_S_TXE) != 0,
- (s & BSC_S_RXD) != 0,
- (s & BSC_S_TXD) != 0,
- (s & BSC_S_RXR) != 0,
- (s & BSC_S_TXW) != 0,
- (s & BSC_S_DONE) != 0,
- (s & BSC_S_TA) != 0 );
- }
- // Function to wait for the I2C transaction to complete
- void wait_i2c_done(void)
- {
- // 5ms timeout for wait i2c done
- unsigned short timeout = 50;
- while((!(BSC0_S & BSC_S_DONE)) && --timeout)
- usleep(100);
- if(timeout == 0)
- printf("wait_i2c_done() timeout! Something went wrong!\n");
- }
- void i2c_init()
- {
- INP_GPIO(0);
- SET_GPIO_ALT(0, 0);
- INP_GPIO(1);
- SET_GPIO_ALT(1, 0);
- }
- // Priority
- int SetProgramPriority(int priorityLevel)
- {
- struct sched_param sched;
- memset(&sched, 0, sizeof(sched));
- if (priorityLevel > sched_get_priority_max (SCHED_RR))
- priorityLevel = sched_get_priority_max (SCHED_RR);
- sched.sched_priority = priorityLevel;
- return sched_setscheduler (0, SCHED_RR, &sched);
- }
- #define PI_PUD_OFF 0
- #define PI_PUD_DOWN 1
- #define PI_PUD_UP 2
- void gpioSetPullUpDown(unsigned gpionum, unsigned pud)
- {
- *(gpio.addr + 37) = pud;
- usleep(20);
- *(gpio.addr + 38 + (gpionum>>5)) = (1<<(gpionum&0x1F));
- usleep(20);
- *(gpio.addr + 37) = 0;
- *(gpio.addr + 38 + (gpionum>>5)) = 0;
- }
- int gpioGetMode(unsigned gpionum)
- {
- int reg, shift;
- reg = gpionum/10;
- shift = (gpionum%10) * 3;
- return (*(gpio.addr + reg) >> shift) & 7;
- }
- int gpioRead(unsigned gpionum)
- {
- if ((*(gpio.addr + 13 + (gpionum>>5)) & (1<<(gpionum&0x1F))) != 0)
- return 1;
- else
- return 0;
- }
- void gpioWrite(unsigned gpionum, unsigned level)
- {
- if (level == 0)
- *(gpio.addr + 10 + (gpionum>>5)) = (1<<(gpionum&0x1F));
- else
- *(gpio.addr + 7 + (gpionum>>5)) = (1<<(gpionum&0x1F));
- }
- uint32_t gpioTick(void)
- {
- return syst.addr[SYST_CLO];
- }
- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- /*------------------------------ SSD1306 128x64 definitions ---------------------------------*/
- #define SSD1306_I2C_ADDRESS 0x3C
- #define SSD1306_LCDWIDTH 128
- #define SSD1306_LCDHEIGHT 64
- #define SSD1306_NORMALDISPLAY 0xA6
- #define SSD1306_INVERTDISPLAY 0xA7
- #define SSD1306_DISPLAYOFF 0xAE
- #define SSD1306_DISPLAYON 0xAF
- #define SSD1306_SETDISPLAYOFFSET 0xD3
- #define SSD1306_SETCOMPINS 0xDA
- #define SSD1306_SETVCOMDETECT 0xDB
- #define SSD1306_SETDISPLAYCLOCKDIV 0xD5
- #define SSD1306_SETPRECHARGE 0xD9
- #define SSD1306_SETCONTRAST 0x81
- #define SSD1306_DISPLAYALLON_RESUME 0xA4
- #define SSD1306_SETMULTIPLEX 0xA8
- #define SSD1306_SETLOWCOLUMN 0x00
- #define SSD1306_SETHIGHCOLUMN 0x10
- #define SSD1306_SETSTARTLINE 0x40
- #define SSD1306_MEMORYMODE 0x20
- #define SSD1306_COLUMNADDR 0x21
- #define SSD1306_PAGEADDR 0x22
- #define SSD1306_COMSCANINC 0xC0
- #define SSD1306_COMSCANDEC 0xC8
- #define SSD1306_SEGREMAP 0xA0
- #define SSD1306_CHARGEPUMP 0x8D
- #define SSD1306_EXTERNALVCC 0x01
- #define SSD1306_SWITCHCAPVCC 0x02
- // Scrolling #defines
- #define SSD1306_ACTIVATE_SCROLL 0x2F
- #define SSD1306_DEACTIVATE_SCROLL 0x2E
- #define SSD1306_SET_VERTICAL_SCROLL_AREA 0xA3
- #define SSD1306_RIGHT_HORIZONTAL_SCROLL 0x26
- #define SSD1306_LEFT_HORIZONTAL_SCROLL 0x27
- #define SSD1306_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL 0x29
- #define SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL 0x2A
- #define Set_Page_Start_Address_CMD 0xB0
- #define y_max 8
- #define CMD 0x00
- #define DAT 0x40
- void ssd1306_write(uint8_t cmd, uint8_t addr)
- {
- BSC0_A = SSD1306_I2C_ADDRESS;
- BSC0_DLEN = 2;
- BSC0_FIFO = cmd;
- BSC0_FIFO = addr;
- BSC0_S = CLEAR_STATUS;
- BSC0_C = START_WRITE;
- wait_i2c_done();
- }
- void ssd1306_init(void)
- {
- // Init sequence for Adafruit 128x64 OLED module
- ssd1306_write(CMD, SSD1306_DISPLAYOFF);
- ssd1306_write(CMD, SSD1306_SETDISPLAYCLOCKDIV);
- ssd1306_write(CMD, 0x80); // the suggested ratio 0x80
- ssd1306_write(CMD, SSD1306_SETMULTIPLEX);
- ssd1306_write(CMD, 0x3F); // ratio 64
- ssd1306_write(CMD, SSD1306_SETDISPLAYOFFSET);
- ssd1306_write(CMD, 0x0); // no offset
- ssd1306_write(CMD, SSD1306_SETSTARTLINE | 0x0); // line #0
- ssd1306_write(CMD, SSD1306_CHARGEPUMP);
- ssd1306_write(CMD, 0x14); // internal vcc
- ssd1306_write(CMD, SSD1306_MEMORYMODE);
- ssd1306_write(CMD, 0x02); // page mode
- ssd1306_write(CMD, SSD1306_SEGREMAP | 0x1); // column 127 mapped to SEG0
- ssd1306_write(CMD, SSD1306_COMSCANDEC); // column scan direction reversed
- ssd1306_write(CMD, SSD1306_SETCOMPINS);
- ssd1306_write(CMD, 0x12); // alt COM pins, disable remap
- ssd1306_write(CMD, SSD1306_SETCONTRAST);
- ssd1306_write(CMD, 0x7F); // contrast level 127
- ssd1306_write(CMD, SSD1306_SETPRECHARGE);
- ssd1306_write(CMD, 0xF1); // pre-charge period (1, 15)
- ssd1306_write(CMD, SSD1306_SETVCOMDETECT);
- ssd1306_write(CMD, 0x40); // vcomh regulator level
- ssd1306_write(CMD, SSD1306_DISPLAYALLON_RESUME);
- ssd1306_write(CMD, SSD1306_NORMALDISPLAY);
- ssd1306_write(CMD, SSD1306_DISPLAYON);
- }
- #define FONT_WIDTH 42
- #define FONT_HEIGHT 62
- const char font_bitmap[10][336] = {
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xE0, 0xF0, 0xF0,
- 0xF0, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF0, 0xF0, 0xF0, 0xE0, 0xE0, 0xC0,
- 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xE0, 0xF8, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x0F, 0x07, 0x03, 0x03, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x03, 0x03, 0x07, 0x0F, 0x1F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFE, 0xFC, 0xF0, 0x80,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0x80, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x80, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x03, 0x0F, 0x3F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFE, 0xF8, 0xF0, 0xE0, 0xE0, 0xC0, 0xC0,
- 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFF, 0xFF, 0xFF, 0x7F, 0x3F, 0x1F,
- 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x01, 0x03, 0x03, 0x07, 0x07, 0x07, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
- 0x07, 0x07, 0x07, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x80, 0x80, 0x80, 0xC0, 0xC0, 0xC0, 0xE0, 0xE0, 0xE0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xF8, 0xF8, 0xFC, 0xFC, 0xFC, 0x7E, 0x7E, 0x7E, 0x3F, 0x3F, 0x1F, 0x1F, 0x1F, 0x0F, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
- 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 1
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xE0, 0xF0, 0xF0, 0xF0, 0xF8,
- 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF0, 0xF0, 0xF0, 0xF0, 0xE0, 0xC0, 0xC0,
- 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xF8, 0xFC,
- 0xFE, 0xFF, 0xFF, 0xFF, 0x7F, 0x1F, 0x0F, 0x07, 0x03, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x03, 0x03, 0x07, 0x0F, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xF8, 0xC0, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xFC, 0xFF, 0xFF, 0xFF, 0x7F, 0x3F, 0x0F,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF,
- 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8,
- 0xFE, 0xFF, 0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xE0, 0xF8, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0xE7, 0xE3, 0xE1, 0xE0, 0xE0, 0xE0, 0xE0,
- 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0,
- 0xE0, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
- 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
- 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x00, 0x00, 0x00}, // 2
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xE0, 0xF0, 0xF0, 0xF0,
- 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF0, 0xF0, 0xF0, 0xE0, 0xE0, 0xC0,
- 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xF0,
- 0xFC, 0xFE, 0xFF, 0xFF, 0xFF, 0x7F, 0x1F, 0x0F, 0x07, 0x03, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x03, 0x03, 0x07, 0x0F, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFC, 0xE0, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0,
- 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF8, 0xF8, 0xFC, 0xFC, 0xFE, 0xFF, 0xBF, 0x1F, 0x1F, 0x0F,
- 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
- 0x07, 0x07, 0x07, 0x0F, 0x1F, 0x3F, 0xFF, 0xFF, 0xFE, 0xFE, 0xFC, 0xF8, 0xE0, 0x80, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x03, 0x0F, 0x3F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFE, 0xF8, 0xF0, 0xF0, 0xE0, 0xE0, 0xC0, 0xC0, 0xC0,
- 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF, 0x7F, 0x1F,
- 0x0F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
- 0x01, 0x03, 0x03, 0x07, 0x07, 0x07, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
- 0x07, 0x07, 0x07, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 3
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
- 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xE0, 0xF0, 0xFC,
- 0xFE, 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x80, 0xE0, 0xF0, 0xFC, 0xFE, 0xFF, 0xFF, 0x3F, 0x1F, 0x07, 0x03, 0x00, 0x00, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xE0, 0xF0, 0xFC, 0xFE, 0xFF, 0xFF, 0x3F, 0x1F, 0x07,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xE0, 0xF0, 0xFC, 0xFF,
- 0xFF, 0xFF, 0x3F, 0x1F, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x7C, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E,
- 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 4
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
- 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
- 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
- 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0x07, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7E, 0x3F, 0x3F, 0x1F, 0x1F,
- 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x3F, 0x3F, 0x7F, 0xFF, 0xFF, 0xFE, 0xFE, 0xFC, 0xF8, 0xF0,
- 0xE0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xC0, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x07, 0x1F, 0x3F, 0x7F, 0xFF, 0xFF, 0xFE, 0xFC, 0xF8, 0xF0, 0xE0, 0xE0, 0xC0, 0xC0, 0xC0,
- 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, 0xE0, 0xF0, 0xF0, 0xF8, 0xFE, 0xFF, 0xFF, 0xFF, 0x7F, 0x3F, 0x1F,
- 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x03, 0x03, 0x07, 0x07, 0x07, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
- 0x07, 0x07, 0x07, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 5
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x80, 0x80, 0xC0, 0xC0, 0xE0, 0xE0, 0xE0, 0xE0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x80, 0xC0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF, 0xFF, 0x7F, 0x3F, 0x1F, 0x1F, 0x0F, 0x0F,
- 0x07, 0x07, 0x07, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xF8, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF,
- 0x1F, 0x07, 0x01, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0xF8, 0xFC, 0xFE, 0x7E, 0x3F, 0x3F,
- 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x3F, 0x3F, 0x7F, 0xFF, 0xFF, 0xFE, 0xFC, 0xFC, 0xF8,
- 0xF0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0x07, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x80, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x03, 0x0F, 0x1F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFE, 0xF8, 0xF0, 0xF0, 0xE0, 0xE0, 0xC0,
- 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFF, 0xFF, 0xFF, 0x7F, 0x3F, 0x1F,
- 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x01, 0x01, 0x03, 0x03, 0x07, 0x07, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
- 0x07, 0x07, 0x07, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 6
- {0x00, 0x00, 0x00, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0,
- 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0,
- 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07,
- 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
- 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x87, 0xE7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F,
- 0x0F, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0,
- 0xF0, 0xFC, 0xFF, 0xFF, 0xFF, 0x7F, 0x1F, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xF0, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x0F, 0x03, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xE0, 0xF8, 0xFE, 0xFF,
- 0xFF, 0xFF, 0x7F, 0x1F, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xC0, 0xF0, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x0F, 0x01, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xF0, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F,
- 0x1F, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x08, 0x0E, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 7
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xE0, 0xF0, 0xF0,
- 0xF0, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF0, 0xF0, 0xF0, 0xE0, 0xE0, 0xC0,
- 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xF0, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x0F, 0x07, 0x03, 0x03, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x03, 0x03, 0x07, 0x0F, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xF0, 0x80,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xF1, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0xBF, 0xFF, 0xFE, 0xFC, 0xF8, 0xF8,
- 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF8, 0xF8, 0xFC, 0xFE, 0xFF, 0xFF, 0x3F, 0x1F, 0x0F,
- 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xE0, 0xF8,
- 0xFC, 0xFE, 0xFE, 0xFF, 0x7F, 0x1F, 0x0F, 0x0F, 0x07, 0x07, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
- 0x03, 0x07, 0x07, 0x0F, 0x0F, 0x1F, 0x3F, 0xFF, 0xFF, 0xFE, 0xFC, 0xF8, 0xF0, 0xC0, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x81, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x07, 0x1F, 0x3F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFC, 0xF8, 0xF0, 0xE0, 0xE0, 0xE0, 0xC0, 0xC0,
- 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, 0xE0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F,
- 0x1F, 0x0F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x03, 0x03, 0x07, 0x07, 0x07, 0x07, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
- 0x0F, 0x07, 0x07, 0x07, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 8
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xC0, 0xE0, 0xE0, 0xE0,
- 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xE0, 0xE0, 0xE0, 0xC0, 0xC0, 0x80, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0,
- 0xF0, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF, 0x7F, 0x1F, 0x0F, 0x07, 0x07, 0x07, 0x03, 0x03, 0x03, 0x03,
- 0x03, 0x03, 0x07, 0x07, 0x0F, 0x1F, 0x3F, 0xFF, 0xFF, 0xFF, 0xFE, 0xFC, 0xF0, 0xE0, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xE0, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07,
- 0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0xFF, 0xFE, 0xFC, 0xFC, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8,
- 0xFC, 0xFC, 0x7E, 0x7F, 0x3F, 0x1F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xF0,
- 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, 0xE0,
- 0xE0, 0xF0, 0xF0, 0xF8, 0xF8, 0xFC, 0xFE, 0xFF, 0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x03, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x07, 0x07, 0x07, 0x03, 0x03, 0x01,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // 9
- };
- void ssd1306_draw_font(uint8_t x, uint8_t y, const char *ch, size_t ch_sz)
- {
- size_t tt = 0;
- uint8_t x_pos = x;
- uint8_t y_pos = 0;
- for(tt=0; tt<ch_sz; ++tt)
- {
- if (x_pos >= (x + FONT_WIDTH))
- {
- x_pos = x;
- y_pos += 1;
- }
- ssd1306_write(CMD, Set_Page_Start_Address_CMD + y_pos); // set row
- ssd1306_write(CMD, SSD1306_SETLOWCOLUMN | (x_pos & 0xf)); // set lower column address
- ssd1306_write(CMD, SSD1306_SETHIGHCOLUMN | (x_pos >> 4)); // set higher column address
- ssd1306_write(DAT, (uint8_t)ch[tt]);
- x_pos += 1;
- }
- }
- void ssd1306_fill(uint8_t bmp_data)
- {
- uint8_t x_pos = 0;
- uint8_t page = 0;
- for (page=0; page < y_max; ++page)
- {
- ssd1306_write(CMD, (Set_Page_Start_Address_CMD + page));
- ssd1306_write(CMD, SSD1306_SETLOWCOLUMN);
- ssd1306_write(CMD, SSD1306_SETHIGHCOLUMN);
- for (x_pos=0; x_pos < SSD1306_LCDWIDTH; ++x_pos)
- {
- ssd1306_write(DAT, bmp_data);
- }
- }
- }
- void draw_tempere(unsigned short temp)
- {
- if (temp == 0)
- {
- ssd1306_draw_font(0, 0, font_bitmap[0], sizeof(font_bitmap[0]));
- ssd1306_draw_font(FONT_WIDTH, 0, font_bitmap[0], sizeof(font_bitmap[0]));
- ssd1306_draw_font(2*FONT_WIDTH, 0, font_bitmap[0], sizeof(font_bitmap[0]));
- }
- else if (temp > 0 && temp < 10)
- {
- ssd1306_draw_font(0, 0, font_bitmap[0], sizeof(font_bitmap[0]));
- ssd1306_draw_font(FONT_WIDTH, 0, font_bitmap[0], sizeof(font_bitmap[0]));
- ssd1306_draw_font(2*FONT_WIDTH, 0, font_bitmap[temp], sizeof(font_bitmap[temp]));
- }
- else if (temp >= 10 && temp < 100)
- {
- ssd1306_draw_font(0, 0, font_bitmap[0], sizeof(font_bitmap[0]));
- ssd1306_draw_font(FONT_WIDTH, 0, font_bitmap[(temp/10)%10], sizeof(font_bitmap[(temp/10)%10]));
- ssd1306_draw_font(2*FONT_WIDTH, 0, font_bitmap[temp%10], sizeof(font_bitmap[temp%10]));
- }
- else if (temp >= 100 && temp < 1000)
- {
- ssd1306_draw_font(0, 0, font_bitmap[(temp/100)%10], sizeof(font_bitmap[(temp/100)%10]));
- ssd1306_draw_font(FONT_WIDTH, 0, font_bitmap[(temp/10)%10], sizeof(font_bitmap[(temp/10)%10]));
- ssd1306_draw_font(2*FONT_WIDTH, 0, font_bitmap[temp%10], sizeof(font_bitmap[temp%10]));
- }
- else
- {
- ssd1306_draw_font(0, 0, font_bitmap[9], sizeof(font_bitmap[9]));
- ssd1306_draw_font(FONT_WIDTH, 0, font_bitmap[9], sizeof(font_bitmap[9]));
- ssd1306_draw_font(2*FONT_WIDTH, 0, font_bitmap[9], sizeof(font_bitmap[9]));
- }
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////
- int main(int argc, char *argv[])
- {
- if (!map_peripheral(&gpio)) {
- printf("Failed to map the physical GPIO registers into the virtual memory space.\n");
- return -1;
- }
- if (!map_peripheral(&bsc0)) {
- printf("Failed to map the physical BSC0 (I2C) registers into the virtual memory space.\n");
- unmap_peripheral(&gpio);
- return -1;
- }
- if (!map_peripheral(&syst)) {
- printf("Failed to map the physical SYST registers into the virtual memory space.\n");
- unmap_peripheral(&gpio);
- unmap_peripheral(&bsc0);
- return -1;
- }
- i2c_init();
- // Initialize the SSD1306 OLED with an I2C addr = 0x3c (default address)
- BSC0_A = SSD1306_I2C_ADDRESS;
- ssd1306_init();
- // clear the display
- ssd1306_fill(0x00);
- draw_tempere(260);
- // unmap gpio and bsc0
- unmap_peripheral(&gpio);
- unmap_peripheral(&bsc0);
- unmap_peripheral(&syst);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement