Example #1
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 */
	#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();
	Serial_Init(9600, true);

	/* Create a stdio stream for the serial port for stdin and stdout */
	Serial_CreateStream(NULL);

	#if defined(USB_CAN_BE_DEVICE)
	/* Clear Dataflash sector protections, if enabled */
	DataflashManager_ResetDataflashProtections();
	#endif
}
/** 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);
#elif (ARCH == ARCH_XMEGA)
	/* Start the PLL to multiply the 2MHz RC oscillator to 32MHz and switch the CPU core to run from it */
	XMEGACLK_StartPLL(CLOCK_SRC_INT_RC2MHZ, 2000000, F_CPU);
	XMEGACLK_SetCPUClockSource(CLOCK_SRC_PLL);

	/* Start the 32MHz internal RC oscillator and start the DFLL to increase it to 48MHz using the USB SOF as a reference */
	XMEGACLK_StartInternalOscillator(CLOCK_SRC_INT_RC32MHZ);
	XMEGACLK_StartDFLL(CLOCK_SRC_INT_RC32MHZ, DFLL_REF_INT_USBSOF, F_USB);

	PMIC.CTRL = PMIC_LOLVLEN_bm | PMIC_MEDLVLEN_bm | PMIC_HILVLEN_bm;
#endif

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

	/* Create a stdio stream for the serial port for stdin and stdout */
	Serial_CreateStream(NULL);
}
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
	PINSEL_CFG_Type PinCfg;

	PinCfg.Funcnum = 0;
	PinCfg.OpenDrain = 0;
	PinCfg.Pinmode = 0;
	PinCfg.Portnum = 2;
	PinCfg.Pinnum = 10;
	PINSEL_ConfigPin(&PinCfg);
	PinCfg.Pinnum = 11;
	PINSEL_ConfigPin(&PinCfg);
	PinCfg.Pinnum = 12;
	PINSEL_ConfigPin(&PinCfg);

    /* is Input */
    GPIO_SetDir(2, (1<<10), 0);
    GPIO_SetDir(2, (1<<11), 0);
    GPIO_SetDir(2, (1<<12), 0);

	/* Enable system update tick timer */
	GPIO_SetDir(LED1_GPIO_PORT_NUM,(1<<LED1_GPIO_BIT_NUM),1); // output
	GPIO_SetDir(LED2_GPIO_PORT_NUM,(1<<LED2_GPIO_BIT_NUM),1); // output

	init_timer( 0, TIMER0_INTERVAL );

	Serial_Init(115200, false);
	LEDs_Init();
	USB_Init();

	/* Create a stdio stream for the serial port for stdin and stdout */
	Serial_CreateStream(NULL);

	//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();

  	DDRC |= _BV(PC3);  // Hold PWR On
  	PORTC &= ~_BV(PC3); // .
	
	DDRE |= 1<<7; //Set UVconn HIGH
	PORTE |= 1<<7;

  	/* Hold AUX PWR On */
//  	DDRC |= _BV(PC4);
//  	PORTC &= ~_BV(PC4);

  	/* Select USB Port BA */
  	DDRF |= _BV(PF4);
  	PORTF |= _BV(PF4);

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

	/* Create a stdio stream for the serial port for stdin and stdout */
	Serial_CreateStream(NULL);
//  	Camera_Enable();
}
Example #5
0
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void Camera_Enable(void)
{
	/* Hardware Initialization */
	Serial_Init(115200, true);

	USB_Init(USB_MODE_Host);

	/* Create a stdio stream for the serial port for stdin and stdout */
	Serial_CreateStream(NULL);
}
Example #6
0
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardwareKeyboard(void)
{
	//bsp_init();

	Serial_Init(9600, false);
	//LEDs_Init();
	USB_Disable();
	USB_CurrentMode = USB_MODE_Host;
	USB_Init();

	/* Create a stdio stream for the serial port for stdin and stdout */
	Serial_CreateStream(NULL);
}
Example #7
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 */

	USB_Init();
	Serial_CreateStream(NULL);
}
Example #8
0
/** Configures the board hardware and chip peripherals for the demo's functionality. */
static void SetupHardware(void)
{
	Board_Init();
	USB_Init(FlashDisk_MS_Interface.Config.PortNumber, USB_MODE_Host);
	/* Hardware Initialization */
	Board_Debug_Init();

	/* Create a stdio stream for the serial port for stdin and stdout */
	Serial_CreateStream(NULL);


	Chip_TIMER_Init(RUNTIME_TIMER);
	//Chip_TIMER_TIMER_SetCountClockSrc(RUNTIME_TIMER, TIMER_CAPSRC_RISING_PCLK, 0);
	Chip_TIMER_PrescaleSet(RUNTIME_TIMER, 0);
}
Example #9
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);
}
void PTP_Enable(void)
{
    configured = 0;
    /* Hardware Initialization */
    USB_Init();//USB_MODE_Host);

    /* Create a stdio stream for the serial port for stdin and stdout */
    #if defined(PTP_DEBUG) || defined(PTP_DEBUG_SELECTIVE)
    Serial_Init(115200, true);
    Serial_CreateStream(NULL);
    puts_P(PSTR("Camera Enabled.\r\n"));
    #endif
    PTP_Bytes_Remaining = 0;
    PTP_Ready = 0;
    PTP_Error = 0;
    PTP_Run_Task = 1;
}
Example #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 */
    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);
}
Example #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);

	/* 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);
}
// Get the Leonardo ready for USB communication
void setupHardware(void)
{
    // Disable the watch-dog timer if enabled by boot-loader or fuses
    MCUSR &= ~(1 << WDRF);
    wdt_disable();

    // Disable clock division
    clock_prescale_set(clock_div_1);

    // Initialise the hardware USART module
#ifdef USART_DEBUG
    Serial_Init(115200, true);
    Serial_CreateStream(NULL);
    printf("USART Debug enabled\r\n");
#endif

    // Initialise the EEPROM settings
    eepromInit();

    // Initialise the LUFA board driver and USB library
    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 */
	clock_prescale_set(clock_div_1);

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

	/* Create a stdio stream for the serial port for stdin and stdout */
	Serial_CreateStream(NULL);

	/* Start the ADC conversion in free running mode */
	ADC_StartReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | ADC_GET_CHANNEL_MASK(MIC_IN_ADC_CHANNEL));	
}