Esempio n. 1
0
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware()
{
	/* Disable watchdog if enabled by bootloader/fuses */
	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	/* Disable clock division */
	clock_prescale_set(clock_div_1);

	/* Hardware Initialization */
	LEDs_Init();
	Buttons_Init();
	USB_Init();
}
Esempio n. 2
0
void SetupHardware(void)
{
	/* Disable watchdog if enabled by bootloader/fuses */
	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	/* Disable clock division */
	clock_prescale_set(clock_div_1);

	/* Hardware Initialization */
	SerialStream_Init(9600, false);
	LEDs_Init();
	USB_Init();
}
Esempio n. 3
0
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
	char stopMostSentencesString[] = "$PMTK314,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29\r\n";
	char kickLoggerString[] = "$PMTK185,0*22\r\n";
	char nmea10sec[] = "$PMTK220,10000*2F\r\n";
	
	/* Disable watchdog if enabled by bootloader/fuses */
	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	/* Disable clock division */
	clock_prescale_set(clock_div_1);

	/* Hardware Initialization */
	LEDs_Init();

	LEDs_SetAllLEDs(1);

	_delay_ms(100);

	// Hard set the baud rate to 9600 since that's the rate that the USART runs at
	setBaudRate9600();

	_delay_ms(100);

	// Set NMEA sentence output frequencies
	// PMTK_API_SET_NMEA_OUTPUT
	// $PMTK314,... is the command
	
	outStringToGPS(stopMostSentencesString);
	_delay_ms(100);

	// Set the NMEA port update rate to 10 seconds

	outStringToGPS(nmea10sec);
	_delay_ms(100);

	// Kick the GPS LOCUS to start logging data
	// PMTK_LOCUS_STARTLOG
	// $PMTK185,0*22 is the command
	
	outStringToGPS(kickLoggerString);
	_delay_ms(100);

	USB_Init();

	/* Start the flush timer so that overflows occur rapidly to push received bytes to the USB interface */
	TCCR0B = (1 << CS02);
}
Esempio n. 4
0
void SetupHardware(void) {
  connected = false;

  // Disable watchdog if enabled by bootloader/fuses
  MCUSR &= ~(1 << WDRF);
  wdt_disable();

  // Disable clock division
  clock_prescale_set(clock_div_1);

  // Hardware Initialization
  LEDs_Init();
  USB_Init();
  InitDMXOut();
}
Esempio n. 5
0
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
	/* Disable watchdog if enabled by bootloader/fuses */
	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	/* Disable clock division */
	clock_prescale_set(clock_div_1);

	/* Hardware Initialization */
	Joystick_Init();
	LEDs_Init();
	USB_Init();
	SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_ORDER_MSB_FIRST | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);
}
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
#if (ARCH == ARCH_AVR8)
	/* Disable watchdog if enabled by bootloader/fuses */
	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	/* Disable clock division */
	clock_prescale_set(clock_div_1);
#endif

	/* Hardware Initialization */
	LEDs_Init();
	USB_Init();
}
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
	/* Disable watchdog if enabled by bootloader/fuses */
	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	/* Disable Clock Division */
	CLKPR = (1 << CLKPCE);
	CLKPR = 0;

	/* Hardware Initialization */
	SerialStream_Init(9600, false);
	LEDs_Init();
	USB_Init();
}
Esempio n. 8
0
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
	/* Disable watchdog if enabled by bootloader/fuses */
	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	/* Disable clock division */
	clock_prescale_set(clock_div_1);

	/* Hardware Initialization */
	LEDs_Init();
	USB_Init();

	/* Start the flush timer so that overflows occur rapidly to push received bytes to the USB interface */
	TCCR0B = (1 << CS02);
}
Esempio n. 9
0
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
	char kickLoggerString[] = "$PMTK185,0*22\r\n";
	int16_t outBuffPtr = 0;
	
	/* Disable watchdog if enabled by bootloader/fuses */
	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	/* Disable clock division */
	clock_prescale_set(clock_div_1);

	/* Hardware Initialization */
	LEDs_Init();

	DDRF &= 0xf7;   // PF0 is 3DFIX input
	DDRF &= 0xdf;   // PF5 is 1PPS input
  DDRD &= 0xdf;   // PD5 is BRCR input
  
	LEDs_SetAllLEDs(1);

	_delay_ms(500);

	// Hard set the baud rate to 9600 since that's the rate that the USART runs at
	setBaudRate9600();

	_delay_ms(100);

	// Kick the GPS LOCUS to start logging data
	// PMTK_LOCUS_STARTLOG
	// $PMTK185,0*22 is the command
	
	while (kickLoggerString[outBuffPtr] != 0)
	{
		while (!( UCSR1A & (1<<UDRE1)) );		// hang around until transmitter is empty
		UDR1 = kickLoggerString[outBuffPtr];
		outBuffPtr++;
	}
	while ((UCSR1A & TXC1) == 0);		// hang around until the entire packet is transmitted out

	_delay_ms(500);

	USB_Init();

	/* Start the flush timer so that overflows occur rapidly to push received bytes to the USB interface */
	TCCR0B = (1 << CS02);
}
Esempio n. 10
0
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
	/* Disable watchdog if enabled by bootloader/fuses */
	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	/* Disable clock division */
	clock_prescale_set(clock_div_1);

	/* Hardware Initialization */
	//Serial_Init(9600, false);
	// the rest of serial_init is done by ReconfigureUSART
	DDRD  |= (1 << 3);
    PORTD |= (1 << 2);
	LEDs_Init();
	USB_Init();
}
Esempio n. 11
0
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
	/* Disable watchdog if enabled by bootloader/fuses */
	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	/* Disable clock division */
	clock_prescale_set(clock_div_1);

	DDRC  = 0x00;
	PORTC = 0x00;
	OUTPUT(USBLED)
	SET(USBLED);
	/* Hardware Initialization */
	LEDs_Init();
	// USB_Init();
}
Esempio n. 12
0
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
    /* Disable watchdog if enabled by bootloader/fuses */
    MCUSR &= ~(1 << WDRF);
    wdt_disable();

    /* Disable clock division */
    clock_prescale_set(clock_div_1);

    RFM12B_SPI_Init();

    /* Commands are not accepted while the RF12 is in reset so
       keep reading the status until the POR bit is clear    */
    
    uint16_t status = RFM12B_SPI_Transfer( 0 );
    while ( status & 0x4000 )
        status = RFM12B_SPI_Transfer( 0 );
    
    /* For commands see also http://tools.jeelabs.org/rfm12b */
    
    RFM12B_SPI_Transfer(0x80E7);  /* 868MHz, 12pF, el=1, ef=1 */ 
    RFM12B_SPI_Transfer(0xA640);  /* centre Frequency = 868MHz */ 
    RFM12B_SPI_Transfer(0xC606);  /* Data Rate approx 49.2 Kbps, (10000/29/(1+6)) Kbps */
    RFM12B_SPI_Transfer(0x94A2);  /* VDI,FAST,134kHz,0dBm,-91dBm */ 
    RFM12B_SPI_Transfer(0xC2AC);  /* AL,!ml,DIG,DQD4 */ 
    RFM12B_SPI_Transfer(0xCA83);  /* FIFO8,2-SYNC,!ff,DR */ 
    RFM12B_SPI_Transfer(0xCE55);  /* Group? = 0x55 */
    RFM12B_SPI_Transfer(0xC483);  /* @PWR,NO RSTRIC,!st,!fi,OE,EN */ 
    RFM12B_SPI_Transfer(0x9850);  /* !mp,90kHz,MAX OUT */ 
    RFM12B_SPI_Transfer(0xCC77);  /* OB1,OB0, LPX,!ddy,DDIT,BW0  */ 
    RFM12B_SPI_Transfer(0xE000);  /* NOT USE */ 
    RFM12B_SPI_Transfer(0xC800);  /* NOT USE */ 
    RFM12B_SPI_Transfer(0xC049);  /* 1.66MHz, 3.1V */ 

    RxLength = 0;
    RFM12B_SPI_Transfer(0x82DD);  /* Turn Receiver On */
    RFM12B_Transmit_Active = false;


    /* Hardware Initialization */
    LEDs_Init();
    USB_Init();

    /* Start the flush timer so that overflows occur rapidly to push received bytes to the USB interface */
    TCCR0B = (1 << CS02);
}
Esempio n. 13
0
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
    /* Disable watchdog if enabled by bootloader/fuses */
    MCUSR &= ~(1 << WDRF);
    wdt_disable();

    /* Disable clock division */
    clock_prescale_set(clock_div_1);

    /* Hardware Initialization */
    LEDs_Init();
    USB_Init();
    Serial_Init(9600, false);

    /* Create a stdio stream for the serial port for stdin and stdout */
    Serial_CreateStream(NULL);
}
Esempio n. 14
0
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
    /* Disable watchdog if enabled by bootloader/fuses */
    MCUSR &= ~(1 << WDRF);
    wdt_disable();

    /* Disable Clock Division */
    CLKPR = (1 << CLKPCE);
    CLKPR = 0;

    /* Hardware Initialization */
    Serial_Init(9600, false);
    LEDs_Init();
    USB_Init();

    /* Create a stdio stream for the serial port for stdin and stdout */
    Serial_CreateStream(NULL);
}
void SetupHardware(void)
{
	/* Disable watchdog if enabled by bootloader/fuses */
	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	/* Disable clock division */
	clock_prescale_set(clock_div_1);

	/* Setup timer */
	TCCR1B = 0x03;  /* timer rate clk/64 */
	TIMSK1 = 0x01;

	/* Hardware Initialization */
	LEDs_Init();
	USB_Init();
	sei(); 
}
Esempio n. 16
0
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
    /* Disable watchdog if enabled by bootloader/fuses */
    MCUSR &= ~(1 << WDRF);
    wdt_disable();

    /* Disable clock division */
    clock_prescale_set(clock_div_1);

    Serial_Init(115200, true);
    /* Hardware Initialization */
    LEDs_Init();
    USB_Init();

    UCSR1B = ((1 << RXCIE1) | (1 << TXEN1) | (1 << RXEN1));

    LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
Esempio n. 17
0
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
	/* Disable watchdog if enabled by bootloader/fuses */
	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	/* Disable clock division */
	clock_prescale_set(clock_div_1);
	
	/* Hardware Initialization */
	LEDs_Init();
	ADC_Init(ADC_FREE_RUNNING | ADC_PRESCALE_32);
	ADC_SetupChannel(MIC_IN_ADC_CHANNEL);
	USB_Init();
	
	/* Start the ADC conversion in free running mode */
	ADC_StartReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | MIC_IN_ADC_MUX_MASK);
}
Esempio n. 18
0
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
	/* Disable watchdog if enabled by bootloader/fuses */
	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	/* Disable clock division */
	clock_prescale_set(clock_div_1);

	/* Hardware Initialization */
	LEDs_Init();
	SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_ORDER_MSB_FIRST | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);
	Dataflash_Init();
	USB_Init();

	/* Clear Dataflash sector protections, if enabled */
	DataflashManager_ResetDataflashProtections();
}
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
	/* Disable watchdog if enabled by bootloader/fuses */
	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	/* Disable clock division */
	clock_prescale_set(clock_div_1);

	/* Hardware Initialization */
	LEDs_Init();
	#if defined(RESET_TOGGLES_LIBUSB_COMPAT)
	UpdateCurrentCompatibilityMode();
	#endif

	/* USB Stack Initialization */
	USB_Init();
}
Esempio n. 20
0
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void setupHardware(void)
{
	/* Disable watchdog if enabled by bootloader/fuses */
	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	/* Disable clock division */
	clock_prescale_set(clock_div_1);
	UART_Init(115200);

	LEDs_Init();
    blink_Leds(10,80);

    // UART_Print("AsTeRICS HID actuator ready!\r\n");
    blink_Leds(20,40);

	USB_Init();
}
Esempio n. 21
0
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
	/* Disable watchdog if enabled by bootloader/fuses */
	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	/* Hardware Initialization */
	Serial_Init(9600, false);
	LEDs_Init();
	USB_Init();

	/* Start the flush timer so that overflows occur rapidly to push received bytes to the USB interface */
	TCCR0B = (1 << CS02);

	/* Pull target /RESET line high */
	AVR_RESET_LINE_PORT |= AVR_RESET_LINE_MASK;
	AVR_RESET_LINE_DDR  |= AVR_RESET_LINE_MASK;
}
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
	/* Disable watchdog if enabled by bootloader/fuses */
	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	/* Hardware Initialization */
	LEDs_Init();
	USB_Init();

	/* Millisecond Timer Interrupt */
	OCR0A  = (F_CPU / 64 / 1000);
	TCCR0A = (1 << WGM01);
	TCCR0B = ((1 << CS01) | (1 << CS00));

	/* Tristate target /RESET Line */
	AVR_RESET_LINE_PORT &= ~AVR_RESET_LINE_MASK;
	AVR_RESET_LINE_DDR  &= ~AVR_RESET_LINE_MASK;
}
Esempio n. 23
0
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
	/* Disable watchdog if enabled by bootloader/fuses */
	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	/* Disable clock division */
	clock_prescale_set(clock_div_1);

	/* Hardware Initialization */
	LEDs_Init();
	USB_Init();

	/* Timer Initialization */
	OCR0A  = 100;
	TCCR0A = (1 << WGM01);
	TCCR0B = (1 << CS00);
	TIMSK0 = (1 << OCIE0A);
}
Esempio n. 24
0
/*!
 * @brief Initialisation thread. runs once.
 */
void InitThread(void *data)
{
	for (;;)
	{
		OS_SemaphoreWait(InitSemaphore, 0);

		Random_Init();
		//Switches mate
		Switch_Init(S1Callback, (void *) 0, S2Callback, (void *) 0);

		Toggle_Init(ToggleModeFinished);
		Game_Init(GameModeFinished);

		Touch_Init();

//Initialize all the modules
		LEDs_Init();

		I2C_Init(100000, MODULE_CLOCK);
		Accel_Init(&AccelSetup);

		PIT_Init(MODULE_CLOCK, &PitCallback, (void *) 0);
		PIT_Set(500000000, bFALSE);
		PIT_Enable(bTRUE);

		Packet_Init(BAUD_RATE, MODULE_CLOCK);
		Flash_Init();
		CMD_Init();

		//Best to do this one last
		//TODO: disabled for yellow
    RTC_Init((void (*)(void*))OS_SemaphoreSignal, (void *) RtcSemaphore);

		Timer_Init();
		Timer_Set(&PacketTimer);
		Timer_Set(&AccTimer);

		CMD_SpecialGetStartupValues();

		LEDs_On(LED_ORANGE);
	}
}
Esempio n. 25
0
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
	/* Disable watchdog if enabled by bootloader/fuses */
	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	setResetPin(false);

	/* Target /ERASE line is active HIGH: there is a mosfet that inverts logic */
	AVR_ERASE_LINE_PORT |= AVR_ERASE_LINE_MASK;
	AVR_ERASE_LINE_DDR  |= AVR_ERASE_LINE_MASK;	

	/* Hardware Initialization */
	Serial_Init(9600, false);
	LEDs_Init();
	USB_Init();

	/* Start the flush timer so that overflows occur rapidly to push received bytes to the USB interface */
	TCCR0B = (1 << CS02);
}
Esempio n. 26
0
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
	/* Disable watchdog if enabled by bootloader/fuses */
	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	/* Disable clock division */
	clock_prescale_set(clock_div_1);

	/* Hardware Initialization */
	Serial_Init(9600, false);
	LEDs_Init();
	Buttons_Init();
	ADC_Init(ADC_FREE_RUNNING | ADC_PRESCALE_32);
	ADC_SetupChannel(MIC_IN_ADC_CHANNEL);
	USB_Init();

	/* Create a stdio stream for the serial port for stdin and stdout */
	Serial_CreateStream(NULL);
}
Esempio n. 27
0
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
	/* Disable watchdog if enabled by bootloader/fuses */
	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	/* Disable clock division */
	clock_prescale_set(clock_div_1);

	/* Hardware Initialization */
	LEDs_Init();
	USB_Init();

    // enable pull-up on the RX pin to prevent spurious signal.
    bitClear(DDRD,2);
    bitSet( PORTD,2);

	/* Start the flush timer so that overflows occur rapidly to push received bytes to the USB interface */
	TCCR0B = (1 << CS02);
}
Esempio n. 28
0
/** Configures the board hardware and chip peripherals for the demo's functionality. */
static void SetupHardware(void)
{
	/* Disable watchdog if enabled by bootloader/fuses */
	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	/* Disable clock division */
	clock_prescale_set(clock_div_1);

	/* Relocate the interrupt vector table to the bootloader section */
	MCUCR = (1 << IVCE);
	MCUCR = (1 << IVSEL);

	/* Hardware Initialization */
	LEDs_Init();
	USB_Init();

	/* Bootloader active LED toggle timer initialization */
	TIMSK1 = (1 << TOIE1);
	TCCR1B = ((1 << CS11) | (1 << CS10));
}
Esempio n. 29
0
// Initialize the board (timer, indicator LEDs, UART)
void
board_init(void)
{
#ifdef DEBUG
    /*
     * Initialize the UART baud rate at 115200 8N1 and select it for
     * printf() output.
     */
    UCSR1A |= _BV(U2X1);
    UCSR1B |= _BV(TXEN1);
    UBRR1 = 8;
    stdout = &mystdout;
#endif

    LEDs_Init();

    // Setup 16 bit timer as normal counter with prescaler F_CPU/1024.
    // We use this to create a repeating 100 ms (10 hz) clock.
    OCR1A = (F_CPU / 1024) / 10;
    TCCR1B |= (1 << WGM12) | (1 << CS02) | (1 << CS00);
}
Esempio n. 30
0
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
  MCUSR = 0;

	/* Disable watchdog if enabled by bootloader/fuses */
	wdt_disable();

	/* Disable clock division */
	clock_prescale_set(clock_div_1);

  serial_init();

  GlobalInterruptEnable();

	/* Hardware Initialization */
	LEDs_Init();

  while(!started);

  USB_Init();
}