void u8g_setup(void) { /* Test Envionment 1, ATMEGA and DOGM132 CS: PORTB, Bit 2 A0: PORTB, Bit 1 SCK: PORTB, Bit 5 MOSI: PORTB, Bit 3 */ u8g_InitSPI(&u8g, &u8g_dev_st7565_dogm132_sw_spi, PN(1, 5), PN(1, 3), PN(1, 2), PN(1, 1), U8G_PIN_NONE); /* Test Envionment 2, ATMEGA and Seeedstudio 96x96 OLED via I2C SCL: Port C, Bit 5 SDA: Port C, Bit 4 */ /* activate pull-up, set ports to output, init U8glib */ //u8g_SetPinInput(PN(2,5)); u8g_SetPinLevel(PN(2,5), 1); u8g_SetPinOutput(PN(2,5)); //u8g_SetPinInput(PN(2,4)); u8g_SetPinLevel(PN(2,4), 1); u8g_SetPinOutput(PN(2,4)); //u8g_InitI2C(&u8g, &u8g_dev_ssd1327_96x96_gr_i2c, U8G_I2C_OPT_NONE); /* Test Envionment 3, ATMEGA and NHD 192x32 ST7920 special SPI R/W, MOSI, Red: Port C, Bit 5 RS, CS, Yellow: Port C, Bit 4 EN, SCK, Green: Port C, Bit 3 Arguments for u8g_InitSPI are: SCK, MOSI, CS, A0, Reset A0 and Reset are not used. */ // u8g_InitSPI(&u8g, &u8g_dev_st7920_192x32_sw_spi, PN(2, 3), PN(2, 5), PN(2, 4), U8G_PIN_NONE, U8G_PIN_NONE); // u8g_InitHWSPI(&u8g, &u8g_dev_st7920_192x32_hw_spi, PN(2, 4), U8G_PIN_NONE, U8G_PIN_NONE); }
void setup(void) { /* Test Envionment, ATMEGA with the following settings: CS: PORTB, Bit 2 A0: PORTB, Bit 1 SCK: PORTB, Bit 5 MOSI: PORTB, Bit 3 */ /* 1. Setup and create u8g device */ u8g_InitSPI(&u8g, &u8g_dev_st7565_dogm132_sw_spi, PN(1, 5), PN(1, 3), PN(1, 2), PN(1, 1), U8G_PIN_NONE); /*u8g_InitHWSPI(&u8g, &u8g_dev_st7565_dogm132_hw_spi, PN(1, 2), PN(1, 1), U8G_PIN_NONE);*/ /* 2. Setup m2 */ m2_Init(&el_align, m2_es_avr_u8g, m2_eh_4bs, m2_gh_u8g_bfs); /* 3. Connect u8g display to m2 */ m2_SetU8g(&u8g, m2_u8g_box_icon); /* 4. Set a font, use normal u8g_font's */ m2_SetFont(0, (const void *)u8g_font_5x8r); /* 5. Define keys */ m2_SetPin(M2_KEY_EXIT, PN(3, 5)); m2_SetPin(M2_KEY_SELECT, PN(3, 6)); m2_SetPin(M2_KEY_NEXT, PN(3, 7)); m2_SetPin(M2_KEY_PREV, PN(1, 7)); }
uint8_t u8g_InitSPIDogm128API(u8g_dev_t *dev, uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset) { if ( u8g_InitSPI(&u8g_dogm128_obj, dev, sck, mosi, cs, a0, reset) == 0 ) return 0; u8g_init_dogm_common(); return 1; }
void u8g_setup(void) { /* Test Envionment: ATTINY84 and DOGM132 CS: PORTB, Bit 0 A0: PORTB, Bit 1 SCK: PORTA, Bit 4 MOSI: PORTA, Bit 5 */ u8g_InitSPI(&u8g, &u8g_dev_st7565_dogm132_sw_spi, PN(0, 4) , PN(0, 5), PN(1, 0), PN(1, 1), U8G_PIN_NONE); }
void display_init(void) { /* select minimal prescaler (max system speed) */ CLKPR = 0xFF; // SCK MOSI CS D/C u8g_InitSPI(&u8g, &u8g_dev_ssd1325_nhd27oled_2x_gr_sw_spi, PN(5, 6), PN(5, 5), PN(4, 7),PN(5,7), PN(4,6)); u8g_SetRot180(&u8g); /* assign default color value */ u8g_SetColorIndex(&u8g, 3); /* max intensity */ // u8g_SetColorIndex(&u8g, 1); /* pixel on */ u8g_SetFont(&u8g, u8g_font_profont11); u8g_SetFontRefHeightExtendedText(&u8g); u8g_SetDefaultForegroundColor(&u8g); u8g_SetFontPosTop(&u8g); }
uint8_t U8GLIB::initSPI(u8g_dev_t *dev, uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset) { prepare(); return u8g_InitSPI(&u8g, dev, sck, mosi, cs, a0, reset); }