Example #1
0
/* Your code will start executing here */
int main(void) 
{  
  /* Call the peripheral setup functions */
  setupDAC();
  enableDAC();
  setupGPIO();

  if (energyEfficient) {
    setupLETimer();   //We don't supply a period here because we want the default value
    enableLETimer();
  }
  else {
    setupNormalTimer(HIGH_ENERGY_FREQUENCY / BITRATE);
  }
  
  /* Enable interrupt handling */
  setupNVIC();
  
  /* TODO for higher energy efficiency, sleep while waiting for interrupts
     instead of infinite loop for busy-waiting
  */
  if (energyEfficient)  *SCR = 6;
  else                  __asm("wfi");

  return 0;
}
Example #2
0
/* Your code will start executing here */
int main(void) 
{
	/* Call the peripheral setup functions */
	setupGPIO();
	setupDAC();
	setupTimer(SAMPLE_PERIOD);


	/*
	 * Deep sleep while waiting for interrupts
	 */
	*SCR = 6; //0110
	__asm volatile ("wfi");

	return 0;
}
Example #3
0
File: ex2.c Project: Catuna/TDT4258
int main(void) 
{  
  setupGPIO();                //Setup general purpose input/output
  setupDAC();                 //Setup digital to analog converter
  setupTimer();               //Setup timer
  
  /*page 140 manual. Used to prescale the clock. 
   *Only used for testing purposes*/
  //*CMU_HFPERCLKDIV = (1<<8) | (4 << 0);

  //Setup ability to deep sleep
  *SETUP_SCR |= 6;

  while(1)
  {
	   wfi();	 //call wait for inerrupt
  }

  return 0;
}
Example #4
0
int main(void) 

{  

  /* Call the peripheral setup functions */

  setupGPIO();

  setupDAC();

  setupTimer(SAMPLE_PERIOD);

  

  /* Enable interrupt handling */



  *SCR = 2;

  setupNVIC();

  __asm volatile("wfi");

  

  /* TODO for higher energy efficiency, sleep while waiting for interrupts

     instead of infinite loop for busy-waiting

  */

  while(1);



  return 0;

}
Example #5
0
int main( void ) 
{
	setupBSP();

	Delay_Init();
 
	setupMEM();
	setupFPGA();
	setupINT();

	setupCMU();

	setupPRS();

	setupDAC();
	setupDMA();
	setupADC();

	setupTIMER();

	Delay_Init();

	BSP_LedsInit();
	BSP_LedsSet(0);

	while(1) {

		//test_and_display();
		BSP_LedToggle(0);
		Delay(1000);
		BSP_LedsSet(0);
		Delay(500);

	}
	
}