User manual
 

Typical LDD Components Usage

Init method

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 chapter 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(;;) {}
}

Deinit method

Deinit() method disables a peripheral and frees the allocated memory if supported by the RTOS adapter. Deinit() method is usually used in RTOS applications, not in bare-metal applications.

Interrupt Handling

Most of LDD components are designed to be used in the interrupt mode. It means that the interrupt service routine (ISR) is called by the interrupt controller when an asynchronous interrupt occurs. Interrupt service routine is defined in LDD driver and a user is notified through component’s events. Events can be enabled or disable in the component inspector according to an application needs. When an event is enabled, the appropriate function is generated into Event.c, where a user can write own event handler code. Events are called from the ISR context, so a user should keep an event code as short as possible to minimize a system latency.