예제 #1
0
int hardwareSetup()
{
    int retval;
    

    /*
        GPIO 110 ==> JTAG_TMS
        GPIO 112 ==> JTAG_TDI 
        GPIO 114 ==> JTAG_TCK
        GPIO 115 ==> JTAG_TDO
    */

    printf("doing hardware setup\n");

    retval = setupGPIO(110, "out", &fvTMS);
    if(retval) { return retval; }

    retval = setupGPIO(112, "out", &fvTDI);
    if(retval) { return retval; }

    retval = setupGPIO(114, "out", &fvTCK);
    if(retval) { return retval; }

    retval = setupGPIO(115, "in", &fvTDO);
    if(retval) { return retval; }

    retval = 0;
    return retval;
}
예제 #2
0
파일: ex2.c 프로젝트: Snikanes/tdt4258
/* 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;
}
예제 #3
0
void RaspRPM::prepareGPIOs()
{
	if (wiringPiSetup() == -1)
	{
		perror("wiringPiSetup");
		exit(1);
	}

	for (size_t i = 0; i < _computers.size(); i++)
	{
		fprintf(stderr, "Configure computer '%s':\n", _computers.at(i).name.toUTF8().c_str());
		setupGPIO("power LED", INPUT, _computers.at(i).powerLed);
		setupGPIO("power switch", OUTPUT, _computers.at(i).powerSwitch);
		setupGPIO("ATX power", OUTPUT, _computers.at(i).atxSwitch);
		fprintf(stderr, "\n");
	}
}
예제 #4
0
파일: main.c 프로젝트: bsjurs1/eeds
int main(void) {  
    setupSleep(0b110);
    setupGPIO();
    setupNVIC();

//    playSong(&SCOM, 0x24FF); 

//    wfi();
    return 0;
}
예제 #5
0
 int main(int argc, char *argv[])  
 {  
   int fd30;  
   // First enable GPIO30  
   fd30 = setupGPIO("30","out");  
   int i;  
   for (i=0; i < 10; i++) {  
     tickTock(fd30);  
   }  
   close(fd30);    
 //  freeGPIO("30");  
   return 0;  
 }  
예제 #6
0
파일: ex2.c 프로젝트: imre-kerr/tdt4258
/* 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;
}
예제 #7
0
파일: ex2.c 프로젝트: 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;
}
예제 #8
0
파일: ex2.c 프로젝트: krissvor/TDT42581
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;

}
예제 #9
0
mraa_gpio_context setupGPIOIn( int pinNumber ) {

	return setupGPIO( pinNumber, MRAA_GPIO_IN );
}
예제 #10
0
mraa_gpio_context setupGPIOOut( int pinNumber ) {

	return setupGPIO( pinNumber, MRAA_GPIO_OUT );
}