/*! \brief configure led \param[in] none \param[out] none \retval none */ void led_config(void) { gd_eval_ledinit (LED1); gd_eval_ledinit (LED2); gd_eval_ledinit (LED3); gd_eval_ledinit (LED4); }
/*! \brief LEDs configure \param[in] none \param[out] none \retval none */ void led_config(void) { /* initialize the LEDs */ gd_eval_ledinit(LED1); gd_eval_ledinit(LED2); /* close all of LEDs */ gd_eval_ledoff(LED1); gd_eval_ledoff(LED2); }
void LOS_EvbLedInit(void) { #ifdef GD32F150R8 gd_eval_ledinit(LED1); gd_eval_ledinit(LED2); gd_eval_ledinit(LED3); #endif return; }
/*! \brief main function \param[in] none \param[out] none \retval none */ int main(void) { /* GPIO clock enable */ rcu_periph_clock_enable(RCU_GPIOA); rcu_periph_clock_enable(RCU_GPIOB); rcu_periph_clock_enable(RCU_GPIOC); rcu_periph_clock_enable(RCU_GPIOF); /* delay time initialize */ systick_config(); /* configure the CEC peripheral */ cec_config(); /* configure the EXTI */ gd_eval_keyinit(KEY_TAMPER, KEY_MODE_EXTI); #ifdef GD32F130_150 gd_eval_keyinit(KEY_USER, KEY_MODE_EXTI); #elif defined(GD32F170_190) gd_eval_keyinit(KEY_WAKEUP, KEY_MODE_EXTI); #endif /* GD32F130_150 */ /* LED1 LED2 initialize */ gd_eval_ledinit(LED1); gd_eval_ledinit(LED2); gd_eval_ledoff(LED1); gd_eval_ledoff(LED2); /* main loop */ while(1) { /* wait receive data */ while(rcvstatus==0); if(rcvstatus == 1) { if((rcvdata[1]==0xA5)&&(rcvdata[2]==0x5A)) { gd_eval_ledon(LED1); delay_1ms(10); gd_eval_ledoff(LED1); } if((rcvdata[1]==0x5A)&&(rcvdata[2]==0xA5)) { gd_eval_ledon(LED2); delay_1ms(10); gd_eval_ledoff(LED2); } } /* a reception error occured */ rcvstatus = 0; } }
/*! \brief main function \param[in] none \param[out] none \retval none */ int main(void) { /* system clocks configuration */ irc40k_config(); systick_config(); gd_eval_ledinit(LED2); gd_eval_keyinit(KEY_TAMPER,KEY_MODE_EXTI); delay_1ms(50); /* enable write access to FWDGT_PSC and FWDGT_RLD registers. FWDGT counter clock: 40KHz(IRC40K) / 64 = 0.625 KHz */ fwdgt_config(625,FWDGT_PSC_DIV64); fwdgt_enable(); /* check if the system has resumed from FWDGT reset */ if (RESET != rcu_flag_get(RCU_FLAG_FWDGTRST)){ gd_eval_ledon(LED2); rcu_reset_flag_clear(); while(1); }else{ gd_eval_ledoff(LED2); } while (1); }
/*! \brief initialize the LEDs \param[in] none \param[out] none \retval none */ void led_init(void) { //gd_eval_ledinit(LED1); //gd_eval_ledinit(LED2); gd_eval_ledinit(LED3); return; }
/*! \brief main function \param[in] none \param[out] none \retval none */ int main(void) { gpio_config(); gd_eval_ledinit(LED1); timer_config(); while (1); }
/*! \brief main function \param[in] none \param[out] none \retval none */ int main(void) { gd_eval_ledinit(LED2); systick_config(); while (1); }
void LOS_EvbKeyInit(void) { #ifdef GD32F150R8 /* configure User key */ gd_eval_keyinit(KEY_USER, KEY_MODE_GPIO); gd_eval_ledinit(LED1); #endif return; }
/*! \brief main function \param[in] none \param[out] none \retval none */ int main(void) { systick_config(); gd_eval_ledinit(LED1); gd_eval_keyinit(KEY_TAMPER,KEY_MODE_GPIO); while(1){ /* check whether the button is pressed */ if(RESET == gd_eval_keygetstate(KEY_TAMPER)){ delay_1ms(100); /* check whether the button is pressed */ if(RESET == gd_eval_keygetstate(KEY_TAMPER)){ gd_eval_ledtoggle(LED1); } } } }
/*! \brief main function \param[in] none \param[out] none \retval none */ int main(void) { /* NVIC config */ nvic_priority_group_set(NVIC_PRIGROUP_PRE0_SUB4); nvic_irq_enable(LVD_IRQn,0,0); /* clock enable */ rcu_periph_clock_enable(RCU_PMU); /* led1 config */ gd_eval_ledinit (LED1); /* led1 turn on */ gd_eval_ledon(LED1); /* EXTI_16 config */ exti_init(EXTI_16, EXTI_INTERRUPT, EXTI_TRIG_BOTH); /* configure the lvd threshold to 2.9v(gd32f130_150) or 4.5v(gd32f170_190), and enable the lvd */ pmu_lvd_select(PMU_LVDT_7); while(1); }
/*! \brief main function \param[in] none \param[out] none \retval none */ int main(void) { /* configure RCU */ rcu_config(); /* configure GPIO */ gpio_config(); /* configure leds */ gd_eval_ledinit(LED3); /* configure comparator channel0 */ cmp_mode_init(CMP_CHANNEL_CMP0, CMP_VERYLOWSPEED, CMP_1_4VREFINT, CMP_HYSTERESIS_NO); cmp_output_init(CMP_CHANNEL_CMP0, CMP_OUTPUT_TIM1IC3, CMP_OUTPUT_POLARITY_NOINVERTED); /* configure TIMER */ timer_config(); /* enable comparator channel0 */ cmp_channel_enable(CMP_CHANNEL_CMP0); while(1); }