您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ timer_read函数代码示例

51自学网 2021-06-03 08:51:29
  C++
这篇教程C++ timer_read函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中timer_read函数的典型用法代码示例。如果您正苦于以下问题:C++ timer_read函数的具体用法?C++ timer_read怎么用?C++ timer_read使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了timer_read函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: taphold_tapped

void taphold_tapped(uint8_t index, bool pressed) {    if (index >= TH_EVENTS_COUNT) { return; }    tap_hold_t *th_event = &th_events[index];    if (pressed) {        th_event->timer = timer_read();        th_event->is_pressed = true;    } else if (th_event->is_pressed) {        register_code(th_event->kc_tap);        unregister_code(th_event->kc_tap);        th_event->is_pressed = false;    }}
开发者ID:UnderSampled,项目名称:qmk_firmware,代码行数:14,


示例2: Reduce

double Reduce(Arr *a,int w){  double retv=0.0;  if(timer_on){    timer_clear(w);    timer_start(w);  }  retv=(int)(w*CheckVal(a));/* The casting needed for node                                 and array dependent verifcation */  if(timer_on){    timer_stop(w);    fprintf(stderr,"** Reduce time in node %d = %f/n",(w-1),timer_read(w));  }  return retv;}
开发者ID:FlorianPO,项目名称:simgrid,代码行数:14,


示例3: _k_task_monitor

void _k_task_monitor(struct k_proc *X, uint32_t D){#ifdef CONFIG_TASK_DEBUG	if (!_k_debug_halt)#endif	{		k_monitor_wptr->time = timer_read();		k_monitor_wptr->data1 = X->Ident;		k_monitor_wptr->data2 = D;		if (++K_monitor_wind == k_monitor_capacity) {			K_monitor_wind = 0;			k_monitor_wptr = k_monitor_buff;		} else {			++k_monitor_wptr;		}		if (k_monitor_nrec < k_monitor_capacity) {			k_monitor_nrec++;		}	}	if ((_k_task_switch_callback != NULL) && (D == 0)) {		(_k_task_switch_callback)(X->Ident, timer_read());	}}
开发者ID:01org,项目名称:CODK-A-Firmware,代码行数:23,


示例4: debounce

void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) {  static uint16_t debouncing_time;  if (changed) {    debouncing = true;    debouncing_time = timer_read();  }  if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) {    for (uint8_t i = 0; i < num_rows; i++) {      cooked[i] = raw[i];    }    debouncing = false;  }}
开发者ID:Depariel,项目名称:qmk_firmware,代码行数:15,


示例5: rgblight_effect_breathing

void rgblight_effect_breathing(uint8_t interval) {  static uint8_t pos = 0;  static uint16_t last_timer = 0;  float val;  if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_BREATHING_INTERVALS[interval])) {    return;  }  last_timer = timer_read();  // http://sean.voisen.org/blog/2011/10/breathing-led-with-arduino/  val = (exp(sin((pos/255.0)*M_PI)) - RGBLIGHT_EFFECT_BREATHE_CENTER/M_E)*(RGBLIGHT_EFFECT_BREATHE_MAX/(M_E-1/M_E));  rgblight_sethsv_noeeprom_old(rgblight_config.hue, rgblight_config.sat, val);  pos = (pos + 1) % 256;}
开发者ID:adiabatic,项目名称:qmk_firmware,代码行数:15,


示例6: matrix_multiply_cl

voidmatrix_multiply_cl(pclu_context * pclu, matrix * cc, matrix * aa, matrix * bb){    pclu_program *pgm = pclu_create_program(pclu, "bmmul.cl");    char *log = pclu_program_build_log(pgm);    if (strlen(log) > 0)        printf("Build log:/n%s/n", log);    size_t aa_size = matrix_bytes(aa);    pclu_buffer *aa_buf = pclu_create_buffer(pclu, aa_size);    pclu_write_buffer(aa_buf, aa_size, aa->data);    size_t bb_size = matrix_bytes(bb);    pclu_buffer *bb_buf = pclu_create_buffer(pclu, bb_size);    pclu_write_buffer(bb_buf, bb_size, bb->data);    size_t cc_size = matrix_bytes(cc);    pclu_buffer *cc_buf = pclu_create_buffer(pclu, cc_size);    pclu_write_buffer(cc_buf, cc_size, cc->data);    cl_long nn = SIZE;    cl_long bs = BLOCK_SIZE;        pclu_range range = pclu_range_2d(cc->rows / bs, cc->cols / bs);    timer* tt = timer_alloc();    cl_kernel kernel = pclu_get_kernel(pgm, "bmmul");    pclu_set_arg_buf(kernel, 0, cc_buf);     pclu_set_arg_buf(kernel, 1, aa_buf);     pclu_set_arg_buf(kernel, 2, bb_buf);     printf("nn = %ld = 0x%lx/n", nn, nn);    pclu_set_arg_lit(kernel, 3, nn);    printf("bs = %ld = 0x%lx/n", bs, bs);    pclu_set_arg_lit(kernel, 4, bs);        pclu_call_kernel(pgm, kernel, range);    double kt = timer_read(tt);    timer_free(tt);    printf("Kernel (probably build) took %.04f seconds./n", kt);    pclu_read_buffer(cc_buf, cc_size, cc->data);    pclu_destroy_program(pgm);}
开发者ID:NatTuck,项目名称:cakemark,代码行数:48,


示例7: timer_read

const char *rn42_gets(uint16_t timeout){    static char s[24];    uint16_t t = timer_read();    uint8_t i = 0;    int16_t c;    while (i < 23 && timer_elapsed(t) < timeout) {        if ((c = rn42_getc()) != -1) {            if ((char)c == '/r') continue;            if ((char)c == '/n') break;            s[i++] = c;        }    }    s[i] = '/0';    return s;}
开发者ID:0xdec,项目名称:tmk_keyboard,代码行数:16,


示例8: rgblight_effect_christmas

void rgblight_effect_christmas(void) {  static uint16_t current_offset = 0;  static uint16_t last_timer = 0;  uint16_t hue;  uint8_t i;  if (timer_elapsed(last_timer) < RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL) {    return;  }  last_timer = timer_read();  current_offset = (current_offset + 1) % 2;  for (i = 0; i < RGBLED_NUM; i++) {    hue = 0 + ((i/RGBLIGHT_EFFECT_CHRISTMAS_STEP + current_offset) % 2) * 120;    sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]);  }  rgblight_set();}
开发者ID:anechiporuk,项目名称:qmk_firmware,代码行数:16,


示例9: rgblight_effect_christmas

void rgblight_effect_christmas(void) {  static uint16_t current_offset = 0;  static uint16_t last_timer = 0;  uint16_t hue;  uint8_t i;  if (timer_elapsed(last_timer) < 1000) {    return;  }  last_timer = timer_read();  current_offset = (current_offset + 1) % 2;  for (i = 0; i < RGBLED_NUM; i++) {    hue = 0 + ((RGBLED_NUM * (i + current_offset)) % 2) * 80;    sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]);  }  rgblight_set();}
开发者ID:chrischambers,项目名称:qmk_firmware,代码行数:16,


示例10: keyboard_task

/* * Do keyboard routine jobs: scan mantrix, light LEDs, ... * This is repeatedly called as fast as possible. */void keyboard_task(void){    static matrix_col_t matrix_prev[MATRIX_COLS];#ifdef MATRIX_HAS_GHOST    static matrix_col_t matrix_ghost[MATRIX_COLS];#endif    static uint8_t led_status = 0;    matrix_col_t matrix_col = 0;    matrix_col_t matrix_change = 0;    matrix_scan();    for (uint8_t c = 0; c < MATRIX_COLS; c++) {        matrix_col = matrix_get_col(c);        matrix_change = matrix_col ^ matrix_prev[c];        if (matrix_change) {#ifdef MATRIX_HAS_GHOST            if (has_ghost_in_col(c)) {                /* Keep track of whether ghosted status has changed for                 * debugging. But don't update matrix_prev until un-ghosted, or                 * the last key would be lost.                 */                if (debug_matrix && matrix_ghost[c] != matrix_col) {                    matrix_print();                }                matrix_ghost[c] = matrix_col;                continue;            }            matrix_ghost[c] = matrix_col;#endif            if (debug_matrix) matrix_print();            for (uint8_t r = 0; r < MATRIX_ROWS; r++) {                if (matrix_change & ((matrix_col_t)1<<r)) {                    keyevent_t e = (keyevent_t){                        .key = (keypos_t){ .row = r, .col = c },                        .pressed = (matrix_col & ((matrix_col_t)1<<r)),                        .time = (timer_read() | 1) /* time should not be 0 */                    };                    action_exec(e);                    hook_matrix_change(e);                    // record a processed key                    matrix_prev[c] ^= ((matrix_col_t)1<<r);                    // process a key per task call                    goto MATRIX_LOOP_END;                }            }        }    }
开发者ID:b1gtuna,项目名称:tmk_keyboard,代码行数:51,


示例11: rgblight_effect_knight

void rgblight_effect_knight(uint8_t interval) {  static uint16_t last_timer = 0;  if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_KNIGHT_INTERVALS[interval])) {    return;  }  last_timer = timer_read();  static int8_t low_bound = 0;  static int8_t high_bound = RGBLIGHT_EFFECT_KNIGHT_LENGTH - 1;  static int8_t increment = 1;  uint8_t i, cur;  // Set all the LEDs to 0  for (i = 0; i < RGBLED_NUM; i++) {    led[i].r = 0;    led[i].g = 0;    led[i].b = 0;  }  // Determine which LEDs should be lit up  for (i = 0; i < RGBLIGHT_EFFECT_KNIGHT_LED_NUM; i++) {    cur = (i + RGBLIGHT_EFFECT_KNIGHT_OFFSET) % RGBLED_NUM;    if (i >= low_bound && i <= high_bound) {      sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[cur]);    } else {      if (i == RGBLIGHT_FLED1 || i == RGBLIGHT_FLED2) {          fled_hs[0].hue = fled_hs[1].hue = 0;          fled_hs[0].sat = fled_hs[1].sat = 0;      }              led[cur].r = 0;      led[cur].g = 0;      led[cur].b = 0;    }  }  rgblight_set();  // Move from low_bound to high_bound changing the direction we increment each  // time a boundary is hit.  low_bound += increment;  high_bound += increment;  if (high_bound <= 0 || low_bound >= RGBLIGHT_EFFECT_KNIGHT_LED_NUM - 1) {    increment = -increment;  }}
开发者ID:0xdec,项目名称:qmk_firmware,代码行数:46,


示例12: memorymap_registers_read

uint8  memorymap_registers_read(uint32 Addr){	switch (Addr&0x1fff)	{	case 0x00:	case 0x01:	case 0x02:	case 0x03: return(gpu_read(Addr));	case 0x20: return(controls_read(Addr));	case 0x21: return(io_read(Addr));	case 0x23:	case 0x24: return(timer_read(Addr));	}	uint8 data = memorymap_regs[Addr&0x1fff]; //	iprintf("regs: reading 0x%.2x from 0x%.4x/n", data, Addr);	return(data);}
开发者ID:gameblabla,项目名称:potator,代码行数:17,


示例13: timer_set_next_event

static int timer_set_next_event(unsigned long delta,				struct clock_event_device *dev){	unsigned long flags, next;	local_irq_save(flags);	/* clear pending interrupt status and enable */	__raw_writel(0x01, TIMERS_VIRT_BASE + TMR_ICR(0));	__raw_writel(0x01, TIMERS_VIRT_BASE + TMR_IER(0));	next = timer_read() + delta;	__raw_writel(next, TIMERS_VIRT_BASE + TMR_TN_MM(0, 0));	local_irq_restore(flags);	return 0;}
开发者ID:007kumarraja,项目名称:rockchip-rk3188-mk908,代码行数:17,


示例14: switch

const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt){  switch (id)  {  case F_PASTE:    if (record->event.pressed)    {      register_code(KC_LCTL);      register_code(KC_V);      unregister_code(KC_V);      unregister_code(KC_LCTL);    }    break;  case RGB_ANI:    if (record->event.pressed)    {      rgb_timer = timer_read();    }    else    {      if (timer_elapsed(rgb_timer) > 300)      {        rgblight_mode(1);      }      else      {        rgblight_step();      }    }  case CF_EPRM:    if (record->event.pressed)    {      eeconfig_init();    }    return false;    break;  case CF_VERS:    if (record->event.pressed)    {      SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);    }    return false;    break;  }  return MACRO_NONE;};
开发者ID:berfarah,项目名称:qmk_firmware,代码行数:46,


示例15: main_loop

/** Main loop. */static voidmain_loop (void){    main_timer[3] = timer_read ();    /* Compute absolute position. */    aux_pos_update ();    main_timer[4] = timer_read ();    /* Compute trajectory. */    aux_traj_update ();    /* Prepare control system. */    cs_update_prepare ();    main_timer[5] = timer_read ();    /* Wait for next cycle. */    timer_wait ();    /* Encoder update. */    encoder_update ();    main_timer[0] = timer_read ();    /* Control system update. */    cs_update ();    main_timer[1] = timer_read ();    /* Pwm setup. */    output_update ();    main_timer[2] = timer_read ();    /* Sequences. */    seq_update (&seq_aux[0], &cs_aux[0].state);    seq_update (&seq_aux[1], &cs_aux[1].state);    /* Stats. */    if (main_sequence_ack	&& (seq_aux[0].ack != seq_aux[0].finish	    || seq_aux[1].ack != seq_aux[1].finish)	&& !--main_sequence_ack_cpt)      {	//XXX here	proto_send2b ('A', seq_aux[0].finish, seq_aux[1].finish);	main_sequence_ack_cpt = main_sequence_ack;      }    if (main_stat_counter && !--main_stat_counter_cpt)      {	proto_send2w ('C', encoder_aux[0].cur, encoder_aux[1].cur);	main_stat_counter_cpt = main_stat_counter;      }    if (main_stat_aux_pos && !--main_stat_aux_pos_cpt)      {	proto_send2w ('Y', aux[0].pos, aux[1].pos);	main_stat_aux_pos_cpt = main_stat_aux_pos;      }    if (main_stat_speed && !--main_stat_speed_cpt)      {	proto_send2w ('S', cs_aux[0].speed.cur_f >> 8,		      cs_aux[1].speed.cur_f >> 8);	main_stat_speed_cpt = main_stat_speed;      }
开发者ID:TLoebner,项目名称:apbteam,代码行数:53,


示例16: reset_keyboard

void reset_keyboard(void) {  clear_keyboard();#if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_ENABLE_BASIC))  music_all_notes_off();  uint16_t timer_start = timer_read();  PLAY_SONG(goodbye_song);  shutdown_user();  while(timer_elapsed(timer_start) < 250)     wait_ms(1);  stop_all_notes();#else  wait_ms(250);#endif#ifdef CATERINA_BOOTLOADER  *(uint16_t *)0x0800 = 0x7777; // these two are a-star-specific#endif  bootloader_jump();}
开发者ID:exklamationmark,项目名称:qmk_firmware,代码行数:18,


示例17: timer_init

int timer_init(tim_t dev, unsigned int ticks_per_us, void (*callback)(int)){    (void)ticks_per_us;    DEBUG("%s/n", __func__);    if (dev >= TIMER_NUMOF) {        return -1;    }    /* initialize time delta */    time_null = 0;    time_null = timer_read(0);    timer_irq_disable(dev);    _callback = callback;    timer_irq_enable(dev);    return 0;}
开发者ID:daniel-k,项目名称:RIOT,代码行数:18,


示例18: start_animation

void start_animation(){    dprintf("start_animation/n");    if (animation.is_running || animation.is_suspended)        return;    if (animation.animationStart)        animation.animationStart();    animation.is_running = true;    animation.is_suspended = false;    animation.loop_timer = timer_read();    animation.duration_timer = timer_read32();    last_key_pressed_timestamp = timer_read32();    show_animaiton_info(current_animation);}
开发者ID:alphaclon,项目名称:tmk_keyboard,代码行数:18,


示例19: snake_settings

void snake_settings(){	uint8_t difficulty;		while(1){						difficulty = slider_right_read();				if(timer_read(TIMER_3) > 1000){						oled_clear_screen();			oled_put_string(0*8, 0, "Set difficulty");			oled_put_string(0, 1, "Difficulty:%u", difficulty);			oled_put_string(0, 3, "Walls");			if(no_walls){				oled_put_string(7*8,3,"OFF");			}			else{				oled_put_string(7*8,3,"ON");			}						oled_write_screen();			if(button_right_read()){				if(no_walls){					no_walls = 0;				}				else{					no_walls = 1;				}			}						timer_reset(TIMER_3);		}				if(button_left_read()){			if(difficulty < 1){				s_difficulty = 1;			}			s_difficulty = difficulty / 4;			return;		}	}}
开发者ID:elleveldy,项目名称:byggern,代码行数:44,


示例20: animate

void animate(){    if (!animation.is_running || animation.animationLoop == 0)        return;    if (timer_elapsed(animation.loop_timer) < animation.delay_in_ms)        return;    if (suspend_animation_on_idle && timer_elapsed32(last_key_pressed_timestamp) > ANIMATION_SUSPEND_TIMEOUT)        return;	/*	if (animation.duration_in_ms > 0 && timer_elapsed32(animation.duration_timer) > animation.duration_in_ms)	{		stop_animation();		return;	}	*/#ifdef DEBUG_ANIMATION_SPEED    if (loop_count)    {        loop_count--;        elapsed_ms = timer_read32();    }    else    {        loop_count = 10;        duration_ms /= 10;        dprintf("avg: %lu/n", duration_ms);        duration_ms = 0;        elapsed_ms = timer_read32();    }#endif    animation.loop_timer = timer_read();    animation.animationLoop();#ifdef DEBUG_ANIMATION_SPEED    duration_ms += timer_elapsed32(elapsed_ms);    // dprintf("el: %u/n", duration_ms);#endif}
开发者ID:alphaclon,项目名称:tmk_keyboard,代码行数:43,


示例21: rgblight_effect_snake

void rgblight_effect_snake(uint8_t interval) {  static uint8_t pos = 0;  static uint16_t last_timer = 0;  uint8_t i, j;  int8_t k;  int8_t increment = 1;  if (interval % 2) {    increment = -1;  }  if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_SNAKE_INTERVALS[interval / 2])) {    return;  }  last_timer = timer_read();    fled_hs[0].hue = fled_hs[1].hue = 0;  fled_hs[0].sat = fled_hs[1].sat = 0;    for (i = 0; i < RGBLED_NUM; i++) {    led[i].r = 0;    led[i].g = 0;    led[i].b = 0;    for (j = 0; j < RGBLIGHT_EFFECT_SNAKE_LENGTH; j++) {      k = pos + j * increment;      if (k < 0) {        k = k + RGBLED_NUM;      }      if (i == k) {        sethsv(rgblight_config.hue, rgblight_config.sat, (uint8_t)(rgblight_config.val*(RGBLIGHT_EFFECT_SNAKE_LENGTH-j)/RGBLIGHT_EFFECT_SNAKE_LENGTH), (LED_TYPE *)&led[i]);      }    }  }  rgblight_set();  if (increment == 1) {    if (pos - 1 < 0) {      pos = RGBLED_NUM - 1;    } else {      pos -= 1;    }  } else {    pos = (pos + 1) % RGBLED_NUM;  }}
开发者ID:0xdec,项目名称:qmk_firmware,代码行数:43,


示例22: cb

/* Callback for the timeout */static void cb(void *arg){    unsigned int now_tut = READ_TUT();    unsigned int now_ref = timer_read(TIM_REF_DEV);    if (arg == NULL) {        print_str("cb: Warning! arg = NULL/n");        return;    }    test_ctx_t *ctx = arg;    if (ctx->ref_state == NULL) {        print_str("cb: Warning! ref_state = NULL/n");        return;    }    if (ctx->int_state == NULL) {        print_str("cb: Warning! int_state = NULL/n");        return;    }    /* Update running stats */    /* When setting a timer with a timeout of X ticks, we expect the     * duration between the set and the callback, dT, to be at least     * X * time_per_tick.     * In order to ensure that dT <= X * time_per_tick, the timer read value     * will actually have incremented (X + 1) times during that period,     * because the set can occur asynchrously anywhere between timer     * increments. Therefore, in this test, we consider (X + 1) to be the     * expected timer_read value at the point the callback is called.     */    /* Check that reference timer did not overflow during the test */    if ((now_ref + 0x4000u) >= ctx->target_ref) {        int32_t diff = now_ref - ctx->target_ref - 1 - overhead_target;        matstat_add(ctx->ref_state, diff);    }    /* Update timer_read statistics only when timer_read has not overflowed     * since the timer was set */    if ((now_tut + 0x4000u) >= ctx->target_tut) {        int32_t diff = now_tut - ctx->target_tut - 1 - overhead_read;        matstat_add(ctx->int_state, diff);    }    mutex_unlock(&mtx_cb);}
开发者ID:MichelRottleuthner,项目名称:RIOT,代码行数:43,


示例23: matrix_multiply_cl

voidmatrix_multiply_cl(pclu_context * pclu, matrix * cc, matrix * aa, matrix * bb){    pclu_program *pgm = pclu_create_program(pclu, "fmma.cl");    char *log = pclu_program_build_log(pgm);    if (strlen(log) > 0)        printf("Build log:/n%s/n", log);    size_t aa_size = matrix_bytes(aa);    pclu_buffer *aa_buf = pclu_create_buffer(pclu, aa_size);    pclu_write_buffer(aa_buf, aa_size, aa->data);    size_t bb_size = matrix_bytes(bb);    pclu_buffer *bb_buf = pclu_create_buffer(pclu, bb_size);    pclu_write_buffer(bb_buf, bb_size, bb->data);    size_t cc_size = matrix_bytes(cc);    pclu_buffer *cc_buf = pclu_create_buffer(pclu, cc_size);    pclu_write_buffer(cc_buf, cc_size, cc->data);    pclu_range range = pclu_range_2d(cc->rows, cc->cols);    cl_long nn = SIZE;    cl_long spin = SPIN;    timer* tt = timer_alloc();    pclu_call_kernel(pgm, "fmma", range, 5, buf_arg(cc_buf), buf_arg(aa_buf),                     buf_arg(bb_buf), lit_arg(nn), lit_arg(spin));    double kt = timer_read(tt);    timer_free(tt);    printf("Kernel took %.04f seconds./n", kt);    pclu_read_buffer(cc_buf, cc_size, cc->data);    printf("alpha/n");    pclu_destroy_program(pgm);    printf("beta/n");}
开发者ID:NatTuck,项目名称:pancake,代码行数:42,


示例24: rgblight_effect_alternating

void rgblight_effect_alternating(void){  static uint16_t last_timer = 0;  static uint16_t pos = 0;  if (timer_elapsed(last_timer) < 500) {    return;  }  last_timer = timer_read();  for(int i = 0; i<RGBLED_NUM; i++){      if(i<RGBLED_NUM/2 && pos){          sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]);      }else if (i>=RGBLED_NUM/2 && !pos){          sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]);      }else{          sethsv(rgblight_config.hue, rgblight_config.sat, 0, (LED_TYPE *)&led[i]);      }  }  rgblight_set();  pos = (pos + 1) % 2;}
开发者ID:adiabatic,项目名称:qmk_firmware,代码行数:20,


示例25: receive

void receive(_TIMER *self) {	timer_setPeriod(&timer5, 50e-3);	timer_start(&timer5);	led_toggle(&led1);	overflowing = 0;	while(pin_read(&D[12]) == 0){		if (timer_flag(&timer5) != 0){			led_toggle(&led3);			overflowFlag += 1;			overflowing = 1;			break;		}	}	if (overflowing == 0) {		overflowFlag = 0;	}	readTime = timer_read(&timer5);	led_toggle(&led2);	timer_stop(&timer5);}
开发者ID:trevhoot,项目名称:BestBuds,代码行数:20,


示例26: spinner_step

void spinner_step (void){  static int value;  static int step;  static const unsigned char rgch[]    = { '|', '/', '-', '//', '|', '/', '-', '//' } ;  unsigned v = timer_delta (0, timer_read ());  if (hook_spinner)    hook_spinner (v);  v = v/128;  if (v == value)    return;  value = v;  putchar ('/r');  putchar (rgch[step]);  step = (step + 1)%8;}
开发者ID:dienbk7x,项目名称:apex,代码行数:20,


示例27: matrix_render

void matrix_render(struct CharacterMatrix *matrix) {  last_flush = timer_read();  iota_gfx_on();#if DEBUG_TO_SCREEN  ++displaying;#endif  // Move to the home position  send_cmd3(PageAddr, 0, MatrixRows - 1);  send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1);  if (i2c_start_write(SSD1306_ADDRESS)) {    goto done;  }  if (i2c_master_write(0x40)) {    // Data mode    goto done;  }  for (uint8_t row = 0; row < MatrixRows; ++row) {    for (uint8_t col = 0; col < MatrixCols; ++col) {      const uint8_t *glyph = font + (matrix->display[row][col] * FontWidth);      for (uint8_t glyphCol = 0; glyphCol < FontWidth; ++glyphCol) {        uint8_t colBits = pgm_read_byte(glyph + glyphCol);        i2c_master_write(colBits);      }      // 1 column of space between chars (it's not included in the glyph)      //i2c_master_write(0);    }  }  matrix->dirty = false;done:  i2c_master_stop();#if DEBUG_TO_SCREEN  --displaying;#endif}
开发者ID:am,项目名称:qmk_firmware,代码行数:41,


示例28: main

int main(int argc, char** argv){	int i, j, k = 1;	parse_opt( argc, argv );	for( i = 0; i < NDIM; i++ )	{		for( j = 0; j < NDIM; j++ )		{			a[i][j] = k;			b[i][j] = k;			k++;		}	}	timer_start(1);	mat_mul( c, a, b );	timer_stop(1);	printf("Time elapsed : %lf sec/n", timer_read(1));	if( validation )		check_mat_mul( c, a, b );	if( print_matrix )	{		printf("MATRIX A: /n");		print_mat(a);		printf("MATRIX B: /n");		print_mat(b);		printf("MATRIX C: /n");		print_mat(c);	}	return 0;}
开发者ID:minitu,项目名称:mc2015,代码行数:40,


示例29: platform_test_tick_cycles

void platform_test_tick_cycles(){	/* Initialize the timer */	const int load_value = 1000;	int mhz_top, mhz_bot, temp;	unsigned long timer_base =		timer_secondary_base(PLATFORM_TIMER0_VBASE);	int cyccnt;	/* Make sure timer is disabled */	timer_stop(timer_base);	/* Load the timer with ticks value */	timer_load(load_value, timer_base);	/* One shot, 32 bits, no irqs */	timer_init_oneshot(timer_base);	/* Start the timer */	timer_start(timer_base);	/* Start counter */	perfmon_reset_start_cyccnt();	/* Wait until 0 */	while (timer_read(timer_base) != 0)		;	cyccnt = perfmon_read_cyccnt();	/* Fixed-point accuracy on bottom digit */	temp = cyccnt * 64 * 10 / load_value;	mhz_top = temp / 10;	mhz_bot = temp - mhz_top * 10;	//printk("Perfmon: %u cycles/%dMhz/n",	//       cyccnt * 64, timer_load);	printk("%s: %d.%d MHz CPU speed measured by timer REFCLK at 1MHz/n",	       __KERNELNAME__, mhz_top, mhz_bot);}
开发者ID:B-Rich,项目名称:codezero,代码行数:40,


示例30: matrix_scan_user

void matrix_scan_user(void) {	// We abuse this for early sending of key	// Key repeat only on QWER/SYMB layers	if (cMode != QWERTY || !inChord) return;	// Check timers#ifndef NO_REPEAT	if (repEngaged && timer_elapsed(repTimer) > REP_DELAY) {		// Process Key for report		processChord(false);		// Send report to host		send_keyboard_report();		clear_keyboard();		repTimer = timer_read();	}	if (!repEngaged && timer_elapsed(repTimer) > REP_INIT_DELAY) {		repEngaged = true;	}#endif};
开发者ID:Xyverz,项目名称:qmk_firmware,代码行数:22,



注:本文中的timer_read函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ timer_remove函数代码示例
C++ timer_printf函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。