当前位置: 首页>>代码示例>>C++>>正文


C++ ON函数代码示例

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


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


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