Skip to content

internal

olikraus edited this page Jul 28, 2016 · 61 revisions

Rebuild

Rebuilding a all font c code, font pictures and all font related md (Github markdown) files:

tools/font/build$ make clean
tools/font/build$ make build1
tools/font/build$ ./build1
tools/font/build$ make clean
tools/font/build$ make build2
tools/font/build$ ./build2

The font pictures must be copied manually to the wiki:

tools/font/build$ cp *.png ~/git/u8g2.wiki/fntpic/.

Some pictures are too large for the build processor. These pictures have to be generated with bdfconv. After this, overwrite the incomplete pictures.

tools/font/bdfconv$ make chinese
tools/font/bdfconv$ cp u8g2_font_*.png ~/git/u8g2.wiki/fntpic/.

The updated font md files will clear the TOC. This has to be rebuild also:

tools/mdtoc$ make wiki

The makefile target "wiki" will update all markdown files in the wiki. All modified markdown files will get a generated table of content. Labels are inserted before and after the TOC. Do not delete these labels.

To update the examples, call the .ino updater:

tools/inoupdate$ make ino

This will the constructor list for the examples.

New Displays

Display Procedure

Every display has its own display procedure. All display specific communication happens through this procedure. The procedure should be located in a c file with the prefix u8x8_d_ and the function name must have the following form: u8x8_d_<controller>_<display>()

Example:

uint8_t u8x8_d_<controller>_<display>(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
{
  uint8_t x, c;
  uint8_t *ptr;
  switch(msg)
  {
    case U8X8_MSG_DISPLAY_SETUP_MEMORY:
      // make a call to u8x8_d_helper_display_setup_memory 
      // do NOT communicate with the display 
      u8x8_d_helper_display_setup_memory(u8x8, <adr of display info struct>);
      break;
    case U8X8_MSG_DISPLAY_INIT:
      // setup the communication interface
      // init the display by sending an init sequence
      u8x8_d_helper_display_init(u8x8);  
      u8x8_cad_SendSequence(u8x8, <adr of the init sequence>);
      break;
    case U8X8_MSG_DISPLAY_SET_POWER_SAVE:
      // arg_int == 0: wakeup, normal mode
      // arg_int == 1: power safe 
      ...
      break;
#ifdef U8X8_WITH_SET_FLIP_MODE
    case U8X8_MSG_DISPLAY_SET_FLIP_MODE:
      // This case should be compiled only with U8X8_WITH_SET_FLIP_MODE
      // arg_int == 0: normal, native orientation
      // arg_int == 1: 180 degree rotation
      ...
      break;
#endif
#ifdef U8X8_WITH_SET_CONTRAST
    case U8X8_MSG_DISPLAY_SET_CONTRAST:
      // This case should be compiled only with U8X8_WITH_SET_CONTRAST
      // arg_int: 0 (no contrast/brightness) to 255 (max contrast/brightness)
      ...
      break;
#endif
    case U8X8_MSG_DISPLAY_DRAW_TILE:
      /* arg_ptr: (u8x8_tile_t *) */
      /* arg_int: How often u8x8_tile_t should be repeated */
      ...
      break;
    default:
      return 0;
  }
  return 1;
}

Update u8x8.h

The prototype of the display procedure

uint8_t u8x8_d_<controller>_<display>(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)

has to be added to u8x8.h

Rebuild Code

Locate

tools/codebuild$ 

Update the C file with the new controller/display. Then rebuild the code with

tools/codebuild$ make build

Release

Arduino IDE

Library

A library, which has been installed via local zip file, is located in the "Arduino/libraries" folder.

Test Devices

Digispark ATTiny Model A (LED at Pin 1)

Images

  • LED light, white background
  • ISO 200, Cloud, 1/60 (A)

Defines

GCC

  • Show gcc buildin macros: gcc -dM -E - < /dev/null

F_CPU

  • F_CPU must be defined and must expand to the CPU frequency in hertz (e.g. -DF_CPU=16000000L)

Identify Environment

  • ARDUINO: Version number of the Arduino Environment. 100 for 1.00.

  • __AVR__: Atmel AVR

  • __18CXX: MPLAB C18 (PIC)

  • __PIC32MX: PIC32

  • __XC8 MPLAB XC8 Compiler (Microchip)

  • __PIC18 MPLAB XC8 Compiler with selected PIC18 device

  • __arm__: GCC ARM (Arduino Due)

  • __SAM3X8E__: Arduino Due

  • __AVR_ARCH__: Values 2 and 25 are ATTiny

  • __XTENSA__, __xtensa__: gcc predefined for xtensa architecture (ESP8266)

  • ARDUINO_ARCH_ESP8266, ESP8266: Defined by the esp8266 Arduino board file

  • __AVR_ARCH__: Build-in macro that resolves to a decimal number that identifies the architecture. Possible values are:

    • 2: avr2, ATTiny
    • 25: avr25, ATTiny with MOVW instruction
    • 3: avr3
    • 31: avr31
    • 35: avr35 (ata5505, ata6617c, ata664251, atmega16u2, atmega32u2, atmega8u2, attiny1634, attiny167, at90usb162, at90usb82)
    • 4: avr4 (ATMega with 8KB)
    • 5: avr5 (ATMega with 16KB to 64KB)
    • 51: avr51 (ATMega with 128KB)
    • 6: avr6 (ATMega with > 128KB)

    for mcu=avr2, avr25, avr3, avr31, avr35, avr4, avr5, avr51, avr6,

Upload to Arduino Due on Linux

Often the following code seems to be required (enter on terminal):

stty -F /dev/ttyACM0 speed 1200 cs8 -cstopb -parenb

TTF to BDF

Usually, the following options should be used

8x8 Fonts:

otf2bdf -r 72 -p 8 <ttf-file> -o <bdf-file>

16x16 Fonts:

otf2bdf -r 72 -p 16 <ttf-file> -o <bdf-file>
Clone this wiki locally