예제 #1
0
bool AbstractImageGrabber::start()
{
    if (state() == AbstractGrabber::StoppedState) {
        waitForInitialization();

        startGrabbing();
        return true;
    }

    return false;
}
예제 #2
0
void initializations()

{
  Input initialInput = { 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0 };

	DisableInterrupts;


	/* Set the PLL speed (bus clock = 24 MHz) */
	CLKSEL = CLKSEL & 0x80; //; disengage PLL from system
	PLLCTL = PLLCTL | 0x40; //; turn on PLL
	SYNR = 0x02;            //; set PLL multiplier
	REFDV = 0;              //; set PLL divider
	while (!(CRGFLG & 0x08)){}
	CLKSEL = CLKSEL | 0x80; //; engage PLL

	/* Disable watchdog timer (COPCTL register) */
	COPCTL = 0x40; //COP off; RTI and COP stopped in BDM-mode

	/* Initialize asynchronous serial port (SCI) for 9600 baud, interrupts off initially */
	SCIBDH = 0x00; //set baud rate to 9600
	SCIBDL = 0x9C; //24,000,000 / 16 / 156 = 9600 (approx)  
	SCICR1 = 0x00; //$9C = 156
	SCICR2 = 0x0C; //initialize SCI for program-driven operation
	DDRB = 0x10; //set PB4 for output mode
	PORTB = 0x10; //assert DTR pin on COM port

	/* Initialize peripherals */

	DDRT = 0xFF;
	ATDDIEN = 0xC0;
	DDRAD = 0;
	DDRM = 0xFF;

	/* Initialize SPI for 6Mbps*/
	SPICR1 = 0x50;
	SPICR2 = 0;
	SPIBR = 0x10;

	/* Initialize interrupts */

	CRGINT = CRGINT | 0x80;
	TCTL2 = 0x40; //Toggle pin when timer goes off
	TCTL1 = 0x40;
	TSCR1 = 0x80; //Enable timer subsystem.
	TSCR2 = 0x08; //Dont prescale

	TIOS = 0x80;   //Set Ch 7 for output compare.
	TC7 = 11; //1ms interrupt rate
	TIE = 0;

	SPICR1 = 0x50;
	SPICR2 = 0x00;
	SPIBR = 0x10;
	DDRT = 0x62;
	//pin 4 will be used to read 
	PTT_PTT5 = 1; //Enable transmission gate

	//Enable IRQ
	INTCR_IRQE = 0;
	TRANSMISSION_GATE = 1;
	PTT_PTT1 = 1;
	waitForInitialization();
	PTT_PTT1 = 0;

	setOutputFrame(initialInput);

	// Set the cop timer
	COPCTL = 0x41;

	//RTI Interrupt rate
	//RTICTL = 0x15; //The panic rate 600 us ish

	//Enable Interrupts
	EnableInterrupts;

}