예제 #1
0
파일: main.c 프로젝트: quailson/synthBuddy
//MAIN
int main(void)
{
	printf("Hello World!\r\n"); //confirm dingus program has started

	//INITS
	SystemInit();
	gpioInit();
	timInit();
	TIM_ITConfig(TIM6, TIM_IT_Update, DISABLE);	//DISABLE INTERRUPTS FOR AUDIO INITS

	EVAL_AUDIO_Init(OUTPUT_DEVICE_AUTO, 100, SAMPLE_FREQ); //should default to headphones, full volume, 48kHz
	EVAL_AUDIO_Play((uint16_t*) audio_buffer, BUFF); //add once there's audio to hear

	TIM_ITConfig(TIM6, TIM_IT_Update, ENABLE); 	//ENABLE INTERRUPTS AFTER

	printf("Ready!\n"); //print when everythin' is done

	voiceInit(&voice, 1.f, 1.f);


	//YEAH BABY
    while(1)
    {
    	printf("\nP\nI\nZ\nZ\nA\n"); //confirm in loop with pizza spelling contest
    	delay(80000);
    }
}
예제 #2
0
int platformInit(void)
{
	//Low level init: Clock and Interrupt controller
	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);

	// Disable the jtag gpio
	GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);

	// adcInit();

	ledInit();

	ledSet(0, 0);
	ledSet(1, 0);
	ledSet(2, 0);

	delay_ms(500);
	ledSet(0, 1);
	delay_ms(500);
	ledSet(1, 1);
	delay_ms(500);
	ledSet(2, 1);

	delay_ms(500);

	// while(1)
	// {
	// 	uint8_t i;
	// 	for(i = 0; i < 3; i++)
	// 	{
	// 		ledSet(i, 1);
	// 		delay_ms(1000);
	// 		ledSet(0, 0);
	// 		ledSet(1, 0);
	// 		ledSet(2, 0);
	// 	}

	// }

	uartInit();

	timInit();

	return 0;
}
예제 #3
0
int main(int argc, char* argv[])
{
        
        csInit ();
	spiInit(SPI1);
        
        mySPI_SendData(Ctrl_Reg1, 0x40); //0x40 = 0100000, 0xC0 = 11000000 = 400 Hz output data rate), active
    
	uart_open(myUSART, 9600, 0);
	uint8_t ri;
	cmdi = 0;
        
        timInit();


	// Infinite loop
	while (1)
	{
        }
	uart_close(myUSART);
}
예제 #4
0
// TODO: Implement!
int platformInit(void)
{
	//Low level init: Clock and Interrupt controller
	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);

	// Disable the jtag gpio
	GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);

	// adcInit();

	timInit();

	nrf24l01Init();

	nrf24l01SetAddress();
	// nrf24l01ConnectCheck();

	// mpu9150Init();
	// mpu9150Status();

	return 0;
}
예제 #5
0
// TODO: Implement!
int platformInit ( void )
{
	uint8_t i = 0;
	int checksum = 0;

	//Low level init: Clock and Interrupt controller
	NVIC_PriorityGroupConfig ( NVIC_PriorityGroup_4 );

	// Disable the jtag gpio
	GPIO_PinRemapConfig ( GPIO_Remap_SWJ_JTAGDisable, ENABLE );

	ledInit();

	ledSet ( 0, 0 );
	ledSet ( 1, 0 );
	ledSet ( 2, 0 );

	delay_ms ( 500 );
	ledSet ( 0, 1 );
	delay_ms ( 500 );
	ledSet ( 1, 1 );
	delay_ms ( 500 );
	ledSet ( 2, 1 );

	delay_ms ( 500 );

	uartInit();

	DEBUG_PRINT ( "Too young too simple, sometimes naive.\n" );
	DEBUG_PRINT ( "I'm a journalist from Hongkong.\n" );
	DEBUG_PRINT ( "I could run very fast.\n" );
	DEBUG_PRINT ( "------------------------------\n" );

	DEBUG_PRINT ( "uart init successfully.\n" );

	ledSet ( 0, 0 );

	// adcInit();

	DEBUG_PRINT ( "test motor.\n" );

	timInit();

	DEBUG_PRINT ( "waking up driver.\n" );

	wakeupDriver();

	timSetPulse ( TIM2, 3, 0 );
	timSetPulse ( TIM3, 3, 0 );
	timSetPulse ( TIM4, 3, 0 );
	timSetPulse ( TIM2, 4, 0 );
	timSetPulse ( TIM3, 4, 0 );
	timSetPulse ( TIM4, 4, 0 );

	delay_ms ( 500 );

	timSetPulse ( TIM2, 4, 500 );
	timSetPulse ( TIM3, 4, 500 );
	timSetPulse ( TIM4, 4, 500 );

	delay_ms ( 500 );

	timSetPulse ( TIM2, 3, 0 );
	timSetPulse ( TIM3, 3, 0 );
	timSetPulse ( TIM4, 3, 0 );
	timSetPulse ( TIM2, 4, 0 );
	timSetPulse ( TIM3, 4, 0 );
	timSetPulse ( TIM4, 4, 0 );

	delay_ms ( 500 );

	timSetPulse ( TIM2, 3, 500 );
	timSetPulse ( TIM3, 3, 500 );
	timSetPulse ( TIM4, 3, 500 );

	delay_ms ( 500 );

	timSetPulse ( TIM2, 3, 0 );
	timSetPulse ( TIM3, 3, 0 );
	timSetPulse ( TIM4, 3, 0 );
	timSetPulse ( TIM2, 4, 0 );
	timSetPulse ( TIM3, 4, 0 );
	timSetPulse ( TIM4, 4, 0 );

	ledSet ( 1, 0 );

	delay_ms ( 200 );

	nrf24l01Init();

	i = nrf24l01ConnectCheck();

	nrf24l01SetAddress();
	// i = nrf24l01ConnectCheck();

	if ( i == 1 )
	{
		checksum --;
		ledSet ( 2, 0 );
	}

	delay_ms ( 1000 );

	// mpu9150Init();
	// i = mpu9150Status();

	// if(!i)
	// {
	//  checksum --;
	//  ledSet(1, 0);
	// }

	if ( checksum > 0 )
	{
		delay_ms ( 1000 );

		timSetPulse ( TIM2, 3, 0 );
		timSetPulse ( TIM3, 3, 0 );
		timSetPulse ( TIM4, 3, 0 );
		timSetPulse ( TIM2, 4, 0 );
		timSetPulse ( TIM3, 4, 0 );
		timSetPulse ( TIM4, 4, 0 );
		// timSetPulse(TIM2, 4, 999);
		// timSetPulse(TIM3, 4, 999);
		// timSetPulse(TIM4, 4, 999);

		while ( 1 )
		{

			ledSet ( 0, 1 );
			ledSet ( 1, 1 );
			ledSet ( 2, 1 );
			delay_ms ( 100 );
			ledSet ( 0, 0 );
			ledSet ( 1, 0 );
			ledSet ( 2, 0 );
			delay_ms ( 100 );
		}
	}

	ledSet ( 0, 0 );
	ledSet ( 1, 0 );
	ledSet ( 2, 0 );

	delay_ms ( 500 );

	ledSet ( 0, 1 );
	ledSet ( 1, 1 );
	ledSet ( 2, 1 );

	delay_ms ( 500 );

	ledSet ( 0, 0 );
	ledSet ( 1, 0 );
	ledSet ( 2, 0 );

	return 0;
}