Typical LDD components usage

The Init() method is defined in all Logical Device Drivers. The Init() method contains a complete initialization of the peripheral according to the component's settings. See Logical Device Drivers for details.

The following example shows how to use Init method in user code, main module in this case. Let's assume a component named "AS1" has been added to the project.

The user needs to add the call of the Init method into the user code, for example in main module.

void main(void)

 {

  LDD_TDeviceStructure MyDevice; 
  
	 /*** Processor Expert internal initialization. ***/
 
	 PE_low_level_init();
  
	/*** End of Processor Expert internal initialization. ***/
 
	 MyDevice = AS1_Init(NULL); /* Initialize driver and peripheral */
  
 		. . .
 
	AS1_Deinit(MyDevice); /* Deinitialize driver and peripheral */
  
	     for(;;) {}

 }