示例#1
0
void terminate(const char *s)
{
	rtc_disable_interrupt(RTC, RTC_IDR_ALRDIS);//disabilito interrupt RTC
	rtt_disable_interrupt(RTT, RTT_MR_RTTINCIEN);//disabilito interrupt RTT
	afec_disable(AFEC0);//disabilito convertitore A/D
	dacc_disable_channel(DACC_BASE, DACC_CHANNEL);//disabilito convertitore D/A
	write_record_syslog(s);
	write_record_syslog("Programma terminato!");
	close_logfile_SD(); //chiudo logfile
	f_close(&syslog_file_object); //chiudo file syslog
	dac_out=0;//azzero tensione in uscita
	ioport_set_pin_level(LED_SD_USE, IOPORT_PIN_LEVEL_HIGH); //spengo led SD_USE
	ioport_set_pin_level(LED_SYSTEM_READY, IOPORT_PIN_LEVEL_HIGH); //spengo led SD_PRESENT
	ioport_set_pin_level(LED_ERROR, IOPORT_PIN_LEVEL_LOW); //accendo led ERROR
	exit(EXIT_SUCCESS);
}
示例#2
0
// Set the audio mode
void audioModeSet(AudioMode m) {
	// Don't do anything if mode is not changed
	if (mode == m) {
		return;
	}
	
	// Set new mode
	mode = m;
	audioFrequencySet(0); // Always reset currFreq on mode change
	switch (m) {
		case AM_OFF:
			pwm_channel_disable(PWM, PWM_CHANNEL_2);
			dacc_disable_channel(DACC, 0);
			break;
		case AM_ADC:
			pwm_channel_enable(PWM, PWM_CHANNEL_2);
			dacc_enable_channel(DACC, 0);
			break;
		case AM_HZ:
			pwm_channel_enable(PWM, PWM_CHANNEL_2);
			dacc_enable_channel(DACC, 0);
			break;
	}
}
示例#3
0
void DACClass::end() {
	TC_Stop(TC0, 1);
	NVIC_DisableIRQ(isrId);
	dacc_disable_channel(dac, 0);
	dacc_disable_channel(dac, 1);
}