Jump to content

Search the Community

Showing results for tags 'graphics'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • News
    • Announcements
    • Suggestions
    • New users say Hi!
  • Spotlight!
    • Sponsor Spotlight
    • Sponsor Giveaways
  • Energia
    • Energia - MSP
    • Energia - TivaC/CC3XXX
    • Energia - C2000
    • Energia Libraries
  • MSP Technical Forums
    • General
    • Compilers and IDEs
    • Development Kits
    • Programmers and Debuggers
    • Code vault
    • Projects
    • Booster Packs
    • Energia
  • Tiva-C, Hercules, CCXXXX ARM Technical Forums
    • General
    • SensorTag
    • Tiva-C, Hercules, CC3XXX Launchpad Booster Packs
    • Code Vault
    • Projects
    • Compilers and IDEs
    • Development Kits and Custom Boards
  • Beagle ARM Cortex A8 Technical Forums
    • General
    • Code Snippets and Scripts
    • Cases, Capes and Plugin Boards
    • Projects
  • General Electronics Forum
    • General Electronics
    • Other Microcontrollers
  • Connect
    • Embedded Systems/Test Equipment Deals
    • Buy, Trade and Sell
    • The 43oh Store
    • Community Projects
    • Fireside Chat
  • C2000 Technical Forums
    • General
    • Development Kits
    • Code Vault
    • Projects
    • BoosterPacks


There are no results to display.

Found 4 results

  1. I was trying to get the Tiva Launchpad TM4C123 working with the Nokia 5110 using Energia. Eventually I came across this page: http://www.clarenceho.net/2015/08/tm4c123-with-dht11-sensor.html You can follow the series of questions and answers through which Clarence Ho helped me get the combination working. You can see that he used a library originally by Rei Vilo, modified to add a contrast command. You can see also that Clarence has now added the jump-wire connections which are needed to link the Launchpad and LCD, near the top of the page. I then investigated graphics, and added Graphics commands to Rei Vilo's library - some were adapted from libraries designed to interface the 5110 to Arduinos. (I've quoted all sources in the file itself) You can see the result on this Youtube page: https://youtu.be/wCwyDiEfO_c As you can see, also included is a simple Pacman-style game using the Graphics commands. You may want to jump over the part showing Pacman game, if you want to try it yourself first. I've also now added another Pacman-style game - but generated randomly. There's a choice of ten sets of games (A-J), each with a potentially infinite number of levels. Note that although the games are generated randomly, the starting point for the random number generator used in each set of games is the same. So, GamesA for instance always has exactly the same levels. The Library and games can be downloaded from: https://dl.dropboxusercontent.com/u/17759511/LCD5100_Graphics.zip ... and of course, the Energia code is easy to edit, so you can adapt the programmes for your own needs. I hope they are of some use to those who arrive at this page looking for help with connecting the Nokia 5110 to the Tiva Launchpad TM4C123.
  2. While searching for a font creator I found an interesting one here: http://www.mikrocontroller.net/topic/99701#865331 It creates fontdata that are bit aligned so was a bit tricky to render but I have managed to create code that does that. By default it generates proportional fonts (from True Type) and also includes the top bit set characters that I need for my radio library. So, here is my initial code for rendering fonts generated by this utility - please note it is cannot handle fonts higher than 24 pixes. Add as font.h or to graphics.h: #include <stdbool.h> typedef struct Font { // common shared fields uint16_t font_Size_in_Bytes_over_all_included_Size_it_self; uint8_t font_Width_in_Pixel_for_fixed_drawing; uint8_t font_Height_in_Pixel_for_all_Characters; uint8_t font_Bits_per_Pixels; // if MSB are set then font is a compressed font uint8_t font_First_Char; uint8_t font_Last_Char; uint8_t font_Char_Widths[1]; // size dependent on number of glyphs uint8_t font_data[]; // bit field of all characters } Font; uint8_t getFontWidth (Font *font); uint8_t getFontHeight (Font *font); inline uint8_t getCharWidth (Font *font, unsigned char c); uint16_t getStringWidth (Font *font, unsigned char *string); uint8_t drawFontChar (Font *font, uint16_t x, uint16_t y, unsigned char c, bool opaque); void drawFontString (Font *font, uint16_t x, uint16_t y, unsigned char *string, bool opaque); Add to graphics.c - also include font.h if code above not added to graphics.h : static uint16_t getoffset (Font *font, unsigned char c) { uint16_t offset = 0; if(c > font->font_First_Char) { c -= font->font_First_Char; while(c--) { offset += font->font_Char_Widths[c]; }; } return offset; } uint8_t getFontWidth (Font *font) { return font->font_Width_in_Pixel_for_fixed_drawing; } uint8_t getFontHeight (Font *font) { return font->font_Height_in_Pixel_for_all_Characters; } uint8_t getCharWidth (Font *font, unsigned char c) { return c != ' ' && (c < font->font_First_Char || c > font->font_Last_Char) ? 0 : ((c == ' ' || font->font_Char_Widths[c - font->font_First_Char] == 0 ? font->font_Width_in_Pixel_for_fixed_drawing / 4 : font->font_Char_Widths[c - font->font_First_Char]) + 2); } uint16_t getStringWidth (Font *font, unsigned char *string) { unsigned char c; uint16_t width = 0; while((c = *string++)) { width += getCharWidth(font, c); } return width; } uint8_t drawFontChar (Font *font, uint16_t x, uint16_t y, unsigned char c, bool opaque) { uint8_t width = getCharWidth(font, c); uint32_t row, column, bitOffset, dataIndex, preShift, pixels; bool paintSpace; unsigned char *fontData = font->font_Char_Widths + font->font_Last_Char - font->font_First_Char + 1; if(width) { bitOffset = getoffset(font, c) * font->font_Height_in_Pixel_for_all_Characters; dataIndex = bitOffset >> 3; preShift = bitOffset - (dataIndex << 3); column = width; width -= 2; paintSpace = c == ' ' || !font->font_Char_Widths[c - font->font_First_Char]; if(!paintSpace || opaque) { x += column; while(column--) { row = font->font_Height_in_Pixel_for_all_Characters; if(!((column == 0) || (column > width)) && !paintSpace) { pixels = *((uint32_t *)&fontData[dataIndex]) >> preShift; while(row--) { if(pixels & 0x01) { setArea(x - column, y - row, x - column, y - row); writeData(colorHighByte); writeData(colorLowByte); } else if(opaque) { setArea(x - column, y - row, x - column, y - row); writeData(bgColorHighByte); writeData(bgColorLowByte); } pixels >>= 1; } bitOffset += font->font_Height_in_Pixel_for_all_Characters; dataIndex = bitOffset >> 3; preShift = bitOffset - (dataIndex << 3); } else if(opaque) { while(row--) { setArea(x - column, y - row, x - column, y - row); writeData(bgColorHighByte); writeData(bgColorLowByte); } } } } } return width == 0 ? 0 : width + 2; } void drawFontString (Font *font, uint16_t x, uint16_t y, unsigned char *string, bool opaque) { uint32_t xs = x; unsigned char c; while((c = *string++)) { xs += drawFontChar(font, xs, y, c, opaque); } } The font files has to be modified slightly before they can be used - it should be quite obvious what to remove. Example: drawFontString((Font *)pixelmix, 5, 100, "The lazy fox...", false); There are room for optimizations, but I'll leave that for later - my primary goal is to get the DAB project on air. Terje
  3. MSP432 version of my Universal Graphics Library. Works with my latest Color LCD BoosterPacks, 2.2" and 2.4" (320x240) Touch support will be added in late April. ugl432.zip
  4. Hi everyone, I did a quick port of these two libraries to Energia on Stellaris. You can find them here: https://github.com/jscrane/Adafruit-ST7735-Library https://github.com/jscrane/Adafruit-GFX-Library Note that I used digitalWrite() rather than messing with port registers. The speed doesn't seem too bad all the same. At the moment, I have only tested with hardware SPI. If you inspect the changes I had to make for Energia, it might help with porting further libraries to Stellaris. Cheers, Steve