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


C++ button_init函数代码示例

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


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

示例1: button_check

//проверка кнопок и энкодера
inline void button_check(TActElements name, TActions encact) {
    if(name != NM_NONE) { //нажали кнопку

        if(name != g_button_state.name) {

            button_init();
            g_button_state.name = name;

        } else {
            g_button_state.release = 0;
        }

        if(name != NM_ENCROTATE) {
            button_check_press();
        }
        else {
            encoder_check_rotate(encact);
        }
    }
    else if(g_button_state.on == _ON) {
        //отпустили кнопень
        if(g_button_state.release >= BUTTON_RELEASE) {
            button_init();
        }
        else {
            g_button_state.release ++;
        }
    }
}
开发者ID:xseregax,项目名称:srg_station,代码行数:30,代码来源:input.c

示例2: init_platform

void init_platform() {
	button_init(&select_btn, PIN_PA14);
	button_init(&down_btn, PIN_PA15);
	device.speed = 255;
	device.inclination = 255;
	
	gfx_mono_init();
	ssd1306_init();
	configure_tc_cadence();
	cadence_sensor_init();
	
	
	// The page address to write to
	uint8_t page_address = 0;
	// The column address, or the X pixel.
	uint8_t column_address = 0;
	
	ssd1306_clear_buffer();
	gfx_mono_draw_string("Accelerometer",1, 18, &sysfont);
	gfx_mono_draw_string("Setup",37, 32, &sysfont);
	ssd1306_write_display();
	
	gfx_mono_active_menu = SPEED_VIEW;
	
}
开发者ID:skrutt,项目名称:longboard,代码行数:25,代码来源:bike.c

示例3: main

int main(void)
{
	sched_init(); /* initialize the scheduler */
	led_init(); /* initialize led */
	button_init(); /* initialize button */
	adc_init(); /* initialize ADC (battery voltage measurement) */
	serial_init(); /* initialize serial communication */
	wheel_init(); /* initialize encoders, PWM output, PID etc. */
	pid_interval = 50; /* default PID update interval 50ms */ 
	pid_rate = 1000/pid_interval; /* [Hz] always remember after setting pid_interval */
	pfbst_interval = 20; /* send $PFBST at 20 ms interval */
	nmea_wd_timeout = 1; /* set PFBCT watchdog timeout to 100ms */
	nmea_wd = NMEA_WD_TOUT+1; /* make sure we begin in watchdog timeout state */
	voltage_min = VOLTAGE_MIN_DEFAULT;
	battery_low_warning = false;
	state_update();
	sei(); /* enable interrupts */
	nmea_init(); /* initialize nmea protocol handler */

	for (;;) /* go into an endless loop */
	{
		/* motor_update(); */

		if (t1ms != 0) /* if the interrupt has timed out after 10ms */
		{
			t1ms --;
			sched_update(); /* run the scheduler */
		}
		else
		{
			nmea_rx_update();
		}
	}
	return 0; /* just for the principle as we never get here */
}
开发者ID:jelar11,项目名称:Frobit,代码行数:35,代码来源:main.c

示例4: usb_cb_set_configuration

bool usb_cb_set_configuration(uint8_t config) {
	if (config <= 1) {
		button_init();
		return true;
	}
	return false;
}
开发者ID:LinusU,项目名称:t2-firmware,代码行数:7,代码来源:usb.c

示例5: system_init

void system_init()
{
	system_watchdog_timer_stop();

	 // Init all ports
	 PADIR = 0xFF;
	 PAOUT = 0x00;
	 PBDIR = 0xFF;
	 PBOUT = 0x00;
	 PCDIR = 0xFF;
	 PCOUT = 0x00;

    //PMM_setVCore(PMMCOREV_2);
    PMM_SetVCore(2);

    PMM_SetStdSVSM(0x8088, 2, 4);

    clock_init();

    led_init();
    button_init();
    uart_init();

    system_get_unique_id(device_id);
}
开发者ID:iag,项目名称:dash7-ap-open-source-stack,代码行数:25,代码来源:cc430_system.c

示例6: setup

//The setup function is called once at startup of the sketch
void setup()
{
	// Add your initialization code here
	// Note : This will initialize Serial port on Arduino at 115200 bauds
	OC_LOG_INIT();
	OC_LOG(DEBUG, TAG, ("Demoserver is starting..."));

	// Connect to Ethernet or WiFi network
	if (ConnectToNetwork() != 0) {
		OC_LOG(ERROR, TAG, ("Unable to connect to network"));
		return;
	}

	// Initialize the OC Stack in Server mode
	if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK) {
		OC_LOG(ERROR, TAG, ("OCStack init error"));
		return;
	}

	// Initialize Grove related Devices
	sensor_init();
	led_init();
	lcd_init();
	buzzer_init();
	button_init();

	// Declare and create the resource: grove
	createDemoResource();
}
开发者ID:Lyoncore,项目名称:iotivity-demo-uc15,代码行数:30,代码来源:demoserver.cpp

示例7: main

int main()
{	
	unsigned int adc;
	float vol;
	int n;
	
	copy_vec();
	irq_init();
	button_init();
	uart0_init();
	timer_init();
//	timer4_init();

	lcd_init();
	lcd_clean(0xffff);
	adc_ts_init();
	ts_init();
	while(1);

	while(1)
	{
		adc = read_adc(0);
		vol = adc * 3.3 / 0x3ff;
		n = (vol - (int)vol) * 1000;
		
		printf("AIN0: adc = %u	voltage:%d.%03d\r\n", adc, (int)vol, n);
		delayms(1000);
	}
	
	return 0;
}
开发者ID:James-Tu,项目名称:misc_files,代码行数:31,代码来源:main.c

示例8: task_sensors

/** \brief This is the task function for monitoring the button and joysticks.
 *  \details This function monitors the "Target Set" button, and when it is pressed,
 *  updates shared variables "motor1_power_SHARED", and "motor2_power_SHARED" with adc_channel
 *  readings. If the button is NOT pressed, the motor power shareds are set to the effective
 *  "zero power" value of 512.(1024 adc values corresponding to full forward(1023), and
 *  full reverse(0);
 */
void task_sensors(void* pvParameters){
	uint8_t default_sensor_prio = uxTaskPriorityGet(NULL);
	portTickType xLastWakeTime;
    xLastWakeTime = xTaskGetTickCount();
    adc_init();
    uint16_t joystick_y;
    uint16_t joystick_x;
    button_init();
       
    while(1)
    {
        if(button_pressed()){
            joystick_y = adc_read(ADC_JOYSTICK_Y);
            joystick_x = adc_read(ADC_JOYSTICK_X);
            vTaskPrioritySet(NULL, configMAX_PRIORITIES - 1);
    	        motor1_power_SHARED = joystick_y;
    	        motor2_power_SHARED = joystick_x;
    	    vTaskPrioritySet(NULL, default_sensor_prio);
    	}
    	else{
	    vTaskPrioritySet(NULL, configMAX_PRIORITIES - 1);
    	        motor1_power_SHARED = 512;
    	        motor2_power_SHARED = 512;
    	    vTaskPrioritySet(NULL, default_sensor_prio);
	    }
    	vTaskDelayUntil(&xLastWakeTime, 100/portTICK_RATE_MS);
    }

	
}
开发者ID:belisarius530,项目名称:HeliostatO-Doom,代码行数:37,代码来源:task_sensors.c

示例9: main

/**
 * @brief Function for application main entry.
 */
int main(void)
{
    uint32_t err_code;

    //Initialize.
    app_trace_init();
    leds_init();
    scheduler_init();
    timers_init();
    iot_timer_init();
    button_init();
    ble_stack_init();
    advertising_init();
    ip_stack_init ();

    //Start execution.
    advertising_start();

    //Enter main loop.
    for (;;)
    {
        //Execute event schedule.
        app_sched_execute();

        //Sleep waiting for an application event.
        err_code = sd_app_evt_wait();
        APP_ERROR_CHECK(err_code);
    }
}
开发者ID:xueliu,项目名称:nRF51822,代码行数:32,代码来源:main.c

示例10: main

int
main()
{
  Button button;

  struct counter_data data = {
    (ShiftRegister){12, 10, 11},
    0
  };

  shift_register_init(&data.reg);
  shift_register_set(&data.reg, 1);
  button_init(&button);

  button.pin = 7;
  button.closed_on = LOW;
  button.debounce_delay = 10;
  button.hold_delay = 250;
  button.toggle_callback = &toggled;
  button.hold_callback = &hold;
  button.data = &data;

  pin_set_mode(7, INPUT);
  pin_set_value(7, PULLUP); // enable the internal pull-up resistor

  while(true) {
    button_check(&button);
    delay_ms(1); // TODO do not depend on delaying
  }

  return 0;
}
开发者ID:dominikh,项目名称:arduino,代码行数:32,代码来源:led_counter.c

示例11: init_platform

void init_platform( void )
{
  button_init_t init;

  MicoGpioInitialize( (mico_gpio_t)MICO_SYS_LED, OUTPUT_PUSH_PULL );
  MicoGpioOutputLow( (mico_gpio_t)MICO_SYS_LED );
  MicoGpioInitialize( (mico_gpio_t)MICO_RF_LED, OUTPUT_OPEN_DRAIN_NO_PULL );
  MicoGpioOutputHigh( (mico_gpio_t)MICO_RF_LED );
  
  MicoGpioInitialize((mico_gpio_t)BOOT_SEL, INPUT_PULL_UP);
  MicoGpioInitialize((mico_gpio_t)MFG_SEL, INPUT_PULL_UP);

  init.gpio = EasyLink_BUTTON;
  init.pressed_func = PlatformEasyLinkButtonClickedCallback;
  init.long_pressed_func = PlatformEasyLinkButtonLongPressedCallback;
  init.long_pressed_timeout = 5000;

  button_init( IOBUTTON_EASYLINK, init );
  
#ifdef USE_MiCOKit_EXT
  dc_motor_init( );
  dc_motor_set( 0 );
  
  rgb_led_init();
  rgb_led_open(0, 0, 0);
#endif
}
开发者ID:OfficeKit,项目名称:OfficeKit_Embed_MiCO,代码行数:27,代码来源:platform.c

示例12: init_all

void init_all(){
	ticks_init(); // for delay_ms() and for time sync
	button_init();	//init button
	led_init();		//init led
	tft_init(0, WHITE, BLACK, RED);		//initialize LCD screen
	xbc_init(0);	//initialize Xbox controller
}
开发者ID:tomatoMessiah,项目名称:hongjongmikapeggyswsecret,代码行数:7,代码来源:interface.c

示例13: v2x_board_init

/* This function is meant to contain board-specific initialization code
 * for, e.g., the I/O pins. The initialization can rely on application-
 * specific board configuration, found in conf_board.h.
 */
void v2x_board_init(void)
{
	irq_initialize_vectors();
	pmic_init();
	sysclk_init();							//configure clock sources for core and USB
	sleepmgr_init();						// Initialize the sleep manager
	ioport_init();							//Initializes the IOPORT service
	pin_init();								//whole chip pin init, modes and initial conditions
	spi_start();							//start SPI driver
	PWR_init();								//sets SR to default states - holds power up
	cpu_irq_enable();
	eeprom_init();							//verifies eeprom safe for use
	menu_init();							//loads menu settings
	time_init();							//starts the RTC
	button_init();							//init button stuffs
	ACL_init();								//configures, but does not start sampling
	GSM_usart_init();						//starts direct serial channel to the SIM module
	CAN_uart_start();						//starts direct serial channel to the ELM module
	canbus_serial_routing(AVR_ROUTING);		//cause the serial 3-state buffer to route the serial path from the ELM to the FTDI 
	udc_start();							//start stack and vbus monitoring
	PWR_hub_start();						//connect the hub to the computer

	//autostart all systems
	delay_ms(500);
	GSM_modem_init();
	CAN_elm_init();
	ACL_set_sample_on();
	PWR_host_start();
}
开发者ID:PDXostc,项目名称:rvi_v2x_firmware,代码行数:33,代码来源:V2X_init.c

示例14: system_init

void system_init()
{
	 system_watchdog_timer_stop();

    PMM_SetVCore(vCore_level);

    PMM_SetStdSVSM(0x8088, 2, 4);

    clock_init();

    if (init_IO)
    {
    	// Init all ports
		PADIR = 0xFF;
		PAOUT = 0x00;
		PBDIR = 0xFF;
		PBOUT = 0x00;
		PCDIR = 0xFF;
		PCOUT = 0x00;

    	led_init();
    	button_init();
    	uart_init();
    }

    system_get_unique_id(device_id);
}
开发者ID:jeroendoggen,项目名称:dash7-ap-open-source-stack,代码行数:27,代码来源:cc430_system.c

示例15: init_hw

/**
 * Initiate hardware peripherials.
 */
void init_hw() {

  ARD_LED_INIT();                   // init arduino LED port

  uart_init(UART_BAUD_SELECT(UART_BAUD_RATE,F_CPU));		// init uarts

	stdout = &mystdio;                // configure stdout to UART 0

	TIMER0_PRES_1024();               // set prescaler of timer 0
	TIMER0_OVF_IE();                  // enable overflow interrupt of timer 0
	TIMER0_RELOAD(TIMER0_10MS);       // reload counter of timer 0

	TIMER1_PRES_1024();               // set prescaler of timer 1
	TIMER1_OVF_IE();                  // enable overflow interrupt of timer 1
	TIMER1_RELOAD(TIMER1_CNT);        // reload counter of timer 1


  but.port = &PINB;                 // initiate button
  but.bit  = PB4;
  button_init(&but, &PORTB);

  LEF_TimerInit(&eTimer1);
  LEF_TimerInit(&eTimer2);
  LEF_TimerInit(&eTimer3);
  LEF_TimerStartRepeat(&eTimer1, 100);  // set as 100 ticks repeating timer
  LEF_TimerStartRepeat(&eTimer2, 200);  // set as 100 ticks repeating timer

  sev_cmd_init(cmdTable);

	sei();														// enable interrupts
}
开发者ID:zonbrisad,项目名称:LEF,代码行数:34,代码来源:main.c


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