2015-11-30 05:05:50 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <Arduino.h>
|
|
|
|
#include <SPI.h>
|
|
|
|
|
2015-12-13 00:26:10 +08:00
|
|
|
#include "U8x8lib.h"
|
2015-12-07 00:45:57 +08:00
|
|
|
|
2015-12-06 05:43:30 +08:00
|
|
|
|
|
|
|
/*=============================================*/
|
|
|
|
/* display setup procedures */
|
2015-11-30 05:05:50 +08:00
|
|
|
|
|
|
|
|
2015-12-05 20:10:33 +08:00
|
|
|
u8x8_t u8x8;
|
2015-11-30 05:05:50 +08:00
|
|
|
uint8_t tile[8] = { 0x0f, 0x0f, 0x0f, 0x0f, 0xf0, 0xf0, 0xf0, 0xf0 };
|
|
|
|
|
|
|
|
void setup(void)
|
|
|
|
{
|
2015-12-06 05:43:30 +08:00
|
|
|
pinMode(7, OUTPUT);
|
|
|
|
pinMode(9, OUTPUT);
|
|
|
|
pinMode(10, OUTPUT);
|
|
|
|
digitalWrite(7, 0); // default output in I2C mode for the SSD1306 test shield
|
|
|
|
digitalWrite(9, 0); // default output in I2C mode for the SSD1306 test shield: set the i2c adr to 0
|
|
|
|
digitalWrite(10, 0); // default output in I2C mode for the SSD1306 test shield
|
|
|
|
|
2015-12-07 00:45:57 +08:00
|
|
|
//u8x8_Setup_3Wire_SW_SPI(&u8x8, u8x8_d_ssd1306_128x64_noname, 13, 11, 10, 8);
|
2015-12-24 01:44:00 +08:00
|
|
|
//u8x8_Setup_4Wire_SW_SPI(&u8x8, u8x8_d_ssd1306_128x64_noname, 13, 11, 10, 9, 8);
|
2015-12-07 00:45:57 +08:00
|
|
|
//u8x8_Setup_4Wire_HW_SPI(&u8x8, u8x8_d_ssd1306_128x64_noname, 10, 9, 8);
|
|
|
|
|
2015-12-24 01:44:00 +08:00
|
|
|
u8x8_Setup_SSD13xx_SW_I2C(&u8x8, u8x8_d_ssd1306_128x64_noname, 13, 11, 8);
|
2015-12-12 20:05:14 +08:00
|
|
|
//u8x8_Setup_8Bit_6800(&u8x8, u8x8_d_ssd1306_128x64_noname, 13, 11, 2, 3, 4, 5, 6, A4, /*enable=*/ 7, /*cs=*/ 10, /*dc=*/ 9, /*reset=*/ 8);
|
2015-12-09 04:30:14 +08:00
|
|
|
//u8x8_Setup_8Bit_8080(&u8x8, u8x8_d_ssd1306_128x64_noname, 13, 11, 2, 3, 4, 5, 6, A4, /*enable=*/ 7, /*cs=*/ 10, /*dc=*/ 9, /*reset=*/ 8);
|
2015-12-06 05:43:30 +08:00
|
|
|
|
2015-12-12 20:05:14 +08:00
|
|
|
//u8x8_Setup_4Wire_SW_SPI(&u8x8, u8x8_d_uc1701_dogs102, 13, 11, 10, 9, 8);
|
|
|
|
//u8x8_Setup_4Wire_HW_SPI(&u8x8, u8x8_d_uc1701_dogs102, 10, 9, 8);
|
2015-11-30 05:05:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void loop(void)
|
|
|
|
{
|
2015-12-07 06:22:52 +08:00
|
|
|
u8x8_InitDisplay(&u8x8);
|
2015-12-08 04:34:49 +08:00
|
|
|
//u8x8_SetFlipMode(&u8x8, 1);
|
2015-11-30 05:05:50 +08:00
|
|
|
|
2015-12-06 05:43:30 +08:00
|
|
|
//digitalWrite(9, 0); // default output in I2C mode for the SSD1306 test shield: set the i2c adr to 0
|
2015-11-30 05:05:50 +08:00
|
|
|
|
|
|
|
for(;;)
|
|
|
|
{
|
2015-12-20 17:10:49 +08:00
|
|
|
u8x8_ClearDisplay(&u8x8);
|
2015-12-08 04:34:49 +08:00
|
|
|
u8x8_SetPowerSave(&u8x8, 0);
|
2015-12-08 05:14:17 +08:00
|
|
|
//u8x8_SetContrast(&u8x8, 10);
|
2015-11-30 05:05:50 +08:00
|
|
|
|
2015-12-06 05:43:30 +08:00
|
|
|
//delay(500);
|
2015-11-30 05:05:50 +08:00
|
|
|
|
2015-12-05 20:10:33 +08:00
|
|
|
u8x8_SetFont(&u8x8, u8x8_font_chroma48medium8_r);
|
|
|
|
u8x8_DrawString(&u8x8, 0, 0, "Hello World");
|
|
|
|
u8x8_DrawString(&u8x8, 3, 1, "ABCdefg");
|
2015-11-30 05:05:50 +08:00
|
|
|
|
2015-12-08 05:14:17 +08:00
|
|
|
u8x8_DrawTile(&u8x8, 1, 1, 1, tile);
|
|
|
|
u8x8_DrawTile(&u8x8, 2, 2, 1, tile);
|
|
|
|
u8x8_DrawTile(&u8x8, 3, 3, 1, tile);
|
|
|
|
u8x8_DrawTile(&u8x8, 4, 4, 1, tile);
|
|
|
|
u8x8_DrawTile(&u8x8, 5, 5, 1, tile);
|
|
|
|
u8x8_DrawTile(&u8x8, 6, 6, 1, tile);
|
2015-11-30 05:05:50 +08:00
|
|
|
|
2015-12-06 05:43:30 +08:00
|
|
|
//delay(2000);
|
2015-11-30 05:05:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|