Ejemplo n.º 1
0
void commonInit(void)
{
	platformInit();
	timerInit();
	GPIOInit();
	USB_UserInit();

  	debug_frmwrk_init_clk(CLKFREQ);
	lpc_printf("M4 start\n");
}
Ejemplo n.º 2
0
void pixyInit(uint32_t slaveRomStart, const unsigned char slaveImage[], uint32_t imageSize)
{
	platformInit();

	// button, SPI_SSEL
	LPC_GPIO_PORT->MASK[5] = 0;
	LPC_GPIO_PORT->PIN[5] = 0x20; // negate SPI_SS
	LPC_GPIO_PORT->DIR[5] = 0x20; // SPI_SS - output

	// deal with P4_1, GPIO2[1]
	LPC_GPIO_PORT->MASK[2] = 0;
	LPC_GPIO_PORT->DIR[2] = 0;

	// set timer so we count clock cycles
	LPC_TIMER1->IR = 0;
 	LPC_TIMER1->TCR = 1;
	LPC_TIMER1->PR = 0;

	// microsecond timer
	LPC_TIMER2->IR = 0;
 	LPC_TIMER2->TCR = 1;
	LPC_TIMER2->PR = CLKFREQ_US-1;

  	debug_frmwrk_init_clk(CLKFREQ);

	USB_UserInit();

	lpc_printf("M4 start\n");

	IPC_haltSlave();

	ADCInit();
   	SCTInit();
	CameraInit();

	// start slave
	IPC_downloadSlaveImage(slaveRomStart, slaveImage, imageSize);
	IPC_startSlave();

	// initialize chirp objects
	g_chirpUsb = new ChirpUsb();
  	g_chirpM0 = new ChirpM0();

	// initialize devices/modules
	pwr_init();
	spi_init();
	cam_init();
	rcs_init();
	led_init();
	//cc_init();
}