|
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
if(htim == &htim3)
{
static int delay_led=0;
delay_led++;
if(delay_led ==2000)
{
//LD2_Write(1);
}
if(delay_led ==4000)
{
delay_led=0;
//LD2_Write(0);
}
adc1_tim++;
if(adc1_tim >10000) adc1_tim =0;
static int dac_tim=0;
dac_tim +=1;
HAL_DAC_Start(&hdac1,DAC_CHANNEL_2);
HAL_DAC_SetValue(&hdac1,DAC_CHANNEL_2,DAC_ALIGN_12B_R,dac_tim);
if(dac_tim >= 4096) dac_tim=0;
}
}