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; }
/* 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; }
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"); } }
int main(void) { setupSleep(0b110); setupGPIO(); setupNVIC(); // playSong(&SCOM, 0x24FF); // wfi(); return 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; }
/* 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; }
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; }
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; }
mraa_gpio_context setupGPIOIn( int pinNumber ) { return setupGPIO( pinNumber, MRAA_GPIO_IN ); }
mraa_gpio_context setupGPIOOut( int pinNumber ) { return setupGPIO( pinNumber, MRAA_GPIO_OUT ); }