int main ( ) { hwa_begin_from_reset(); /* Start the high-speed external oscillator. */ hwa( power, hse, on ); /* Configure the PLL source and multiplier (must be done before it is enabled). */ hwa( configure, pll, source, hse/2, multiplier, SYSHZ/HW_DEVICE_HSEHZ ); /* Prepare the connection of the sysclk to the pll. The hardware will wait for * the PLL to be locked before actually switching. */ hwa( connect, sysclk, pll ); hwa_commit(); /* Turn the PLL on. */ hwa( turn, pll, on ); hwa_commit(); /* Wait for the PLL to be locked. */ while ( ! hw(stat,pll).ready ) {} /* Now that the SYSCLK is driven by the PLL, the HSI can be stopped. */ hwa( power, hsi, off ); /* Configure the AHB */ hwa( configure, ahb, clock, sysclk, prescaler, SYSHZ/COREHZ ); hwa_commit(); /* Configure the GPIO pin */ hwa( power, HW_RELATIVE(LED1,port), on ); hwa_commit(); hwa( configure, LED1, mode, digital, direction, output, frequency, 50MHz ); hwa_commit(); /* Wait for the HSI to actually stop. */ while ( hw(stat,hsi).ready ) {} for(;;) { hw( toggle, LED1 ); hw_waste_cycles( PERIOD*COREHZ/2 ); } }
void SurfaceFlinger::scanMirrorDisplay() { sp<DisplayDevice> hwMirrorSource; for (size_t i=0 ; i<mDisplays.size() ; i++) { sp<DisplayDevice> hw(mDisplays[i]); hw->setHwcMirrorId(-1); // temporarily solution to handle the out-of-order display list if (hw->getDisplayType() != DisplayDevice::DISPLAY_PRIMARY) { continue; } hwMirrorSource = hw; } if (hwMirrorSource != NULL) { uint32_t sourceLayerStack = hwMirrorSource->getLayerStack(); for (size_t j=0 ; j<mDisplays.size() ; j++) { sp<DisplayDevice> hw(mDisplays[j]); if (hwMirrorSource == hw) continue; if (sourceLayerStack == hw->getLayerStack()) { hw->setHwcMirrorId(hwMirrorSource->getHwcDisplayId()); } } } }
/* Service counter-compare0 IRQ: * disable this IRQ * turn the LED off * turn analog comparator IRQ on */ HW_ISR( COUNTER, COMPARE ) { hw( turn, HW_IRQ(COUNTER,COMPARE), off ); hw( write, PIN_LED, 0 ); hw( clear, HW_IRQFLAG(acmp0) ); hw( turn, HW_IRQ(acmp0), on ); }
/* Service ADC "conversion completed" IRQ: compute duty * Make the ISR interruptible so that counter IRQs are serviced promptly. */ HW_ISR( adc0, interruptible ) { /* Get the new value */ uint16_t adc = hw( read, adc0 ); /* Low-pass filter */ const uint8_t ns = 32 ; /* # of samples */ static uint16_t lpfsum ; /* sum of samples */ lpfsum = lpfsum - (lpfsum + ns/2)/ns + adc ; /* Compute duty in the range [COMPARE_MIN .. COMPARE_MAX] from lpfsum in the * range [0..ns*1023] */ uint32_t tmp32 = lpfsum ; tmp32 = (tmp32 * (COMPARE_MAX-COMPARE_MIN) + ns*1023/2) / (ns*1023) + COMPARE_MIN ; count_t tmp = tmp32 ; if ( sizeof(count_t) > 1 ) { hw( disable_interrupts ); duty = tmp ; hw( enable_interrupts ); /* HW_ATOMIC( */ /* duty = tmp ; */ /* ); */ } else duty = tmp ; /* Start a new conversion */ hw( trigger, adc0 ); }
int main ( ) { hwa_begin_from_reset(); /* Configure the PLL source and multiplier (must be done before it is enabled). * Prepare the connection of the sysclk to the pll. The hardware will wait for * the PLL to be locked before actually switching. */ hwa( configure, pll, source, hsi/2, multiplier, SYSHZ/(HW_DEVICE_HSIHZ/2) ); hwa( connect, sysclk, pll ); hwa_commit(); /* Turn the PLL on. */ hwa( turn, pll, on ); hwa_commit(); /* Wait for the PLL to be locked. */ while ( ! hw(stat,pll).ready ) {} /* Configure the AHB */ hwa( configure, ahb, clock, sysclk, prescaler, SYSHZ/AHBHZ ); hwa_commit(); /* Configure the GPIO pin */ hwa( power, HW_RELATIVE(LED1,port), on ); hwa_commit(); hwa( configure, LED1, mode, digital, direction, output, frequency, 50MHz ); hwa_commit(); /* Configure the system tick timer */ uint32_t onems = hw(read, HW_REGISTER(systick,onems)); hwa( configure, systick, clock, ahb, reload, ((uint32_t)(PERIOD/2 / 0.001)*onems - 1) & 0xFFFFFF ); hwa( turn, systick, on ); hwa( turn, HW_IRQ(systick), on ); hwa_commit(); /* Toggle the LED between sleeps */ for(;;) { hw_sleep_until_irq(); // hw_sleep_until_event() is OK too. hw( toggle, LED ); } }
int main() { std::string hw("Hello world!"); Memento mem(hw, "Goodbye, cruel world!"); hello_world(mem); return 0; }
int cglc_main() { cglc::screen scr; scr.renderer.back = "47"; scr.clean(); window win0(20, 10); window win1(20, 10); window win2(20, 10); win0.x = win0.y = 3; win1.x = win1.y = 6; win2.x = win2.y = 9; win0.renderer.back = "42"; win1.renderer.back = "43"; win2.renderer.back = "44"; win0.clean(); win1.clean(); win2.clean(); win2.title = "About Windows"; scr << win0; scr << win1; scr << win2; std::string startmenu(scr.width(), ' '); static_text sm(startmenu); sm.y = scr.high() - 1; sm.nib.back = "44"; scr << sm; static_text hl("#START"); hl.nib.back = "42"; hl.y = scr.high() - 1; scr << hl; static_text hw("\"Windows\" XP 2.0"); hw.nib.back = "44"; win2 << hw; scr << win2; scr.updscr(); }
int main(void) { int i , j , mul = 0, hws = 0; int i1, j1; for (i = 999; i >= 100; i--) { for (j = 999; j >= 100; j--) { if (hw(i * j)) { mul = i * j; if (hws <= mul) { hws = mul; i1 = i; j1 = j; } break; } } } printf("The result is : %d = %d * %d\n", hws, i1, j1); return 0; }
int main() { int yourMark = 1; // Mark: 2 multilevel_set<std::string> s; s.insert("Hello"); s.insert("World"); s.insert("World"); s.insert("Hello"); s.insert("Hello"); const multilevel_set<std::string> c = s; multilevel_set<int> x; for (int i = 0; i < max; ++i) { x.insert(i); x.insert(i + 1); } if (3 == c.count("Hello") && 3 == c.height() && 0 == c.count("C++") && x.count(0) != x.count(1) && 2 == x.count(max / 2)) { if (c.size(0) == c.size(1) && c.size(1) != c.size(2) && 2 == c.size(1)) { yourMark = c.count("World"); } } // Mark: 3 s.remove("World"); if (0 == s.count("World") && 2 * max == x.size()) { yourMark = s.size(); } // Mark: 4 multilevel_set<std::string, StringSizeLess> p; p.insert("AAA"); p.insert("BBB"); p.insert("CCC"); p.insert("DDD"); if (4 == p.height()) { yourMark = p.count("EEE"); } // Mark: 5 std::string msg = "Hello World"; multilevel_set<char> hw(msg.begin(), msg.end()); std::list<int> li; li.push_back(1); li.push_back(3); li.push_back(1); multilevel_set<int> ls(li.begin(), li.end()); if (3 == hw.height() && 2 == hw.count('o')) { yourMark = ls.size() + ls.count(3) + hw.count('e'); } std::cout << "Your mark is " << yourMark; std::endl(std::cout); }
CvMatWrapper DltLineSegmentIntersectionCalculator::compute(const PointPairs& samples) { LineSegmentIntersectionConstraints c; GenericDlt<PointPair> dlt; CvMat* h = dlt.compute(samples, c); CvMatWrapper hw(h); cvReleaseMat(&h); return hw; }
int main() { // Use the client class to invoke the print functionality of the derived // component 'B'. client hw(hpx::components::new_<B>(hpx::find_here())); hw.print(); return 0; }
bool textInput::showHelp() { // Show a help window on the middle of the screen. std::vector<std::string> helpText; helpText.push_back("Help"); helpText.push_back(" "); helpText.push_back("Enter a string using the keyboard."); helpText.push_back(" "); std::string keyDescr; if (helpWindow::generateHelpForKey(kmap_, keyMapping::K_DELETE, "", keyDescr, false)) { helpText.push_back(keyDescr); helpText.push_back(" delete last character"); } if (helpWindow::generateHelpForKey(kmap_, keyMapping::K_SELECT, "", keyDescr, false)) { helpText.push_back(keyDescr); helpText.push_back(" to finish entering text"); } if (helpWindow::generateHelpForKey(kmap_, keyMapping::K_QUIT, "", keyDescr, false)) { helpText.push_back(keyDescr); helpText.push_back(" to abort entering text"); } helpText.push_back(" "); helpWindow hw(kmap_, helpText); dialog::RESULT res = hw.run(); bool resized = false; if (res == dialog::R_RESIZE) { resized = true; } return resized; }
bool numberInputWindow::showHelp() { // Show a help window on the middle of the screen. std::vector<std::string> helpText; helpText.push_back("Help"); helpText.push_back(" "); helpText.push_back("Enter a number using the 0-9 and - keys."); helpText.push_back(" "); std::string keyDescr; if (helpWindow::generateHelpForKey(kmap_, keyMapping::K_DELETE, "", keyDescr, false)) { helpText.push_back(keyDescr); helpText.push_back(" delete last number"); } if (helpWindow::generateHelpForKey(kmap_, keyMapping::K_SELECT, "", keyDescr, false)) { helpText.push_back(keyDescr); helpText.push_back(" to enter the choosen number"); } if (helpWindow::generateHelpForKey(kmap_, keyMapping::K_BACK, "", keyDescr, false)) { helpText.push_back(keyDescr); helpText.push_back(" to abort entering a number"); } helpText.push_back(" "); helpWindow hw(kmap_, helpText); dialog::RESULT res = hw.run(); bool resized = false; if (res == dialog::R_RESIZE) { resized = true; } return resized; }
static int testHw(void){ const char *want = "hello,world"; hw(buff, BSIZE); if (strncmp(want, buff, BSIZE)){ printf("got \"%s\" want \"%s\"\n", buff, want); return -1; } return 0; }
void iterators() { printf("iterators test begin\n"); auto list = XorLinkedList<Shouter>({Shouter(0),Shouter(1),Shouter(2)}); for (auto i = list.begin(); i != list.end(); ++i) { //iterator is mutable i->setI(i->i + 2); } for (auto i = list.cbegin(); i != list.cend(); ++i) { //i->setI(i->i + 2); //error: iterator is const i->hw(); //good, const methods } for (auto i = list.rbegin(); i != list.rend(); ++i) { //reverse iterator is mutable i->setI(i->i + 2); } for (auto i = list.crbegin(); i != list.crend(); ++i) { //i->setI(i->i + 2); //error: iterator is const i->hw(); //good, const methods } printf("iterators test end\n"); }
int main(int argc, char **argv) { try { std::string url = argc > 1 ? argv[1] : "127.0.0.1:5672/examples"; hello_world hw(url); proton::container(hw).run(); return 0; } catch (const std::exception& e) { std::cerr << e.what() << std::endl; } return 1; }
int main(int argc, char **argv) { try { proton::url url(argc > 1 ? argv[1] : "127.0.0.1:5672/examples"); hello_world hw(url.path()); proton::io::socket_engine(url, hw).run(); return 0; } catch (const std::exception& e) { std::cerr << e.what() << std::endl; } return 1; }
int main(int argc,char **argv) { QApplication app(argc,argv); QWidget mainWindow; mainWindow.setMinimumSize(400, 400); mainWindow.setMaximumSize(400, 400); QPushButton hw("Hello World",&mainWindow); hw.setGeometry(20,20,160,60); //app.setMainWidget(&mainWindow); mainWindow.show(); return app.exec(); }
dialog::RESULT fileView::showHelp() { // Show a help window on the middle of the screen. std::vector<std::string> helpText; helpText.push_back("Help"); helpText.push_back(" "); std::string keyDescr; if (helpWindow::generateHelpForKey(kmap_, keyMapping::K_DOWN, "", keyDescr, false)) { helpText.push_back(keyDescr); helpText.push_back(" to move down"); } if (helpWindow::generateHelpForKey(kmap_, keyMapping::K_UP, "", keyDescr, false)) { helpText.push_back(keyDescr); helpText.push_back(" to move up"); } if (helpWindow::generateHelpForKey(kmap_, keyMapping::K_QUIT, "", keyDescr, false)) { helpText.push_back(keyDescr); helpText.push_back(" to quit this display"); } helpText.push_back(" "); helpWindow hw(kmap_, helpText); return hw.run(); }
int main ( ) { hwa( begin_from_reset ); /* After RESET, the core is clocked at 8 MHz by the HSI RC oscillator. * * * Start the high-speed external oscillator. * * Configure the PLL source and multiplier (must be done before it is * enabled). * * Prepare the connection of the sysclk to the pll. The hardware waits for * the clocks to be stable before switching. * * Alternately, we could check ourselves the clocks: * while ( !hw(stat,hse).ready ) {} : waits for the HSE to be stable. * while ( !hw(stat,pll).ready ) {} : waits for the PLL to be locked. */ hwa( power, hse, on ); hwa( connect, pll, hse ); hwa( write, pll, (SYSHZ / HW_DEVICE_HSEHZ) ); hwa( connect, sysclk, pll ); hwa( commit ); /* Now turn the PLL on and the hardware will use it as sysclk when the PLL is * locked. */ hwa( turn, pll, on ); hwa( commit ); /* Power the GPIO port */ hwa( power, (LED1,port), on ); /* Configure the GPIO pin */ hwa( configure, LED1, mode, digital_output, frequency, lowest ); hwa( commit ); for(;;) { hw( toggle, LED1 ); hw_waste_cycles( PERIOD/2 * SYSHZ ); } }
/* Service counter-overflow IRQ: turn the LED on and enable the compare IRQ * that turns it off */ HW_ISR( COUNTER, overflow, non_interruptible ) { /* No need to protect access to duty since interrupts are not allowed */ if ( duty ) { hw( write, PIN_LED, 1 ); if ( duty < COUNT_TOP ) { hw( write, (COUNTER,compare1), duty ); hw( turn, irq(COUNTER,compare1), on ); } else hw( turn, irq(COUNTER,compare1), off ); } else { hw( write, PIN_LED, 0 ); hw( turn, irq(COUNTER,compare1), off ); } }
int main ( ) { /* Create a HWA context to collect the hardware configuration * Preload this context with RESET values */ hwa_begin_from_reset(); /* Configure the software UART */ hwa( configure, UART ); /* Configure SPI (SPI master clocked by software over USI) */ hwa( configure, SPI ); /* Configure nRF CSN pin */ hwa( configure, NRF_CSN, direction, output ); hwa( write, NRF_CSN, 1 ); /* Write this configuration into the hardware */ hwa_commit(); hw_enable_interrupts(); /* Wait for UART synchronization */ while ( !hw(stat,UART).sync ) {} /* Process commands from host */ for(;;) { /* Prompt */ hw( write, UART, '$' ); /* Get command */ uint8_t c = hw( read, UART ); if ( c == '=' ) { /* Number of bytes to send to SPI slave */ uint8_t ntx = hw( read, UART ); if ( ntx < 1 || ntx > 33 ) goto error ; /* Number of bytes to send back to talker */ uint8_t nrx = hw( read, UART ); if ( nrx > 32 ) goto error ; /* Select SPI slave and send data */ hw( write, NRF_CSN, 0 ); while ( ntx-- ) { c = hw( read, UART ); hw( write, SPI, c ); } /* Send reply to talker and deselect SPI slave */ while ( nrx-- ) { hw( write, SPI, 0 ); c = hw( read, SPI ); hw( write, UART, c ); } hw( write, NRF_CSN, 1 ); } else { /* * First byte of command must be '='. Send '!' as error indicator and * wait for '\n' as error acknowledgement. */ do { error: hw( write, UART, '!' ); c = hw( read, UART ); } while ( c != '\n' ) ; } } }
dialog::RESULT fileSelect::showHelp() { // Show a help window on the middle of the screen. std::vector<std::string> helpText; helpText.push_back("Help"); helpText.push_back("----"); helpText.push_back(" "); std::string keyDescr; if (helpWindow::generateHelpForKey(kmap_, keyMapping::K_DOWN, "", keyDescr, false)) { helpText.push_back(keyDescr); helpText.push_back(" to move down"); } if (helpWindow::generateHelpForKey(kmap_, keyMapping::K_UP, "", keyDescr, false)) { helpText.push_back(keyDescr); helpText.push_back(" to move up"); } if (helpWindow::generateHelpForKey(kmap_, keyMapping::K_MARK, "", keyDescr, false)) { helpText.push_back(keyDescr); helpText.push_back(" to choose a file"); } if (helpWindow::generateHelpForKey(kmap_, keyMapping::K_MARK_ALL, "", keyDescr, false)) { helpText.push_back(keyDescr); helpText.push_back(" to choose all files"); } if (helpWindow::generateHelpForKey(kmap_, keyMapping::K_SELECT, "", keyDescr, false)) { helpText.push_back(keyDescr); helpText.push_back(" to set files to download"); } if (helpWindow::generateHelpForKey(kmap_, keyMapping::K_QUIT, "", keyDescr, false)) { helpText.push_back(keyDescr); helpText.push_back(" to quit this display"); } helpText.push_back(" "); helpWindow hw(kmap_, helpText); return hw.run(); }
/* Hardware timer1 ISR */ void IRAM ev_timer ( ) { hw( toggle, PIN_LED ); }
int main( int argc, char** argv ) { if(argc != 3) { printf("Usage: %s <robot_xml> <controller_xml>\n",argv[0]); exit(-1); } printf("robot file:: %s, controller file:: %s\n",argv[1],argv[2]); /*********** Create the robot model ****************/ mechanism::Robot *robot_model = new mechanism::Robot; controller::BaseControllerNode bc; HardwareInterface hw(0); robot_model->hw_ = &hw; /*********** Initialize ROS ****************/ ros::init(argc,argv); ros::node *node = new ros::node("test_base_controller"); /*********** Load the robot model and state file ************/ char *xml_robot_file = argv[1]; TiXmlDocument xml(xml_robot_file); // Load robot description xml.LoadFile(); TiXmlElement *root = xml.FirstChildElement("robot"); urdf::normalizeXml(root); robot_model->initXml(root); mechanism::RobotState *robot_state = new mechanism::RobotState(robot_model, &hw); /*********** Load the controller file ************/ char *xml_control_file = argv[2]; TiXmlDocument xml_control(xml_control_file); // Load robot description xml_control.LoadFile(); TiXmlElement *root_control = xml_control.FirstChildElement("controllers"); TiXmlElement *root_controller = root_control->FirstChildElement("controller"); bc.initXml(robot_state,root_controller); /************ Testing the odometry calculations themselves ******************/ /* NEWMAT::Matrix A(16,3); A.Row(1) << 10 << 8.95 << 0.05; A.Row(2) << 0 << -2 << 0; A.Row(3) << 1 << -0.1 << 0.01; A.Row(4) << 2 << 1.1 << 0; A.Row(5) << 3 << 2 << -0.05; A.Row(6) << 4 << 3 << 0.01; A.Row(7) << 5 << 4.1 << 0.05; A.Row(8) << -1 << -2 << 0.025; A.Row(9) << 6.15 << 5.05 << 0.01; A.Row(10) << 6.985 << 6.02 << 0.01; A.Row(11) << 8.01 << 8.05 << -0.05; A.Row(12) << 9.03 << 8.1 << -0.01; A.Row(13) << -8.03 << -9.1 << 0.01; A.Row(14) << -10.03 << -13.1 << 0.05; A.Row(15) << -15.03 << -16.1 << -0.015; A.Row(16) << -16.03 << -17.1 << -0.01; NEWMAT::Matrix B(16,1); B << 1.1 << 1 << 1.1 << 1.15 << 0.95 << 0.99 << 0.98 << 0.95 << 1.05 << 1.1 << 1.05 << 1 << 1.13 << 0.995 << 1.035 << 1.08; NEWMAT::Matrix xfit(3,1); xfit = bc.c_->iterativeLeastSquares(A,B,"Gaussian",10); cout << "done" << xfit << endl; */ ros::fini(); delete robot_model; delete robot_state; }
int main(int argc, char** argv) { QTextCodec::setCodecForLocale(QTextCodec::codecForName("latin1")); AppliArgs args(QStringList() << "~help,h" << "~version,v" << "output=1,o"); QTextStream out(stdout), err(stderr); unsigned long int length; struct jbg_dec_state sd; unsigned char *buffer; QString hw("%1 %2\n"); QByteArray data; bool argsErr; QFile input; // Parse arguments argsErr = !args.parse(argc, argv, 1); if (argsErr || args.isOptionSet("help")) { args.printErrors(err); out << QString(_("Usage: %1 [options] <JBIG file>")).arg(args. applicationName()) << endl; out << _("Available options:") << endl; out << _(" --help, -h Print this help message") << endl; out << _(" --output, -o Select the output file") << endl; out << _(" --version, -v Print the version information") << endl; return argsErr ? 1 : 0; } else if (args.isOptionSet("version")) { out << _("(C) jbgtopbm, 2007 by Aurélien Croc") << endl; out << _("This project is under the GNU General Public Licence " "version 2") << endl; out << _("More information => http://splix.ap2c.org") << endl << endl; return 0; } // Open the input and the output file input.setFileName(args.parameter(0)); if (!input.open(QIODevice::ReadOnly)) { err << _("Error: cannot open file ") << args.parameter(0) << endl; return -1; } data = input.readAll(); buffer = (unsigned char *)data.data(); length = data.length(); if (args.isOptionSet("output")) output.setFileName(args.optionArg("output", 0)); else output.setFileName("/dev/stdout"); if (!output.open(QIODevice::WriteOnly)) { err << _("Error: cannot open file ") << output.fileName() << endl; return -1; } // Decompress the image jbg_dec_init(&sd); while (length) { unsigned long size; int res; size = *(unsigned long*)buffer; printf("Taille=%lu\n", size); buffer += sizeof(size); length -= sizeof(size); res = jbg_dec_in(&sd, buffer, size, NULL); if (res == JBG_EOK) { out << _("Processed.") << endl; break; } else if (res != JBG_EAGAIN) { err << _("JBG not ok ") << res << endl; break; } length -= size; buffer += size; } // Store the image output.write("P4\n"); output.write("# Image created by jbgtopbm, (C) 2007 by Aurélien Croc " "(AP²C)\n"); hw = hw.arg(jbg_dec_getwidth(&sd)).arg(jbg_dec_getheight(&sd)); output.write(hw.toAscii()); output.write((const char *)jbg_dec_getimage(&sd, 0), jbg_dec_getsize(&sd)); output.close(); return 0; }
int main(int argc, char** argv){ hw("Yow there!"); return 0; }
int main ( ) { /* Create a HWA context to collect the hardware configuration * Preload this context with RESET values */ hwa( begin_from_reset ); /* Have the CPU enter idle mode when the 'sleep' instruction is executed. */ hwa( configure, core0, sleep, enabled, sleep_mode, idle ); /* Configure LED pin */ hwa( configure, PIN_LED, mode, digital_output ); /* Configure analog input pin in analog mode (disable digital input buffer) * and enable the internal pull-up resistor */ hwa( configure, PIN_ANALOG_INPUT, mode, analog_input_pullup ); /* Check that the counter can handle the top value. This must be done * here since the C preprocessor does not allow floats in expressions. */ if ( COUNT_TOP > ((1UL<<HW_BITS(COUNTER))-1) ) HWA_ERR("PWM_COUNTER can not afford PWM_PERIOD.") ; /* Configure the counter prescaler */ hwa( configure, (COUNTER,prescaler), clock, ioclk ); /* Configure the counter to overflow periodically and trigger an interrupt * The counter overflow ISR manages the compare IRQ */ hwa( configure, COUNTER, clock, ioclk / COUNTER_CLK_DIV, direction, up_loop, bottom, 0, top, TOP_OBJ, // overflow, after_top, ); hwa( write, (COUNTER, TOP_OBJ), COUNT_TOP ); hwa( turn, irq(COUNTER,overflow), on ); /* Configure the ADC to make a single conversion and trigger an * IRQ. The ISR will start a new conversion after its hard job is done. */ hwa( configure, adc0, clock, ioclk / ADC_CLK_DIV, trigger, manual, vref, vcc, align, right, input, PIN_ANALOG_INPUT ); hwa( turn, irq(adc0), on ); hwa( trigger, adc0 ); /* Write this configuration into the hardware */ hwa( commit ); hw( enable_interrupts ); for(;;) hw( sleep_until_irq ); return 0 ; }
HW_ISR( COUNTER, compare1 ) { hw( write, PIN_LED, 0 ); }
HW_ISR( COUNTER, compare1, naked ) { hw( write, PIN_LED, 0 ); hw_asm("reti"); }