// ------------------------------------------------------------ int main(void) { oled_port_prepare(); oled_reset(); oled_init(); oled_clear(); oled_flip_horizontal(0); oled_flip_vertical(0); oled_brightness(0xFF); /* oled_print(0,0,0,"1234567890"); oled_print(1,0,0,"ABCDEFGHIJKLMN"); oled_print(2,0,0,"OPQRSTUVWXYZ"); oled_print(3,0,0,"abcdefghijklmn"); oled_print(4,0,0,"opqrstuvwxyz"); oled_print(6,0,0,"^`_{|}:'<=>?@"); */ /* for(r=0; r<7; r++) // KAZKODEL SUSIGADINA STATIC VAIZDAS!!! { oled_write_cmd(0x10); oled_write_cmd(0x00); oled_write_cmd(0xB0+r); for (i=0;i<128;i++) { oled_write_data(picwilibox[pos++]); } } */ oled_print2(0, 0, "Wilibox"); oled_print2(0, 2, "-------"); oled_print2(0, 4, "1234567890"); oled_print(7,0,0,"123456789012345678901"); read_bit(BUTTON); write_bit(LED2_GRN, 0); oled_close(); return 0; }
// ------------------------------------------------------------ int main(int argc, char *argv[]) { int i; oled_port_prepare(); oled_reset(); oled_init(); oled_clear(); oled_flip_horizontal(0); oled_flip_vertical(0); oled_brightness(0xFF); if (argc < 2) { fprintf(stderr, "Usage: %s \"string1\" \"string2\"..\n", argv[0]); exit(EXIT_FAILURE); } for (i = 1; i < argc; i++) { oled_print2(0, 2 * (i - 1), argv[i]); } oled_close(); exit(EXIT_SUCCESS); }
void _backlight_set_brightness(int brightness) { oled_brightness(brightness); }
//******************************************************************************* void oled_init() { COLOR black = {0,0,0}; volatile unsigned long x,y; SETBIT(V5_SHUTDOWN_DDR, V5_SHUTDOWN_PNUM); CLRBIT(V5_SHUTDOWN_PORT, V5_SHUTDOWN_PNUM); OLED_DATA_LOW_DDR = 0xFF; //output OLED_DATA_MED_DDR = 0xFF; //output OLED_DATA_HIGH_DDR = 0xFF; //output OLED_CTRL_DDR |= (1<<OLED_DC) | (1<<OLED_CS) | (1<<OLED_RD) | (1<<OLED_WR) | (1<<OLED_RESET); for (x=0;x<100;x++) { /* Reset OLED */ CLRBIT(OLED_CTRL_PORT,OLED_RESET); } for (x=0;x<100;x++) { /* OLED ON */ SETBIT(OLED_CTRL_PORT,OLED_RESET); } dispCommand(kOLEDcmd_IFselect); dispCommand(kOLEDcmd_RGBinterfaceControl); dispData(0x0000); dispCommand(kOLEDcmd_EntryMode); // dispData(0x8030); dispData(0x8031); dispCommand(kOLEDcmd_StandbyMode); //standby off dispData(0x0000); //delay for(y=0;y<5000;y++) for(x=0;x<10; x++) { asm("nop"); } SETBIT(OLED_SUPPLY_PORT,OLED_SUPPLY_PNUM); SETBIT(OLED_SUPPLY_DDR,OLED_SUPPLY_PNUM); //turn on supply for(y=0;y<5000;y++) for(x=0;x<10; x++) { asm("nop"); } dispCommand(kOLEDcmd_DisplayControl1); //display on dispData(0x0001); oled_brightness(1); //low brightness dispCommand(kOLEDcmd_GRAMread_write); //write / read graphics data dispColor(black); dispClearScreen(); }