// enc 0 : scroll page void handle_enc_1(s32 val) { if(val > 0) { set_page(ePageDsp); } else { set_page(ePagePresets); } }
// enc 0 : scroll page void handle_enc_2(s32 val) { if(val > 0) { set_page(ePageScenes); } else { set_page(ePageOuts); } }
t_page *page_push(t_page *first, size_t size) { t_page *tmp; char type; type = ft_get_type(size); if (!first) { first = (void *)mmap(0, get_max_size(type, size) + 40, FLAGS); if (first == MAP_FAILED) print_error("MAPPING FAILED"); first = set_page(first, type); } else { tmp = first; while (tmp->next) tmp = tmp->next; tmp->next = (void *)mmap(0, get_max_size(type, size) + 40, FLAGS); if (tmp->next == MAP_FAILED) print_error("MAPPING FAILED"); tmp->next = set_page(tmp->next, type); tmp = tmp->next; return (tmp); } return (first); }
void handle_enc_2(s32 val) { // scroll page if(val > 0) { set_page(ePageIns); } else { set_page(ePageDsp); } }
void handle_enc_1(s32 val) { // scroll page if(val > 0) { set_page(ePageOuts); } else { set_page(ePageOps); } }
void handle_enc_2(s32 val) { // scroll page if(val > 0) { set_page(ePageOps); } else { set_page(ePageScenes); } }
void handle_enc_1(s32 val) { if(targetSelect) { targetSelect = 0; redraw_outs(); } // scroll page if(val > 0) { set_page(ePagePresets); } else { set_page(ePageIns); } }
static void load_instrument_handle_key(struct key_event * k) { if (k->state == KEY_RELEASE) return; if (k->sym == SDLK_ESCAPE && NO_MODIFIER(k->mod)) set_page(PAGE_INSTRUMENT_LIST); }
void Fl_Gdi::page() { if(nPages) EndPage(gc_); nPages++; set_page(1); }
/* NOTE: ptr should be dynamically allocated, or NULL */ static void do_save_song(char *ptr) { int ret, export = (status.current_page == PAGE_EXPORT_MODULE); const char *filename = ptr ?: song_get_filename(); const char *seltype = NULL; struct widget *widget; set_page(PAGE_LOG); // 4 is the index of the first file-type button for (widget = (export ? widgets_exportmodule : widgets_savemodule) + 4; widget->type == WIDGET_TOGGLEBUTTON; widget++) { if (widget->d.togglebutton.state) { // Aha! seltype = widget->d.togglebutton.text; break; } } if (!seltype) { // No button was selected? (should never happen) log_appendf(4, "No file format selected?"); ret = SAVE_INTERNAL_ERROR; } else if (export) { ret = song_export(filename, seltype); } else {
static int hdmi_read(uint8_t page, uint8_t reg, uint8_t * val) { int r; if (val == NULL) { log_warn(&log, "Read called with NULL pointer\n"); return EINVAL; } if (page != HDMI_PAGELESS) { r = set_page(page); if (r != OK) { log_warn(&log, "Unable to set page to 0x%x\n", page); return r; } } r = i2creg_read8(hdmi_bus_endpoint, hdmi_address, reg, val); if (r != OK) { log_warn(&log, "hdmi_read() failed (r=%d)\n", r); return -1; } log_trace(&log, "Read 0x%x from reg 0x%x in page 0x%x\n", *val, reg, page); return OK; }
// function key handlers void handle_key_0(s32 val) { if(val == 0) { return; } if(altMode) { ///// follow // select target on ins page tmpTarget = net_get_target(*pageSelect); if(tmpTarget >= 0) { pages[ePageIns].select = tmpTarget; set_page(ePageIns); redraw_ins(); } } else { // store // show selected preset name draw_preset_name(); if(check_key(0)) { // store in preset net_set_out_preset(*pageSelect, 1); preset_store_out(preset_get_select(), *pageSelect); // redraw selected line render_line(*pageSelect, 0xa); render_scroll_apply_hl(SCROLL_CENTER_LINE, 1); // TODO: store directly in scene? } } show_foot(); }
//开机初始化 void All_Init( void ) { const uint32_t NewDeviationAddr = 0x4000; /* BootLoad引导程序时,必须在Main中添加,同时更改“魔术棒--Target选项卡的ROM偏移地址” */ NVIC_SetVectorTable(NVIC_VectTab_FLASH,NewDeviationAddr); /* 外设初始化 */ lcd_init(); rtc_init(); led_init(); uart3_init(BAUD_38400); print_init(); //波特率19200 timeout_init(); TIM5_TimeoutInit(); link_init(); tf_init(); eep_init(); delay_init_t2(); beep_init(); SysTick_Config(SYSTICK_10MS); // PrintSystemParameter(); //串口打印系统参数信息,用于调试 #ifdef ENABLE_BEEP BEEP_START(); #endif set_page(system_init); }
//读取flash参数 void read_flash( void ) { lcd_clear(BLACK); if (FR_OK != lcd_font16(0,0,BLACK,BLACK," ","song16.zk") ) { lcd_mem_err(250,200,RED,BLACK); while (1); } pcm_read(); //从flash读取上位机参数 prm_read(); //从flash区读取系统参数 prv_read(); //从flash读取特权参数 pHmi = pcm_hmi_get(); //获取人机界面的杂项参数 formate_flash(); //格式化FLASH pTest = pcm_test_get(pHmi->test_standard_index); //从FLASH获取试验索引以及数据,放入内存 smpl_name = KZ_KY_judge(pHmi->test_standard_index); //判断当前通道,为了后面设置保护模式 cur_model = cur_model_get(); //获取机型 cur_model_type = model_type_get(); //获取机型类型 // LCD_light_set(pHmi->lcd_light_use); //设置背光 boot_link(); //上电后联机 LinkInit(); //与PC联机初始化 set_page(mainpage); //默认进入主界面 }
static void do_enable_inst(UNUSED void *d) { song_set_instrument_mode(1); main_song_changed_cb(); set_page(PAGE_INSTRUMENT_LIST); memused_songchanged(); }
/* on the file list, that is */ static void handle_enter_key(void) { dmoz_file_t *file; int cur = instrument_get_current(); if (current_file < 0 || current_file >= flist.num_files) return; file = flist.files[current_file]; dmoz_cache_update(inst_cwd, &flist, NULL); if (file->type & TYPE_BROWSABLE_MASK) { change_dir(file->path); status.flags |= NEED_UPDATE; } else if (file->type & TYPE_INST_MASK) { if (_library_mode) return; status.flags |= SONG_NEEDS_SAVE; if (file->instnum > -1) { song_load_instrument_ex(cur, NULL, file->path, file->instnum); } else { song_load_instrument(cur, file->path); } if (!song_is_instrument_mode()) { dialog_create(DIALOG_YES_NO, "Enable instrument mode?", do_enable_inst, dont_enable_inst, 0, NULL); } else { set_page(PAGE_INSTRUMENT_LIST); } memused_songchanged(); } /* TODO */ }
static int reg_read_range(struct tda998x_priv *priv, u16 reg, char *buf, int cnt) { struct i2c_client *client = priv->hdmi; u8 addr = REG2ADDR(reg); int ret; mutex_lock(&priv->mutex); ret = set_page(priv, reg); if (ret < 0) goto out; ret = i2c_master_send(client, &addr, sizeof(addr)); if (ret < 0) goto fail; ret = i2c_master_recv(client, buf, cnt); if (ret < 0) goto fail; goto out; fail: dev_err(&client->dev, "Error %d reading from 0x%x\n", ret, reg); out: mutex_unlock(&priv->mutex); return ret; }
void Fl_Gdi::margins(double left, double top, double right ,double bottom) { lm_=left; tm_=top; rm_=right; bm_=bottom; if(nPages) set_page(0); };
void put_line(uint8_t page) { set_page(page); set_0_column(); int i; D7_to_D0(0x10); for (i = 0; i < 132; i++) { send(); } }
void put_image(int weather1[], int weather2[]) { //set_page(SPLC501C_PAGE_ADDRESS | 2); int i, j, k; //while(1) //{ for(k = 0; k < 3; k++) { for(i = 0; i < 4; i++) { set_page(2 + i); set_66_column(); D7_to_D0(0xFF); send(); for(j = 0; j < 64; j++) { D7_to_D0(weather1[(64*i)+j]); send(); } } Delayms(200); for(i = 0; i < 4; i++) { set_page(2 + i); set_66_column(); D7_to_D0(0xFF); send(); for(j = 0; j < 64; j++) { D7_to_D0(weather2[(64*i)+j]); send(); } } Delayms(200); //} } }
// function keys void handle_key_0(s32 val) { if(val == 0) { return; } if(check_key(0)) { // select op's inputs on ins page pages[ePageIns].select = net_op_in_idx(*pageSelect, 0); print_dbg("\r\n got 1st input index for selected op ( "); print_dbg_ulong( *pageSelect ); print_dbg(", result : "); print_dbg_ulong( net_op_in_idx(*pageSelect, 0)); // go to inputs page set_page(ePageIns); redraw_ins(); } show_foot(); }
static void reg_write16(struct tda998x_priv *priv, uint16_t reg, uint16_t val) { struct i2c_client *client = priv->hdmi; uint8_t buf[] = {REG2ADDR(reg), val >> 8, val}; int ret; ret = set_page(priv, reg); if (ret < 0) return; ret = i2c_master_send(client, buf, sizeof(buf)); if (ret < 0) dev_err(&client->dev, "Error %d writing to 0x%x\n", ret, reg); }
void put_wuja(int* w) { int i,j; //set_page(0); for(i=0;i<8;i++) { set_page(i); set_0_column(); for(j=0;j<110;j++) { D7_to_D0(w[(110*i)+j]); send(); } } }
void details(char* day, char* temp, char* wind_force, char* wind_dir, char* state, int ii) { char t[12]; set_page(0); set_0_column(); write_text(day); set_page(2); set_0_column(); strcpy(t, ""); strcat(t, "TEMP: "); strcat(t, temp); strcat(t, "'C"); write_text(t); set_page(3); set_0_column(); strcpy(t, ""); strcat(t, "WIATR: "); strcat(t, wind_force); write_text(t); set_page(4); set_0_column(); write_text(wind_dir); set_page(5); set_0_column(); if(strcmp(DAYS[ii].state, "SLONECZNIE")) write_text("SLONECZNIE"); else if(strcmp(DAYS[ii].state, "PRZEWAZNIE SLONECZNIE")) write_text("MALE CHMURY"); else if(strcmp(DAYS[ii].state, "ZMIENNE ZACHMURZENIE")) write_text("POCHMURNO"); else if(strcmp(DAYS[ii].state, "ZACHMURZENIE PELNE, SLABY DESZCZ")) write_text("SLABE OPADY"); }
void Renderer2d::set_perspective() { double out_ratio = (_2d_output_res.y() / _rows) / (_2d_output_res.x() / _cols); if (out_ratio < 1.) _window2d = math::VectorPair2(-1. / out_ratio, -1., 1. / out_ratio, 1.); else _window2d = math::VectorPair2(-1, -out_ratio, 1., out_ratio); _window2d_fit = _window2d; update_2d_window(); set_page(_pageid); _projection = &Renderer2d::projection_perspective; _eye_dist = 1. / tan(math::degree2rad(_fov) / 2.); }
static int hdmi_read_block(uint8_t page, uint8_t reg, uint8_t * buf, size_t buflen) { int r; minix_i2c_ioctl_exec_t ioctl_exec; if (buf == NULL || buflen > I2C_EXEC_MAX_BUFLEN) { log_warn(&log, "Read block called with NULL pointer or invalid buflen.\n"); return EINVAL; } if (page != HDMI_PAGELESS) { r = set_page(page); if (r != OK) { log_warn(&log, "Unable to set page to 0x%x\n", page); return r; } } memset(&ioctl_exec, '\0', sizeof(minix_i2c_ioctl_exec_t)); /* Read from HDMI */ ioctl_exec.iie_op = I2C_OP_READ_WITH_STOP; ioctl_exec.iie_addr = hdmi_address; /* write the register address */ ioctl_exec.iie_cmd[0] = reg; ioctl_exec.iie_cmdlen = 1; /* read bytes */ ioctl_exec.iie_buflen = buflen; r = i2cdriver_exec(hdmi_bus_endpoint, &ioctl_exec); if (r != OK) { log_warn(&log, "hdmi_read() failed (r=%d)\n", r); return -1; } memcpy(buf, ioctl_exec.iie_buf, buflen); log_trace(&log, "Read %d bytes from reg 0x%x in page 0x%x\n", buflen, reg, page); return OK; }
/* --------------------------------------------------------------------------- ** Description: ** 系统设置 ** -------------------------------------------------------------------------- */ void load_system_set(void) { uint8_t last_index = INVALID_INDEX_U8; /* 加载GUI界面 */ gui_system_set(); while ( get_page() == system_set ) { /*获取按下按键的状态*/ pKey->key_sta = judge_key_sta(DISABLE_SHIFT); /* 方向键改变索引值 */ dir_key_index_change(SET,5,2,10,&pSystem_Set->index); /* 数字键快速定位 */ SystemSetNumQuickFixed(); /* 状态切换 */ system_set_change_status(); /* 改变光标 */ system_set_change_cursor(POS_RETC_LENGTH,POS_RETC_WIDTH,&last_index,&pSystem_Set->index,pSystem_Set->pos); /* 功能键按下状态 */ if (pKey->key_sta == KEY_PRESS_OK) //输入方式为短按/长按 { switch (pKey->key_value) { case KEY_ENTER: SystemSetEnterOtherPage(pSystem_Set->index); break; case KEY_ESC: //退出键按下 set_page(mainpage); break; } } /* 调试模式:显示当前输入字符个数 */ if ( SET == status_debug_mode_get() ) { debug_interface1(INT_TYPE,2,pSystem_Set->index,0,0); } } }
static void reg_write16(struct tda998x_priv *priv, u16 reg, u16 val) { struct i2c_client *client = priv->hdmi; u8 buf[] = {REG2ADDR(reg), val >> 8, val}; int ret; mutex_lock(&priv->mutex); ret = set_page(priv, reg); if (ret < 0) goto out; ret = i2c_master_send(client, buf, sizeof(buf)); if (ret < 0) dev_err(&client->dev, "Error %d writing to 0x%x\n", ret, reg); out: mutex_unlock(&priv->mutex); }
static void reg_write_range(struct tda998x_priv *priv, uint16_t reg, uint8_t *p, int cnt) { struct i2c_client *client = priv->hdmi; uint8_t buf[cnt+1]; int ret; buf[0] = REG2ADDR(reg); memcpy(&buf[1], p, cnt); ret = set_page(priv, reg); if (ret < 0) return; ret = i2c_master_send(client, buf, cnt + 1); if (ret < 0) dev_err(&client->dev, "Error %d writing to 0x%x\n", ret, reg); }
void Fl_Gdi::page(double pw, double ph, int orientation) { if(nPages) EndPage(gc_); nPages++; pw_=pw; ph_=ph; orientation_ = orientation; DEVMODE * mode = (DEVMODE *)GlobalLock(mode_); if(orientation) mode->dmOrientation = DMORIENT_PORTRAIT; else mode->dmOrientation = DMORIENT_LANDSCAPE; mode->dmPaperWidth = (int) (pw*254/72); mode->dmPaperLength = (int) (ph*254/72); mode->dmFields |= DM_PAPERLENGTH | DM_PAPERWIDTH; mode->dmFields &= ~DM_PAPERSIZE; GlobalUnlock(mode_); set_page(1); };