/**
 * First init
 */
static void firstInit(void) {

	//Hardware init
	GPIO_init();
	USART1_init();//midi
	USART6_init();//debug
	usb_midi_init(); //Init everything for midiUSB

	ADC_init_all(); //ADC init
	SD_DMA_activate();
	//Display
	delayms(400);
#ifdef WS0010_GRAPHICS
	hd44780_init();
	hd44780_display( HD44780_DISP_ON, HD44780_DISP_CURS_OFF, HD44780_DISP_BLINK_OFF);
	ws0010_Graphics_mode();
	ws0010_Draw_buffer(pictureVMK188);
    delayms(20000);
	ws0010_Character_mode();
	hd44780_init();
#else
	hd44780_init();
	hd44780_display( HD44780_DISP_ON, HD44780_DISP_CURS_OFF, HD44780_DISP_BLINK_OFF);
	hd44780_message_center(APP_NAME, 1);
	hd44780_message_center(APP_VERSION, 2);
    delayms(3000);
#endif

}
Esempio n. 2
0
/*
 * 函数名:main
 * 描述  :主函数
 * 输入  :无
 * 输出  :无
 */
int main(void)
{
	
	SystemInit();
	USART1_init();//USART初始化
	SPI1_init()	;//SPI初始化
	DW1000_init();//DW1000初始化
	TIM3_init(); //定时器3初始化
	EXTI_init();  //外部中断初始化
	TIM4_init();
	RX_mode_enable();
	printf("RX!\r\n");

	
	
	printf("**********************************\r\n");

	

	while (1)
	{
		;
	}      
	
}
Esempio n. 3
0
int main(void) {
	u8 dip_config;
	SystemInit();

	// Init USB for Master Nodes
	#if defined(RX4) || defined(RX5) || defined(RX6)
	Set_System();
	Set_USBClock();
	USB_Interrupts_Config();
	USB_Init();
	#endif

	dip_config = Read_DIP_Configuration();

	// USART1初始化,波特率115200,单次8比特,无奇偶校验,1停止位:用于上位机下发命令
	USART1_init(dip_config);
	// 串口监听
	TIM4_init();
	//InitMPU6050();
	SPI1_init();
	TIM3_init();
	GPIO_Configuration();

	DW1000_init(dip_config);
	EXTI_init();

	#ifdef TX
	TIM2_init(); // LS Poll Cycle
	#endif

	RX_mode_enable();
	DEBUG1(("=====Init Done, with DIP config: %02X=====\r\n", dip_config));

	while(1) {
		;
	}
}
Esempio n. 4
0
int main(void){
	const uint16_t delay_t = 1000;	//Debug LED flash
	bool less_delay = false;	//compensate for LEx_led delay
	
	cli();//Disable Global Interrupt
	SPI_init();
	USART1_init(103);	//9600 baud rate
	sei();	//Enable Global Interrupt
	
	//set port as output
	//short pulse to execute the cmd received by the phase shifter
	DDRB |= 1<<DDB6;	//LE1 pulse
	DDRB |= 1<<DDB5;	//LE2 pulse
	DDRB |= 1<<DDB4;	//LE3 pulse
	DDRB |= 1<<DDB7;	//LE4 pulse
	
	//LED flashes after LE1 pulse is applied
	DDRE |= 1<<DDE6;	//PE6; LE1 LED
	DDRC |= 1<<DDC7;	//PC7; LE2 LED
	DDRC |= 1<<DDC6;	//PC6; LE3 LED
	DDRD |= 1<<DDD7;	//PD7; LE4 LED
	
	DDRB |= 1<<DDB0;	//debug; set port as output
	
	DDRD |= 1<<DDD5;	//set as output
	PORTD |= 1<<DDD5;	//turn off LED
	
    while (1){							
		PINB |= 1<<PINB0;		
		
		USART1_TX(0x15);
		
		if(LE1_led == 1){
			LE1_led = 0;
			PINE |= 1<<PINE6;	//turn on
			_delay_ms(LEx_led_t);
			PINE |= 1<<PINE6;	//turn off
			less_delay = true;
		}
		if(LE2_led == 1){
			LE2_led = 0;
			PINC |= 1<<PINC7;	//turn on
			_delay_ms(LEx_led_t);
			PINC |= 1<<PINC7;	//turn off
			less_delay = true;
		}
		if(LE3_led == 1){
			LE3_led = 0;
			PINC |= 1<<PINC6;	//turn on
			_delay_ms(LEx_led_t);
			PINC |= 1<<PINC6;	//turn off
			less_delay = true;
		} 
		if(LE4_led == 1){
			LE4_led = 0;
			PIND |= 1<<PIND7;	//turn on
			_delay_ms(LEx_led_t);
			PIND |= 1<<PIND7;	//turn off
			less_delay = true;
		}				
		
		if(less_delay){
			_delay_ms(delay_t-LEx_led_t);	
			less_delay = false;
		} else{
			_delay_ms(delay_t);	
		}
    }
}