Example #1
0
//-----------------------------------------------------------------------------
// Init_Device
//-----------------------------------------------------------------------------
//
// Return Value : None
// Parameters   : None
//
// Calls all device initialization functions.
//
//-----------------------------------------------------------------------------
void Init_Device (void)
{
   Watchdog_Init ();                   // Disable the Watchdog Timer first
   Oscillator_Init ();
   Port_Init ();
   SPI0_Init ();
}
Example #2
0
void Basic_Init(void)
{
  Watchdog_Init();            //WatchdogInig
  Clock_Init();               //CLKInit
  TC0_Wait_msWhile(5);        //wait
  PORT_Init();                //PortInit
  CAN_Init();                 //CANInit
  TC0_Wait_msWhile(5);        //wait
  TC0_Stop();                 //StopTimer

  CAN_RXMOb_SetAddr(0x01);    //SetCANAdress
}
/**
 * Initializes Tekdaqc data structures and hardware peripherals.
 *
 * @param none
 * @retval none
 */
static void Tekdaqc_Init(void) {
	/* Initialize the Tekdaqc's communication methods */
	Communication_Init();

	/* Initialize the command state handler. This will initialize any */
	/* Input/Output state machines. */
	InitCommandStateHandler();

	/* Initialize the analog inputs */
	AnalogInputsInit();

	/* Initialize the digital inputs */
	DigitalInputsInit();

	/* Initialize the digital outputs */
	DigitalOutputsInit();

	/* Set the write functions */
	SetAnalogInputWriteFunction(&TelnetWriteString);
	SetDigitalInputWriteFunction(&TelnetWriteString);
	SetDigitalOutputWriteFunction(&TelnetWriteString);

	/* Initialize the FLASH disk */
	FlashDiskInit();

	/* Initialize the calibration table and fetch the board serial number */
	Tekdaqc_CalibrationInit();
	char data = '\0';
	uint32_t Address = BOARD_SERIAL_NUM_ADDR;
	for (int i = 0; i < BOARD_SERIAL_NUM_LENGTH; ++i) {
		if (Address >= CAL_TEMP_LOW_ADDR) {
			/* We have overflowed and there is a problem in the software */
#ifdef DEBUG
			printf("[Config] Reading board serial number overflowed.\n\r");
#endif
			break; /* Break out to prevent an invalid access */
		}
		data = *((__IO char*)Address);
		TEKDAQC_BOARD_SERIAL_NUM[i] = data;
		Address += sizeof(char);
	}
	TEKDAQC_BOARD_SERIAL_NUM[BOARD_SERIAL_NUM_LENGTH] = '\0'; /* Apply the NULL termination character */

#ifdef USE_WATCHDOG
	// Initialize the watchdog timer
	Watchdog_Init();
#endif
}
Example #4
0
int main(void)
{
//	uint32_t loop=0xFFFFFF;
//	while(loop)
//	{
//		loop--;
//	}

	SystemInit();
	Power_Detector_Init();
	Watchdog_Init();
	Encoder_Init();
	Proto_Init(PROTO_FIRST_INIT);
    vTaskStartScheduler();

    while(1);
}