install - olikraus/dogm128 GitHub Wiki
Install Instructions for Arduino Hardware
NOTE: It is now required to edit dogm128.h for ALL display types
This library has been tested with the Arduino-0022 IDE.
- Download latest version of dogm128_arduino_vX.XX.zip
- cd /libraries
- unzip dogm128_vX.XX.zip
- cd /libraries/Dogm/utility/
- edit file dogm128.h and uncomment your display hardware (DOGM128, DOGS102, DOGM132 or DOGXL160)
- Optional: Edit file dogm128.h and uncomment DOG_REVERSE (change top/bottom view) and/or DOG_DOUBLE_MEMORY (see Configuration)
- (re)start the Arduino IDE
- Dogm128 examples are available under
File > Examples > Dogm
Note: Breakorino has not been ported to DOGM132
Install Instructions for Atmel AVR ATTINY and ATMEGA Microcontroller
The ATTINY port of the library is available with Release v1.04.
The ATMEGA port of the library is available with Release v1.07.
- Setup Environment
* GNU C Compiler for Atmel AVR (
sudo apt-get install gcc-avr) * Atmel AVR Programmer avrdude (sudo apt-get install avrdude) * gnu make * Programmer Hardware for Atmel ISP interface (See http://www.atmel.com/products/avr/ or http://en.wikipedia.org/wiki/Atmel_AVR) - Download latest version of dogm128_avr_vX.XX.zip
- Extract zip file and change directory to graphics test example
- Change the
Makefileaccording to your hardware (See also the ATTINY schematic or ATMEGA schematic and the information according configuration below) *MCU:=attiny84*MCU:=atmega88
Add the name of the target device. Valid names are reported with the avr-gcc -dumpspec command. MCU names (devices) are also listed here: http://www.nongnu.org/avr-libc/user-manual/index.html *
F_CPU:=8000000Set the frequency of the target environment. The examples of this library will try to assign maximum speed. *DOGDEFS = -DDOGM132_HWSelect display (DOGM128_HW, DOGM132_HW or DOGS102_HW) *DOGDEFS += -DDOG_SPI_USISelect controller interface. Possible values are: DOG_SPI_ATMEGA, DOG_SPI_USI or DOG_SPI_ARDUINO (which is also used, if nothing is defined). *DOGDEFS += -DDOG_SPI_CS_PORT=B -DDOG_SPI_CS_PIN=0I/O port and bit number which is connected to the chip select line of the display. *DOGDEFS += -DDOG_SPI_A0_PORT=B -DDOG_SPI_A0_PIN=1I/O port and bit number which is connected to the A0 line of the display. *DOGDEFS += -DDOG_SPI_SCL_PORT=A -DDOG_SPI_SCL_PIN=4Port and pin of the SCL output line of the Atmel AVR USI interface *DOGDEFS += -DDOG_SPI_DO_PORT=A -DDOG_SPI_DO_PIN=5Port and pin of the DO output line of the Atmel AVR USI interface * Optional: AddDOGDEFS += -DDOG_REVERSEExchange top/bottom view
- Create hex-file and upload the hexfile to the controller:
make upload - Setup a new project:
* Create a new directory, copy the modified Makefile into the new directory.
*
TARGETNAME = project_name
Assign the project name. *
DOGDIR = ../../lib/Set the location of the dogm128 library if required. *SRC = file1.c file2.c file3.cAdd list of the c-files of the project.
Configuration
The following tables provide the name of C-Macros. These C-Macros can be used to configure the target environment. These C-Macros can be defined on the command line or in the file dogm128.h.
Display Type
Use one of the following Macros to select the display type.
The display can be selected in dogm128.h.
| C-Macro | Description |
|---|---|
| DOGM128_HW | DOGM128 Display |
| DOGS102_HW | DOGS102 Display |
| DOGM132_HW | DOGM132 Display |
| DOGXL160_HW_BW | DOGXL160 Display, black and white mode (v1.08) |
| DOGXL160_HW_GR | DOGXL160 Display, graylevel support (v1.08) |
| nothing defined | Compile Error |
For the DOGXL160 this library supports two different modes. BW mode is faster, but only allows two values per pixel (on and off). GR mode supports four values per pixel.
Display Orientation (DOG_REVERSE)
Use the following Macro to rotate the display by 180 degree.
This macro can be enabled in dogm128.h.
| C-Macro | Description |
|---|---|
| DOG_REVERSE | 180 degree rotation |
| nothing defined | no rotation |
Page Memory Size (DOG_DOUBLE_MEMORY)
Use the following Macro to tune speed vs. memory usage (available: v1.08 and above).
This macro can be enabled in dogm128.h.
| C-Macro | Description |
|---|---|
| DOG_DOUBLE_MEMORY | Faster drawing function, but will require more RAM |
| nothing defined | Slower drawing function, but minimal RAM usage |
The following shows the page buffer size for the selected display.
| Display | without DOG_DOUBLE_MEMORY | enabled DOG_DOUBLE_MEMORY |
|---|---|---|
| DOGM128_HW | 128 Bytes | 256 Bytes |
| DOGS102_HW | 104 Bytes | 208 Bytes |
| DOGM132_HW | 132 Bytes | 264 Bytes |
| DOGXL160_HW_BW | 160 Bytes | 320 Bytes |
| DOGXL160_HW_GR | 160 Bytes | 320 Bytes |
SPI Interface Selection
All macro definitions in this section can be done either at the commandline or
directly in the C-file dogmspi.c.
Use one of the following Macros to select the SPI interface.
| C-Macro | Description |
|---|---|
| DOG_SPI_USI | Universal Serial Interface of ATTINY controller |
| DOG_SPI_ATMEGA | ATMEGA SPI Interface (v1.07 and above) |
| DOG_SPI_ARDUINO | SPI Interface for ATMEGA within Arduino Environment (v1.07 and above) |
| nothing defined | defaults to DOG_SPI_ARDUINO |
Some selections require additional definitions for the port pins. The macro definitions could have the following form:
avr-gcc -DDOG_SPI_SCL_PORT=A -DDOG_SPI_SCL_PIN=0
| Macro Name | Valid Range |
|---|---|
| DOG_SPI_x_PORT | Singe Char Port Name |
| DOG_SPI_x_PIN | Number 0 to 7 |
In many cases the functionality of the pin requires, that the pin is bound to a specific hardware pin.
Port Definition DOG_SPI_USI
| Macro Names | Description | Restrictions |
|---|---|---|
| DOG_SPI_SCL_PORT, DOG_SPI_SCL_PIN | SPI Clock Line | The corresponding HW pin must be used |
| DOG_SPI_DO_PORT, DOG_SPI_DO_PIN | SPI Data Out Line | The corresponding HW pin must be used |
| DOG_SPI_CS_PORT, DOG_SPI_CS_PIN | Chip Select Line | Any i/o pin may be used |
| DOG_SPI_A0_PORT DOG_SPI_A0_PIN | Adress Select Line | Any i/o pin may be used |
Port Definition DOG_SPI_ATMEGA (v1.07 and above)
| Macro Names | Description | Restrictions |
|---|---|---|
| DOG_SPI_SCL_PORT, DOG_SPI_SCL_PIN | SPI Clock Line | The corresponding HW pin must be used |
| DOG_SPI_MOSI_PORT, DOG_SPI_MOSI_PIN | SPI Master Out Line | The corresponding HW pin must be used |
| DOG_SPI_SS_PORT, DOG_SPI_SS_PIN | Slave (Chip) Select Line | The corresponding HW pin must be used |
| DOG_SPI_A0_PORT DOG_SPI_A0_PIN | Adress Select Line | Any i/o pin may be used |