Example #1
0
int main(void)
{  
	uint32_t i = 0;

	RCC_GetClocksFreq( &RCC_Clocks );

	ConfigureLED(); 

	LED_OFF;

	// SysTick end of count event each 10ms
	SysTick_Config( RCC_Clocks.HCLK_Frequency / 100);

	float fv = RCC_Clocks.HCLK_Frequency / 1000000.0f;
//	We can use printf to print back through the debugging interface, but that's slow and
//  it also takes up a bunch of space.  No printf = no space wasted in printf.
//	printf( "Operating at %.3fMHz\n", fv );

	InitColorChord();
	Configure_PA0();
	InitMP45DT02();
	InitSPI2812();

	int this_samp = 0;
	int wf = 0;

	while(1)
	{

		if( this_samp != last_samp_pos )
		{
			LED_OFF; //Use led on the board to show us how much CPU we're using. (You can also probe PB15)

			PushSample32( sampbuff[this_samp]/2 ); //Can't put in full volume.

			this_samp = (this_samp+1)%CIRCBUFSIZE;

			wf++;
			if( wf == 128 )
			{
				NewFrame();
				wf = 0; 
			}
			LED_ON;
		}
		LED_ON; //Take up a little more time to make sure we don't miss this.
	}
}
Example #2
0
int main(void)
{  
	uint32_t i = 0;

	RCC_GetClocksFreq( &RCC_Clocks );

	ConfigureLED(); LED_ON;

	/* SysTick end of count event each 10ms */
//	SysTick_Config( RCC_Clocks.HCLK_Frequency / 100);

//	printf( "Operating at %dHz\n", RCC_Clocks.HCLK_Frequency );
	while(1)
	{
	}
}
Example #3
0
void main(void)
{
  WDTCTL = WDTPW + WDTHOLD; // Stop WDT
  ConfigureAdc();
  ConfigureLED();

	ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
	__bis_SR_register(CPUOFF + GIE); // LPM0, ADC10_ISR will force exit
	sample = ADC10MEM; // get ADC in value
	__delay_cycles(1150000); 	// 1 second delay

   for(;;)
  {
		__delay_cycles(1150000); 	// 1 second delay
	ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
	__bis_SR_register(CPUOFF + GIE); // LPM0, ADC10_ISR will force exit
	sample = ADC10MEM; // get ADC in value



		if (sample > 892 ) {
					P1OUT &= ~BIT0; 			//Power off
					P1OUT |= BIT6;   //Enable heater
					P2OUT |= (BIT1); //Enable RED Led
					P1OUT &= ~BIT1;  //Disable BLUE Led

		}




		if (sample < 892 ) {
			P1OUT |= BIT0; 			//Power on
    		__delay_cycles(3450000); 	// 3 second delay
     		__delay_cycles(3450000); 	// 3 second delay
     		__delay_cycles(3450000); 	// 3 second delay
     		__delay_cycles(3450000); 	// 3 second delay
     		__delay_cycles(1150000); 	// 1 second delay

			if((P1IN & BIT2) == 0  ) {
					P1OUT &= ~BIT6;   		//disable heater
					P2OUT &= ~(BIT1);     	//Disable RED Led
					P1OUT &= ~(BIT1);	  	//Disable Blue Led
					flag = 0;
				}else {

     		while(1)
			{
    			if( flag == 0 && (P1IN & BIT2) == BIT2) {
    				// Reboot
    				P1OUT &= ~BIT0;			//poweroff
    				P1OUT &= ~BIT6;   		//disable heater
    				P2OUT &= ~(BIT1);     	//Disable RED Led
    				P1OUT &= ~(BIT1);	  	//Disable Blue Led
    				__delay_cycles(3450000); 	// 3 second delay
    				P1OUT |= BIT0; 			//Power on

    				break;

    			}else{

    				while(1)
    				{

					//system off
					if((P1IN & BIT2) == 0 ) {
						P1OUT &= ~BIT6;   		//disable heater
						P2OUT &= ~(BIT1);     	//Disable RED Led
						P1OUT &= ~(BIT1);	  	//Disable Blue Led
						flag = 0;
						//break;
						ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
						__bis_SR_register(CPUOFF + GIE); // LPM0, ADC10_ISR will force exit
						sample = ADC10MEM; // get ADC in value
						__delay_cycles(1150000); 	// 1 second delay
						ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
						__bis_SR_register(CPUOFF + GIE); // LPM0, ADC10_ISR will force exit
						sample = ADC10MEM; // get ADC in value
					}

					//system on & too cold reboot
					if((P1IN & BIT2) == BIT2 && sample > 892)
						break;

					//keyboard reset
					if( (P1IN & BIT3) == 0 && (P1IN & BIT2) == BIT2 )
						break;

					//for Power sequence test
					if((P1OUT & BIT0) == 0)
						break;

    				}
				break;
    			}

			}
			 }
		}



  }
}