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

C++ pwmStart函数代码示例

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

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



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

示例1: pwmOutputStart

/**
 * @brief  Starts the PWM output.
 * @note   The pwmStart() function used in this code is not
 *         the original ChibiOS HAL function, but modified
 *         one with STM32_TIM_CR1_CEN flag removed.
 * @return none.
 */
void pwmOutputStart(void) {
#if STM32_PWM_USE_ADVANCED
  /* Get dead-time generator value for TIM1. */
  uint32_t bdtr_dt = pwmOutputGetBDTRDeadTime(g_pwmOutput[PWM_OUT_ROLL].dt_cmd_id & PWM_OUT_DT_ID_MASK);
  pwmcfg_d1_d8.bdtr |= bdtr_dt;
#endif
  pwmStart(&PWMD1, &pwmcfg_d1_d8);

#if STM32_PWM_USE_ADVANCED
  /* Clear bdtr_dt value from previous calculation. */
  pwmcfg_d1_d8.bdtr &= ~bdtr_dt;
  /* Get dead-time generator value for TIM8. */
  bdtr_dt = pwmOutputGetBDTRDeadTime(g_pwmOutput[PWM_OUT_PITCH].dt_cmd_id & PWM_OUT_DT_ID_MASK);
  pwmcfg_d1_d8.bdtr |= bdtr_dt;
#endif
  /* Configure TIM8 as master timer: */
  pwmcfg_d1_d8.cr2 = STM32_TIM_CR2_MMS(1); // Master mode set to Enable;
  pwmStart(&PWMD8, &pwmcfg_d1_d8);

  switch (g_pwmOutput[PWM_OUT_YAW].dt_cmd_id & PWM_OUT_DT_ID_MASK) {
  case PWM_OUT_DT750NS:
    pwmOutTIM4_5_DT = PWM_OUT_TIM4_5_DT_US7;
    break;
  case PWM_OUT_DT1000NS:
    pwmOutTIM4_5_DT = PWM_OUT_TIM4_5_DT_1US;
    break;
  case PWM_OUT_DT2000NS:
    pwmOutTIM4_5_DT = PWM_OUT_TIM4_5_DT_2US;
    break;
  case PWM_OUT_DT3000NS:
    pwmOutTIM4_5_DT = PWM_OUT_TIM4_5_DT_3US;
    break;
  case PWM_OUT_DT4000NS:
    pwmOutTIM4_5_DT = PWM_OUT_TIM4_5_DT_4US;
    break;
  case PWM_OUT_DT5000NS:
    pwmOutTIM4_5_DT = PWM_OUT_TIM4_5_DT_5US;
    break;
  default:
    pwmOutTIM4_5_DT = PWM_OUT_TIM4_5_DT_5US;
  }
  pwmStart(&PWMD4, &pwmcfg_d4);
  pwmStart(&PWMD5, &pwmcfg_d5);

  /* Configure TIM5 as slave timer: */
  PWMD5.tim->SMCR =
    STM32_TIM_SMCR_SMS(6) | // Trigger Mode;
    STM32_TIM_SMCR_TS(3);   // Trigger event comes from TIM8;

  /* Configure TIM4 as slave timer: */
  PWMD4.tim->SMCR =
    STM32_TIM_SMCR_SMS(6) | // Trigger Mode;
    STM32_TIM_SMCR_TS(3);   // Trigger event comes from TIM8;

  /* Switch to center-aligned mode 1 and start timers. */
  PWMD5.tim->CR1 |= (STM32_TIM_CR1_CMS(1)); // This is a slave timer - do not start;
  PWMD4.tim->CR1 |= (STM32_TIM_CR1_CMS(1)); // This is a slave timer - do not start;
  PWMD1.tim->CR1 |= (STM32_TIM_CR1_CMS(1) | STM32_TIM_CR1_CEN);
  PWMD8.tim->CR1 |= (STM32_TIM_CR1_CMS(1) | STM32_TIM_CR1_CEN); // Start TIM8, TIM4 and TIM5 simultaneously;
}
开发者ID:Jister,项目名称:EvvGC-PLUS,代码行数:67,代码来源:pwmio.c


示例2: InitPWM

void InitPWM(void) {
  /*
   * Initializes the PWM drivers
   */
  pwmStart(&PWMD3, &pwmcfg);
  pwmStart(&PWMD4, &pwmcfg);
  pwmStart(&PWMD5, &pwmcfg);
//  pwmStart(&PWMD8, &pwmcfg);
}
开发者ID:MaxPayne86,项目名称:axoloti,代码行数:9,代码来源:axoloti_board.c


示例3: bldcInit

/* This function will start the PWM generator.
 */
extern void bldcInit(void) {
  bldc.scheme = &pwmScheme;
  bldc.state = 0;          //Default to first state
  bldc.nextState = 0;
  bldc.directionFwd = TRUE;
  bldc.stateChangeInterval = MS2RTT(20);
  bldc.prevStateChange = halGetCounterValue();
  bldc.nextStateChange = bldc.prevStateChange + bldc.stateChangeInterval;
  bldc.pwmOutT0 = 0;
  bldc.pwmOutT1 = 0;
  bldc.stateCount = sizeof(pwmScheme)/3;
  bldc.dutyCycle = 1800;

  palWriteGroup (PWM_OUT_PORT, PWM_OUT_PORT_MASK, PWM_OUT_OFFSET,  PWM_OFF);
  palSetGroupMode (PWM_OUT_PORT, PWM_OUT_PORT_MASK, PWM_OUT_OFFSET, PAL_MODE_OUTPUT_PUSHPULL);
  palSetPadMode (GPIOA, GPIOA_PIN1, PAL_MODE_INPUT_ANALOG);

  pwmStart(&PWMD1, &pwmcfg);

  // ADC trigger channel. This will trigger the ADC read at 95% of the cycle,
  // when all the PWM outputs are set to 0
  pwmEnableChannel (&PWMD1, PWM_ADCTRIG_CH, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, PWM_MAX_DUTY_CYCLE));

  // Start the ADC
  adcStart(&ADCD1, NULL);

}
开发者ID:kjellhar,项目名称:chibi-bldc,代码行数:29,代码来源:bldc.c


示例4: goToPos

	void goToPos(int32_t new_pos){
		if(new_pos == position)
			return;
		config.frequency = clk_freq;
		config.period = clk_freq / initial_freq;
		config.callback = cb;
		current_freq = initial_freq;
		config.channels[0] = {PWM_OUTPUT_DISABLED, NULL};
		config.channels[1] = {PWM_OUTPUT_DISABLED, NULL};
		config.channels[2] = {PWM_OUTPUT_DISABLED, NULL};
		config.channels[3] = {PWM_OUTPUT_DISABLED, NULL};
		config.channels[channel] = {PWM_OUTPUT_ACTIVE_HIGH, NULL};
		config.cr2 = 0;
		config.dier = 0;

		dir_positive = new_pos > position;
		target_position = new_pos;

		dir_pin.assign(dir_positive);

		ramp_length = (new_pos > position) ?
			((max_pos_freq - initial_freq) / ramp) :
			((max_neg_freq - initial_freq) / ramp);

		pwmStart(driver, &config);
		pwmEnableChannel(driver, channel, 10);
		pwmEnablePeriodicNotificationI(driver);
	}
开发者ID:timothydgreer,项目名称:turing_machine,代码行数:28,代码来源:motor.hpp


示例5: main

int main(void)
{
  halInit();
  chSysInit();
  
  palSetPadMode(GPIOB, 0, PAL_MODE_ALTERNATE(2)); // alt mode is PWM-enabled TIM3
  palSetPadMode(GPIOB, INAPIN, PAL_MODE_OUTPUT_PUSHPULL); // set INA to be an output
  palSetPadMode(GPIOB, INBPIN, PAL_MODE_OUTPUT_PUSHPULL); // set INB to be an output
   
  pwmStart(&PWMD3, &pwmcfg); // TIM3 for motors
 
  while (TRUE) {
    // one direction (possibly forward)
    pwmEnableChannel(&PWMD3, 3, 500);
    palSetPad(GPIOB, INAPIN);
    palClearPad(GPIOB, INBPIN);
    chThdSleepMilliseconds(3000);

    // the other direction (possibly backward)
    pwmEnableChannel(&PWMD3, 3, 500);
    palSetPad(GPIOB, INBPIN);
    palClearPad(GPIOB, INAPIN);
    chThdSleepMilliseconds(3000);
  }
}
开发者ID:wicker,项目名称:Self-Driving-RC-Car,代码行数:25,代码来源:main.c


示例6: palSetPadMode

void PwmBacklight::Init()
{
	palSetPadMode(BACKLIGHT_PORT, BACKLIGHT_PIN, PAL_MODE_STM32_ALTERNATE_PUSHPULL);
	pwmStart(&PWMD4, &pwmconfig);

	FadeIn();
}
开发者ID:kubanecxxx,项目名称:homeautomation,代码行数:7,代码来源:PwmBacklight.cpp


示例7: convStart

void convStart( void )
{
    /*
    pwmStart( &PWMD2, &pwmCfg );
    palSetPadMode( GPIOA, 0, PAL_MODE_STM32_ALTERNATE_PUSHPULL );
    palSetPadMode( GPIOA, 1, PAL_MODE_STM32_ALTERNATE_PUSHPULL );
    //palSetPadMode( GPIOA, 2, PAL_MODE_STM32_ALTERNATE_PUSHPULL );
    pwmEnableChannel(&PWMD2, 0, PWM_PERCENTAGE_TO_WIDTH( &PWMD2, 9500 ) );
    pwmEnableChannel(&PWMD2, 1, PWM_PERCENTAGE_TO_WIDTH( &PWMD2, 3030 ) );
    //pwmEnableChannel(&PWMD2, 2, PWM_PERCENTAGE_TO_WIDTH( &PWMD2, 3030 ) );
    */

	// Start PWM peripherial.
    pwmStart( &CONV_PWM, &pwmCfg );
	// Init PWM pins.
    palSetPadMode( CONV_PORT, CONV_BUCK_PIN,  PAL_MODE_STM32_ALTERNATE_PUSHPULL );
    palSetPadMode( CONV_PORT, CONV_BOOST_PIN, PAL_MODE_STM32_ALTERNATE_PUSHPULL );
    // Set zero active period.
    pwmEnableChannel(&CONV_PWM, PWM_BOOST_CHAN, PWM_PERCENTAGE_TO_WIDTH( &CONV_PWM, 0000 ) );
    pwmEnableChannel(&CONV_PWM, PWM_BUCK_CHAN,  PWM_PERCENTAGE_TO_WIDTH( &CONV_PWM, 0000 ) );

    // Init ADC.
    palSetGroupMode(CONV_ADC_PORT, PAL_PORT_BIT( CONV_BUCK_FB_PIN ) |
    	                           PAL_PORT_BIT( CONV_BOOST_FB_PIN ) |
    	                           PAL_PORT_BIT( CONV_INPUT_FB_PIN ),
                                   0, PAL_MODE_INPUT_ANALOG);
    adcStart( &ADCD1, NULL );

    adcStartConversion( &ADCD1, &adcGroup, adcSamples, ADC_BUF_DEPTH );
}
开发者ID:z80,项目名称:robocam,代码行数:30,代码来源:conv_ctrl.c


示例8: ow_bus_active

/**
 * @brief     Put bus in active mode.
 */
static void ow_bus_active(onewireDriver *owp) {
  pwmStart(owp->config->pwmd, owp->config->pwmcfg);
#if defined(STM32F1XX)
  palSetPadMode(owp->config->port, owp->config->pad,
      owp->config->pad_mode_active);
#endif
}
开发者ID:awygle,项目名称:ChibiOS-Contrib,代码行数:10,代码来源:hal_onewire.c


示例9: main

/*
 * Application entry point.
 */
int main(void) {

  /*
   * System initializations.
   * - HAL initialization, this also initializes the configured device drivers
   *   and performs the board-specific initializations.
   * - Kernel initialization, the main() function becomes a thread and the
   *   RTOS is active.
   */
  halInit();
  chSysInit();
  pwmStart(&PWMD1, &pwmcfg);

  /*
   * Activates the serial driver 2 using the driver default configuration.
   */

  palSetPadMode(GPIOA, 9, PAL_MODE_ALTERNATE(2));

  /*
   * Creates the blinker thread.
   */
  chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);

  /*
   * Normal main() thread activity, in this demo it does nothing except
   * sleeping in a loop and check the button state.
   */
  while (true) {
    if (TRUE)  //(!palReadPad(GPIOC, GPIOC_BUTTON))
      //TestThread(&SD1);
    chThdSleepMilliseconds(5000);
  }
}
开发者ID:aktos-io,项目名称:chibi-examples,代码行数:37,代码来源:main.c


示例10: palSetPadMode

void PwmBacklight::Init()
{
	palSetPadMode(GPIOB, 6, PAL_MODE_STM32_ALTERNATE_PUSHPULL);
	pwmStart(&PWMD4, &pwmconfig);

	FadeIn();
}
开发者ID:kubanecxxx,项目名称:termostat,代码行数:7,代码来源:PwmBacklight.cpp


示例11: pwmStart

PWMPlatform::PWMPlatform() {
  pwmStart(&PWMD1, &MOTOR_PWM_CONFIG);
  palSetPadMode(GPIOC, 6, PAL_MODE_ALTERNATE(4));
  palSetPadMode(GPIOC, 7, PAL_MODE_ALTERNATE(4));
  palSetPadMode(GPIOC, 8, PAL_MODE_ALTERNATE(4));
  palSetPadMode(GPIOC, 9, PAL_MODE_ALTERNATE(4));
}
开发者ID:OSURoboticsClub,项目名称:aerial_control,代码行数:7,代码来源:pwm_platform.cpp


示例12: pwm2sub_node

msg_t pwm2sub_node(void * arg) {
	Node node("pwm2sub");
	Subscriber<PWM2Msg, 5> sub(callback);

	(void) arg;

	chRegSetThreadName("pwm2sub");

	palSetPad(DRIVER_GPIO, DRIVER_RESET);
	chThdSleepMilliseconds(500);
	pwmStart(&PWM_DRIVER, &pwmcfg);

	node.subscribe(sub, "pwm2");

	for (;;) {
		if (!node.spin(Time::ms(100))) {
			// Stop motor if no messages for 100 ms
			chSysLock()
			;
			pwm_lld_enable_channel(&PWM_DRIVER, 0, 0);
			pwm_lld_enable_channel(&PWM_DRIVER, 0, 0);
			chSysUnlock();
		}
	}
	return CH_SUCCESS;
}
开发者ID:AIRLab-POLIMI,项目名称:BasketBot_old,代码行数:26,代码来源:motor.cpp


示例13: demo_led_init

void demo_led_init(void)
{
    /*
     * PWM configuration structure.
     * Cyclic callback enabled, channels 1 and 4 enabled without callbacks,
     * the active state is a logic one.
     */
    static const PWMConfig pwmcfg = {
        100000,                                   /* 100kHz PWM clock frequency.  */
        128,                                      /* PWM period is 128 cycles.    */
        NULL,
        {
         {PWM_OUTPUT_ACTIVE_HIGH, NULL},
         {PWM_OUTPUT_ACTIVE_HIGH, NULL},
         {PWM_OUTPUT_ACTIVE_HIGH, NULL},
         {PWM_OUTPUT_ACTIVE_HIGH, NULL}
},
        /* HW dependent part.*/
        0,
        0
    };

    /*
     * Initializes the PWM driver 4, routes the TIM4 outputs to the board LEDs.
     */
    pwmStart(&PWMD4, &pwmcfg);
    palSetPadMode(GPIOD, GPIOD_LED4, PAL_MODE_ALTERNATE(2));      /* Green.   */
    palSetPadMode(GPIOD, GPIOD_LED3, PAL_MODE_ALTERNATE(2));      /* Orange.  */
    palSetPadMode(GPIOD, GPIOD_LED5, PAL_MODE_ALTERNATE(2));      /* Red.     */
    palSetPadMode(GPIOD, GPIOD_LED6, PAL_MODE_ALTERNATE(2));      /* Blue.    */
}
开发者ID:epfl-mobots,项目名称:stm32f4-discovery-aseba,代码行数:31,代码来源:leds.c


示例14: motor_init

void motor_init(void) {
	pwmStart(&PWMD2, &pwmcfg);
	
	pwmEnableChannel(&PWMD2, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD2, 500)); // 1mS Pulse
	pwmEnableChannel(&PWMD2, 1, PWM_PERCENTAGE_TO_WIDTH(&PWMD2, 500)); // 1mS Pulse
	pwmEnableChannel(&PWMD2, 2, PWM_PERCENTAGE_TO_WIDTH(&PWMD2, 500)); // 1mS Pulse
	pwmEnableChannel(&PWMD2, 3, PWM_PERCENTAGE_TO_WIDTH(&PWMD2, 500)); // 1mS Pulse
}
开发者ID:dancollins,项目名称:Quad-Rotor,代码行数:8,代码来源:motor.c


示例15: pwmStop

bool Pwm_chibios::init(void)
{
    pwmStop(driver_);
    pwmStart(driver_, &config_);
    pwmEnablePeriodicNotification(driver_);
    pwmEnableChannelNotification(driver_, channel_);
    return true;
}
开发者ID:lis-epfl,项目名称:MAVRIC_Library,代码行数:8,代码来源:pwm_chibios.cpp


示例16: main

/*
 * Application entry point.
 */
int main(void) {
  Thread *shelltp = NULL;

  /*
   * System initializations.
   * - HAL initialization, this also initializes the configured device drivers
   *   and performs the board-specific initializations.
   * - Kernel initialization, the main() function becomes a thread and the
   *   RTOS is active.
   */
  halInit();
  chSysInit();

  /*
   * Activates the serial driver 1 using the driver default configuration.
   */
  sdStart(&SERIAL_DRIVER, NULL);

  /*
   * Initializes the PWM driver.
   */
  pwmStart(&PWM_DRIVER, &pwmcfg);

  /*
   * Initializes the GPT driver.
   */
  gptStart(&GPT_DRIVER, &gptcfg);

  /*
   * Initializes the EXT driver.
   */
  extStart(&EXT_DRIVER, &extcfg);

  /*
   * Shell manager initialization.
   */
  shellInit();

  /*
   * Creates the blinker thread.
   */
  chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);

  /*
   * Normal main() thread activity, in this demo it does nothing except
   * sleeping in a loop and check the button state.
   */
  while (TRUE) {
    if (!shelltp)
      shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
    else if (chThdTerminated(shelltp)) {
      chThdRelease(shelltp);
      shelltp = NULL;
    }
    chprintf(&SERIAL_DRIVER, "M: %6umm T1: %6u T2: %6u\r\n", measure / 2, tmp1, tmp2);
    chThdSleepMilliseconds(200);
  }
}
开发者ID:openrobots-dev,项目名称:R2P_Sonar_module,代码行数:61,代码来源:main_hardware_test.c


示例17: MotorsInit

void MotorsInit(void){

	pwmStart(&PWMD8, &pwmcfg);
	palSetPadMode(GPIOC, 6, PAL_MODE_ALTERNATE(3));
	palSetPadMode(GPIOC, 7, PAL_MODE_ALTERNATE(3));
	palSetPadMode(GPIOC, 8, PAL_MODE_ALTERNATE(3));
	palSetPadMode(GPIOC, 9, PAL_MODE_ALTERNATE(3));

	unsigned i;
	for (i=0; i<NUM_MOTORS; i++){
		MotorsSetSpeed(i, 0);
	}
}
开发者ID:JeremySavonet,项目名称:ChibiCopter,代码行数:13,代码来源:Motors.c


示例18: __attribute__

static __attribute__((noreturn)) msg_t PWMThread2(void *arg){
    (void)arg;
    chRegSetThreadName("PWM Thread 2");
    uint16_t pwmVal2 = 1;
    palSetPadMode(GPIOA, GPIOA_PA1, PAL_MODE_OUTPUT_PUSHPULL);
    pwmStart(&PWMD2,&pwmcfg2);
    while(TRUE){
        if(pwmVal2 >= 1024){ pwmVal2 = 1; }
        else { pwmVal2 <<= 1; }
        pwmEnableChannel(&PWMD2,1,pwmVal2);
        chThdSleepMilliseconds(100);
    }
}
开发者ID:emdarcher,项目名称:chibios-tinkering,代码行数:13,代码来源:main.c


示例19: main

int main(void) {
    halInit();
    chSysInit();

    chThdSleepMilliseconds(200);

    // input capture & high-res timer
    const ICUConfig icuConfig = { ICU_INPUT_ACTIVE_HIGH, 1000000, nullptr, nullptr, nullptr, nullptr, nullptr };
    icuStart(&TIMING_ICU, &icuConfig);
    icuEnable(&TIMING_ICU);

    // serial setup
    const SerialConfig btSerialConfig = { 921600, 0, USART_CR2_STOP1_BITS, USART_CR3_CTSE | USART_CR3_RTSE };
    sdStart(&BT_SERIAL, &btSerialConfig);

    // PWM setup
    const PWMConfig mPWMConfig = { STM32_TIMCLK1, PWM_PERIOD, nullptr, {
            { PWM_OUTPUT_DISABLED, nullptr },
            { PWM_OUTPUT_DISABLED, nullptr },
            { PWM_OUTPUT_ACTIVE_HIGH, nullptr },
            { PWM_OUTPUT_ACTIVE_HIGH, nullptr } }, 0, };
    pwmStart(&M1_PWM, &mPWMConfig);

    // SPI setup
    // speed = pclk/8 = 5.25MHz
    const SPIConfig m1SPIConfig = { NULL, GPIOC, GPIOC_M1_NSS, SPI_CR1_DFF | SPI_CR1_BR_1 };
    const SPIConfig m2SPIConfig = { NULL, GPIOD, GPIOD_M2_NSS, SPI_CR1_DFF | SPI_CR1_BR_1 };
    const SPIConfig adcSPIConfig = { NULL, GPIOA, GPIOA_ADC_NSS, SPI_CR1_BR_2 | SPI_CR1_CPHA };
    spiStart(&M1_SPI, &m1SPIConfig);
    spiStart(&M2_SPI, &m2SPIConfig);
    spiStart(&ADC_SPI, &adcSPIConfig);

    // motor setup
    A4960 m1(&M1_SPI, &M1_PWM, M1_PWM_CHAN);
    A4960 m2(&M2_SPI, &M2_PWM, M2_PWM_CHAN);

    // ADC setup
    ADS1259 adc(&ADC_SPI);

    // initialize control structure
    Tortilla tortilla(m1, m2, adc, &TIMING_ICU, &BT_SERIAL);

    // start slave threads
//    chThdCreateStatic(waHeartbeat, sizeof(waHeartbeat), IDLEPRIO, tfunc_t(threadHeartbeat), nullptr);
    chThdCreateStatic(waIO, sizeof(waIO), LOWPRIO, tfunc_t(threadIO), &tortilla);

    // done with setup
    palClearPad(GPIOC, GPIOC_LEDB);
    palClearPad(GPIOB, GPIOB_LED2);
    tortilla.fastLoop();
}
开发者ID:GHF,项目名称:gyroking,代码行数:51,代码来源:main.cpp


示例20: main

/*
 * Application entry point.
 */
int main(void)
{
#if 0
	static const evhandler_t evhndl[] = {
		InsertHandler,
		RemoveHandler
	};
#endif
	/*
	* System initializations.
	* - HAL initialization, this also initializes the configured device drivers
	*   and performs the board-specific initializations.
	* - Kernel initialization, the main() function becomes a thread and the
	*   RTOS is active.
	*/
	halInit();
	chSysInit();
	crypto_init();
	buttons_init();

	chHeapInit(fast_heap, FAST_HEAP_ADDR, FAST_HEAP_SIZE);

	sdStart(&SD2, NULL);
	palSetPadMode(GPIOA, 2, PAL_MODE_ALTERNATE(7));
	palSetPadMode(GPIOA, 3, PAL_MODE_ALTERNATE(7));
	lcd_init();

	setvbuf(stdin, NULL, _IONBF, 0);

	mmcObjectInit(&MMCD1);
	mmcStart(&MMCD1, &mmccfg);
	mount_card();

	pwmStart(&PWMD1, &lcd_pwmcfg);
	palSetPadMode(GPIOA, 8, PAL_MODE_ALTERNATE(1));

	// XXX moveme
	palSetPadMode(GPIOB, 6, PAL_MODE_INPUT_PULLUP);
	palSetPadMode(GPIOB, 15, PAL_MODE_INPUT_PULLUP);
	palSetPadMode(GPIOB, 14, PAL_MODE_INPUT_PULLUP);
	palSetPadMode(GPIOC, 10, PAL_MODE_INPUT_PULLUP);
	palSetPadMode(GPIOC, 11, PAL_MODE_INPUT_PULLUP);

	fiprintf(lcd_stdout, "HIHI");
	while (TRUE) {
		console_cmd_loop();
		//chEvtDispatch(evhndl, chEvtWaitOne(ALL_EVENTS));
	}

	return 0;
}
开发者ID:cdrttn,项目名称:keeper,代码行数:54,代码来源:main.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ pwmWrite函数代码示例发布时间:2022-05-30
下一篇:
C++ pwarn函数代码示例发布时间: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