Esempio n. 1
0
/** Main program entry point. This routine configures the hardware required by the application, then
 *  starts the scheduler to run the application tasks.
 */
int main(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();
	
	/* Indicate USB not ready */
	UpdateStatus(Status_USBNotReady);
	
	/* Initialize Scheduler so that it can be used */
	Scheduler_Init();

	/* Initialize USB Subsystem */
	USB_Init();

	/* Start-up message */
	puts_P(PSTR(ESC_RESET ESC_BG_WHITE ESC_INVERSE_ON ESC_ERASE_DISPLAY
	       "Mouse Host Demo running.\r\n" ESC_INVERSE_OFF));
		   
	/* Scheduling - routine never returns, so put this last in the main function */
	Scheduler_Start();
}
/** 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 */
	#if defined(USB_CAN_BE_BOTH)
	USB_Init(USB_MODE_UID);
	#else
	USB_Init();
	#endif

	LEDs_Init();
	SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);
	Dataflash_Init();
	Buttons_Init();
	SerialStream_Init(9600, true);

	#if defined(USB_CAN_BE_DEVICE)
	/* Clear Dataflash sector protections, if enabled */
	DataflashManager_ResetDataflashProtections();
	#endif
}
Esempio n. 3
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 */
	SerialStream_Init(9600, false);
	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. 5
0
/** Configures the board hardware and chip peripherals for the demo's functionality. */
inline 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);

	/* Hardware Initialization */
	LEDs_Init();
	Buttons_Init();	//button HWB
	Joystick_Init();

	//gate driving output - PORTC.6 / PWM-A Timer3
	DDRC |= (1<<PC6);
	PORTC &= ~(1<<PC6);
	Init_PWM_timer();
	
	/* conversion mode (free running or single) and prescaler masks 
	 * ACDSRA: start ADC, clock prescaler, interrupt, trigger enable, start single conv */
	ADC_Init( ADC_SINGLE_CONVERSION | ADC_PRESCALE_128);	
	/* Must setup the ADC channel to read beforehand */
	ADC_SetupChannel(3);
	ADC_SetupChannel(4);
	
	/* Start the ADC conversion in free running mode 
	 * ADMUX and Vref, adjust, sel mux channel with gain
	 * 
	*/
	//ADC_StartReading(ADC_REFERENCE_INT2560MV | ADC_RIGHT_ADJUSTED | ADC_1100MV_BANDGAP);
	
	//Temperature_Init();
	//Dataflash_Init();
	SerialStream_Init(9600, false);

}