• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ON函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ProcessOption

/****************************************************************************\
   Option handler provided when calling ParseCmdLine member function of CGetOptions
\****************************************************************************/
bool ProcessOption(int ch, char *optarg, void* user_ctx)
{
    bool bDone = false;
    do {
        struct USER_SETTINGS* pUsrSet = (struct USER_SETTINGS*)user_ctx;
        if(pUsrSet == NULL) {
            break;
        }
        #define ON(msg, fn) case msg: bDone = fn(ch, optarg, pUsrSet); break;
        switch(ch) {
            ON('h', OnUsage);
            ON('c', OnBlockCount);
            ON('s', OnBlockSize);
            ON('r', OnRunTime);
        default:
            printf("Try '--help' for more information.\n");
            bDone = true;
            break;
        }
        #undef ON

    } while(false);

    return bDone;
}
开发者ID:wwright2,项目名称:codeview,代码行数:28,代码来源:main.cpp


示例2: makeTarget

void
makeTarget(
    char *s,
    BOOL firstTarg,
    BUILDBLOCK **block
    )
{
    BUILDLIST  *build;
    MAKEOBJECT *object;

    if (!*block)
        *block = makeNewBuildBlock();

    if (firstTarg) {
        build = makeNewBldListElement();
        build->buildBlock = *block;
    } else
        build = makeBuildList(*block);

    if ((object = findTarget(s))) {
        if (ON(object->flags2, F2_DOUBLECOLON) != ON(currentFlags, F2_DOUBLECOLON))
            makeError(currentLine, MIXED_SEPARATORS);
        appendItem((STRINGLIST**)&(object->buildList), (STRINGLIST*)build);
        FREE(s);
    } else {
        build->next = NULL;
        object = makeNewObject();
        object->name = s;
        object->buildList = build;
        object->flags2 = currentFlags;
        prependItem((STRINGLIST**)targetTable+hash(s, MAXTARGET, (BOOL)TRUE),
                    (STRINGLIST*)object);
    }
}
开发者ID:ArildF,项目名称:masters,代码行数:34,代码来源:action.cpp


示例3: cpld_flash

//# MENU cpld
void cpld_flash() {
    SETUPgout(EN_1V8);
    ON(EN_1V8);
    delay(1000000); /* wait until cpld boot */
    cpu_clock_set(204);

    lcdPrintln("Program CPLD");
    bytes=0;
    lcdPrint(IntToStr(bytes,5,F_LONG));
    lcdPrint(" bytes...");
    lcdNl();

#define WAIT_LOOP_DELAY (6000000)
#define ALL_LEDS  (PIN_LED1|PIN_LED2|PIN_LED3)
    int i;
    int error;

    refill_cpld_buffer_fs();

    error = cpld_jtag_program(sizeof(cpld_xsvf_buffer),
                              cpld_xsvf_buffer,
                              refill_cpld_buffer_fs);
    if(error) {
        lcdPrintln("Programming failed!");
        lcdPrintln(IntToStr(error,5,0));
        lcdDisplay();
        /* LED3 (Red) steady on error */
        ON(LED4);
        while (1);
    };

    lcdPrintln("Success.");
    lcdDisplay();
    OFF(EN_1V8);
};
开发者ID:miloh,项目名称:f1rmware,代码行数:36,代码来源:main.c


示例4: __xmas

static echs_event_t
__xmas(void *UNUSED(clo))
{
	DEFSTATE(XMAS);
	DEFSTATE(BOXD);
	echs_event_t e;

	switch (state) {
	case BEFORE_XMAS:
		e.when = (echs_instant_t){y, 12U, 25U};
		e.what = ON(XMAS);
		state = ON_XMAS;
		break;
	case ON_XMAS:
		e.when = (echs_instant_t){y, 12U, 26U};
		e.what = OFF(XMAS);
		state = BEFORE_BOXD;
		break;
	case BEFORE_BOXD:
		e.when = (echs_instant_t){y, 12U, 26U};
		e.what = ON(BOXD);
		state = ON_BOXD;
		break;
	case ON_BOXD:
		e.when = (echs_instant_t){y, 12U, 27U};
		e.what = OFF(BOXD);
		state = BEFORE_XMAS;
		y++;
		break;
	default:
		abort();
	}
	return e;
}
开发者ID:rudimeier,项目名称:echse,代码行数:34,代码来源:xmas.c


示例5: cpld_menu

//# MENU cpld
void cpld_menu(){
	getInputWaitRelease();
	SETUPgout(EN_1V8);
	ON(EN_1V8);
	delayNop(1000000); /* wait until cpld boot */
	cpu_clock_set(204);

	lcdClear();
	lcdPrintln("CPLD");
	lcdNl();
	lcdNl();
	bytes=0;
	lcdPrint(IntToStr(bytes,5,F_LONG));
	lcdPrint(" bytes...");
	lcdNl();

	#define WAIT_LOOP_DELAY (6000000)
	#define ALL_LEDS  (PIN_LED1|PIN_LED2|PIN_LED3)
	int i;
	int error;
	FRESULT res;

	res=f_open(&file, "cpld.xsv", FA_OPEN_EXISTING|FA_READ);
	if(res!=FR_OK){
	    lcdPrintln("FOPEN ERROR");
	    lcdPrintln(f_get_rc_string(res));
	    lcdDisplay();
	    getInputWait();
	    return;
	};
	refill_cpld_buffer_fs();

	error = cpld_jtag_program(sizeof(cpld_xsvf_buffer),
				  cpld_xsvf_buffer,
				  refill_cpld_buffer_fs);
	if(error){
	    lcdPrintln("Programming failed!");
	    lcdPrintln(IntToStr(error,5,0));
	    lcdDisplay();
	    /* LED3 (Red) steady on error */
	    ON(LED3);
	    while (1);
	};


	lcdPrintln("Success.");
	lcdDisplay();

	for (res=0;res<10;res++){
	    /* blink LED1, LED2, and LED3 on success */
	    TOGGLE(LED1);
	    TOGGLE(LED2);
	    TOGGLE(LED3);
	    for (i = 0; i < WAIT_LOOP_DELAY; i++)  /* Wait a bit. */
		__asm__("nop");
	};
	/* XXX: Maybe power toggle needed to start CPLD? */
	OFF(EN_1V8);
};
开发者ID:cokesme,项目名称:f1rmware,代码行数:60,代码来源:cpld.c


示例6: simple

static int simple(void) {
    ne_buffer *s = ne_buffer_create();
    ON(s == NULL);
    ne_buffer_zappend(s, "abcde");
    ONCMP(s->data, "abcde");
    ON(ne_buffer_size(s) != 5);
    ne_buffer_destroy(s);
    return OK;
}
开发者ID:github188,项目名称:NewCool-UC-3.1.0-priv,代码行数:9,代码来源:string-tests.c


示例7: ON

void Buzzer::target_not_found()
{
    ON();
    wait(0.1);
    OFF();
    wait(0.1);
    ON();
    wait(0.2);
    OFF();
}
开发者ID:Tony-YI,项目名称:home_page,代码行数:10,代码来源:buzzer.cpp


示例8: buf_concat

static int buf_concat(void)
{
    ne_buffer *s = ne_buffer_create();
    ON(s == NULL);
    ne_buffer_concat(s, "a", "b", "c", "d", "e", "f", "g", NULL);
    ONCMP(s->data, "abcdefg");
    ON(ne_buffer_size(s) != 7);
    ne_buffer_destroy(s);
    return OK;
}
开发者ID:github188,项目名称:NewCool-UC-3.1.0-priv,代码行数:10,代码来源:string-tests.c


示例9: spectrum_menu

//# MENU spectrum
void spectrum_menu()
{
	lcdClear();
	lcdDisplay();
	getInputWaitRelease();

	// RF initialization from ppack.c:
	dac_init(false);
	cpu_clock_set(204); // WARP SPEED! :-)
	hackrf_clock_init();
	rf_path_pin_setup();
	/* Configure external clock in */
	scu_pinmux(SCU_PINMUX_GP_CLKIN, SCU_CLK_IN | SCU_CONF_FUNCTION1);
	sgpio_configure_pin_functions();
	ON(EN_VDD);
	ON(EN_1V8);
	OFF(MIC_AMP_DIS);
	delayms(500); // doesn't work without
	cpu_clock_set(204); // WARP SPEED! :-)
	si5351_init();
	portapack_init();

	while(1)
	{
		switch(getInput())
		{
			case BTN_UP:
				displayMode=MODE_WATERFALL;
				break;
			case BTN_DOWN:
				displayMode=MODE_SPECTRUM;
				break;
			case BTN_LEFT:
				freq -= 2000000;
				ssp1_set_mode_max2837();
				set_freq(freq);
				break;
			case BTN_RIGHT:
				freq += 2000000;
				ssp1_set_mode_max2837();
				set_freq(freq);
				break;
			case BTN_ENTER:
				//FIXME: unset the callback, reset the clockspeed, tidy up
                nvic_disable_irq(NVIC_DMA_IRQ);
                OFF(EN_VDD);
                OFF(EN_1V8);
                ON(MIC_AMP_DIS);
                systick_set_clocksource(0);
                systick_set_reload(12e6/SYSTICKSPEED/1000);
				return;

		}
	}
}
开发者ID:neosam,项目名称:f1rmware,代码行数:56,代码来源:spectrum.c


示例10: buf_concat3

static int buf_concat3(void)
{
    ne_buffer *s = ne_buffer_create();
    ON(s == NULL);
    ne_buffer_zappend(s, "foobar");
    ne_buffer_concat(s, "norman", NULL);
    ONCMP(s->data, "foobarnorman");
    ON(ne_buffer_size(s) != 12);
    ne_buffer_destroy(s);
    return OK;
}
开发者ID:github188,项目名称:NewCool-UC-3.1.0-priv,代码行数:11,代码来源:string-tests.c


示例11: buf_concat2

static int buf_concat2(void)
{
#define RES "alphabetagammadeltaepsilonetatheta"
    ne_buffer *s = ne_buffer_create();
    ON(s == NULL);
    ne_buffer_concat(s, "alpha", "beta", "gamma", "delta", "epsilon", 
		     "eta", "theta", NULL);
    ONCMP(s->data, RES);
    ON(ne_buffer_size(s) != strlen(RES));
    ne_buffer_destroy(s);
    return OK;
}
开发者ID:github188,项目名称:NewCool-UC-3.1.0-priv,代码行数:12,代码来源:string-tests.c


示例12: ppack_menu

//# MENU Apack
void ppack_menu() {
	lcdClear();
	lcdPrintln("PPack port");
	lcdPrintln("");
	lcdPrintln("up=enable");
	lcdDisplay();
	dac_init(false);

	cpu_clock_set(204); // WARP SPEED! :-)
	hackrf_clock_init();
	rf_path_pin_setup();
	/* Configure external clock in */
	scu_pinmux(SCU_PINMUX_GP_CLKIN, SCU_CLK_IN | SCU_CONF_FUNCTION1);

	sgpio_configure_pin_functions();

	ON(EN_VDD);
	ON(EN_1V8);
	OFF(MIC_AMP_DIS);
	complex_s8_t * samples;

	while(1){
		switch(getInputRaw()){
			case BTN_UP:
			    // ON(MIXER_EN); // hackrf does this
			    cpu_clock_set(204); // WARP SPEED! :-)
			    si5351_init();
			    portapack_init();
			    getInputWaitRelease();

			    break;
			case BTN_DOWN:
			    lcdPrintln("file");
			    writeFile("samples.8", (char*)0x20000000,(uintptr_t)s8ram-0x20000000);
			    break;
			case BTN_LEFT:
			    lcdPrintln("reset");
			    s8ram=(complex_s8_t*)0x20000000;
			    break;
			case BTN_RIGHT:
				break;
			case BTN_ENTER:
				return;
		};
		TOGGLE(LED2);
		delayms(40);
		lcdPrint(IntToStr((uintptr_t)s8ram,8,F_HEX));
		lcdPrint(" ");
		lcdPrintln(IntToStr(sctr,7,F_LONG));
		lcdDisplay();
	};
};
开发者ID:cokesme,项目名称:f1rmware,代码行数:53,代码来源:ppack.c


示例13: rtsmb_srv_browse_ensure_backup_ratio

/* this makes sure that there aren't too many more normal servers to backup servers.
   If there are, it promotes a random potential browser */
RTSMB_STATIC void rtsmb_srv_browse_ensure_backup_ratio (void)
{
    int i, num_total = 0, num_backup = 0, num_potentials = 0, backup_server = -1;

    for (i = 0; i < prtsmb_srv_ctx->server_table_size; i++)
    {
        if (prtsmb_srv_ctx->server_table[i].type)
        {
            num_total ++;

            if (ON (prtsmb_srv_ctx->server_table[i].type, SV_TYPE_BACKUP_BROWSER))
            {
                num_backup ++;
            }
            else if (ON (prtsmb_srv_ctx->server_table[i].type, SV_TYPE_POTENTIAL_BROWSER))
            {
                num_potentials ++;
            }
        }
    }

    if (num_backup * RTSMB_SRV_BROWSE_NORMALS_TO_BACKUPS < num_total)
    {
        /* not enough backups, we need to promote someone   */
        int target = tc_rand () % num_potentials;

        for (i = 0; i < prtsmb_srv_ctx->server_table_size; i++)
        {
            if (prtsmb_srv_ctx->server_table[i].type)
            {
                if (OFF (prtsmb_srv_ctx->server_table[i].type, SV_TYPE_BACKUP_BROWSER) &&
                    ON  (prtsmb_srv_ctx->server_table[i].type, SV_TYPE_POTENTIAL_BROWSER))
                {
                    if (target == 0)
                    {
                        backup_server = i;
                        break;
                    }
                    else
                    {
                        target --;
                    }
                }
            }
        }
    }

    if (backup_server >= 0)
    {
        rtsmb_srv_browse_send_become_backup (prtsmb_srv_ctx->server_table[backup_server].name);
    }
}
开发者ID:layerfsd,项目名称:cifssmb,代码行数:54,代码来源:srvbrws.c


示例14: Send_Byte

void Send_Byte(char byte){
    // отправляем байт последовательно по битам , при этом кликая каждый бит и дергая защелку каждый байт
    for (char i=0;i<8;i++){
          if ((byte&0x80)==0x00) ON(SHIFT_data);
          else OFF(SHIFT_data);
            byte<<=1;
            ON(SHIFT_clk);
            OFF(SHIFT_clk);
        }
        OFF(SHIFT_latch);
        ON(SHIFT_latch);
        OFF(SHIFT_latch);
}
开发者ID:4glk,项目名称:low_temp,代码行数:13,代码来源:shift.c


示例15: tim1_trg_com_irq_handler

/**
 * PWM timer commutation event interrupt handler
 */
void tim1_trg_com_irq_handler(void)
{
	TIM_ClearITPendingBit(TIM1, TIM_IT_COM);

	ON(LED_BLUE);

	TIM_SetCompare1(TIM1, pwm_val);
	TIM_SetCompare2(TIM1, pwm_val);
	TIM_SetCompare3(TIM1, pwm_val);
	TIM_SetCompare4(TIM1, pwm_offset);

	PWM__SCHEME();
	ON(LED_BLUE);
}
开发者ID:bobbens,项目名称:open-bldc,代码行数:17,代码来源:pwm.c


示例16: led_menu

//# MENU led
void led_menu(){
	getInputWaitRelease();

	uint8_t leds=0;
	uint8_t adc=0;
	while(1){
		lcdClear();
		lcdPrintln("LED:");
		lcdPrintln("");
		lcdPrintln("U Toggle LEDs");
		lcdPrintln("D Toggle ADC");
		lcdPrintln("");
		lcdDisplay();
		switch(getInput()){
			case BTN_UP:
				adc=0;
				leds=1-leds;
				SETUPgout(LED4);
				if(leds){
					ON(LED1);
					ON(LED2);
					ON(LED3);
					ON(LED4);
				}else{
					OFF(LED1);
					OFF(LED2);
					OFF(LED3);
					OFF(LED4);
				};
				break;
			case BTN_DOWN:
				adc=1;
				SETUPadc(LED4);
				break;
			case BTN_ENTER:
				SETUPgout(LED1);
				SETUPgout(LED2);
				SETUPgout(LED3);
				SETUPgout(LED4);
				return;
		};
		if(adc){
			lcdPrint("LED4: ");
			lcdPrint(IntToStr(adc_get_single(ADC0,ADC_CR_CH6)*2*330/1023,4,F_LONG));
			lcdNl();
			lcdDisplay();
		};
		getInputWaitRelease();
	};
};
开发者ID:cokesme,项目名称:f1rmware,代码行数:51,代码来源:led.c


示例17: alter

static int alter(void) {
    ne_buffer *s = ne_buffer_create();
    char *d;
    ON(s == NULL);
    ne_buffer_zappend(s, "abcdefg");
    d = s->data;
    ON(d == NULL);
    d[2] = '\0';
    ne_buffer_altered(s);
    ONCMP(s->data, "ab");
    ON(ne_buffer_size(s) != 2);
    ne_buffer_zappend(s, "hijkl");
    ONCMP(s->data, "abhijkl");
    ne_buffer_destroy(s);
    return OK;
}
开发者ID:github188,项目名称:NewCool-UC-3.1.0-priv,代码行数:16,代码来源:string-tests.c


示例18: main

int main(void) {
    cpuClockInit(); /* CPU Clock is now 104 MHz */
    ssp_clock_init();
    systickInit();

    SETUPgout(EN_VDD);
    SETUPgout(MIXER_EN);
    SETUPgout(MIC_AMP_DIS);

    SETUPgout(LED1);
    SETUPgout(LED2);
    SETUPgout(LED3);
    SETUPgout(LED4);

    inputInit();
    lcdInit();
    lcdFill(0xff);
    lcdPrintln("Flash-App");
    lcdNl();
    lcdDisplay();

    cpld_flash();
    cpu_clock_set(50);
    full_msc();
    while(1) {
	    delayNop(2000000);
	    ON(LED4);
	    delayNop(2000000);
	    OFF(LED4);
    }
    return 0;
}
开发者ID:neosam,项目名称:f1rmware,代码行数:32,代码来源:main.c


示例19: ON

 void ChamberLED::setState(bool state){
   if(state){
     ON();
   }else{
     OFF();
   }
 }
开发者ID:bveenema,项目名称:BLFA_FW_001,代码行数:7,代码来源:ChamberLED.cpp


示例20: ON

//
// Activation for automatic management of led (flashing or instance)
//
void led::activateLED()
{
	Active = 1;
	ON();
	
	if(Type == Instance)
		NextEventTime = s.Timer1.time_ms + (INSTANCEDELAY);
}
开发者ID:SSexpress,项目名称:ele542-2011,代码行数:11,代码来源:led.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ONION_DEBUG函数代码示例发布时间:2022-05-30
下一篇:
C++ OMX_SetParameter函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap