void ST7920_Lite_Status_Screen::load_cgram_icon(const uint16_t addr, const void *data) { const uint16_t *p_word = (const uint16_t *)data; set_cgram_address(addr); begin_data(); for (uint8_t i = 16; i--;) write_word(pgm_read_word(p_word++)); }
int main(int argc, char **argv) { int check_busy = 0; if (argc < 3) usage(); //init spi oled init_spi_oled(argv[1]); argc-=2; argv+=2; while (argc >= 1) { const char *cmd = argv[0]; int args = 0; if (strcmp(cmd, "-B") == 0) { check_busy = 0; args = 1; check_busy_flag3(atoi(argv[1])); } if (strcmp(cmd, "-b") == 0) check_busy = 1; if (check_busy) check_busy_flag(); if (strcmp(cmd, "-f") == 0) { select_font(atoi(argv[1])); args = 1; } if (strcmp(cmd, "-e") == 0) { entry_mode_set(atoi(argv[1]), atoi(argv[2])); args = 2; } if (strcmp(cmd, "-m") == 0) { display_mode(atoi(argv[1]), atoi(argv[2]), atoi(argv[3])); args = 3; } if (strcmp(cmd, "-c") == 0) clear_display(); if (strcmp(cmd, "-g") == 0) { set_ddram_address(atoi(argv[1]) * 0x40 + atoi(argv[2])); args = 2; } if (strcmp(cmd, "-a") == 0) { set_ddram_address(strtoul(argv[1], NULL, 0)); args = 1; } if (strcmp(cmd, "-A") == 0) { set_cgram_address(strtoul(argv[1], NULL, 0)); args = 1; } if (strcmp(cmd, "-w") == 0) { write_data(strtoul(argv[1], NULL, 0)); args = 1; } if (strcmp(cmd, "-h") == 0) return_home(); if (strcmp(cmd, "-C") == 0) { shift_cursor(*argv[1] == 'r'); args = 1; } if (strcmp(cmd, "-S") == 0) { shift_display(*argv[1] == 'r'); args = 1; } if (strcmp(cmd, "-t") == 0) { write_str(argv[1]); args = 1; } if (*cmd != '-') write_str(cmd); check_busy = 1; argc -= 1 + args; argv += 1 + args; } }