PROFINET Device  v1.04.03

◆ PN_API_DEV_plugModule()

uint32_t PN_API_DEV_plugModule ( uint16_t  slotNumber_p,
PN_API_DEV_SModuleDescriptor_t pModuleDescriptor_p 
)

Plug a module.

With this function the application can plug a module to a slot. By doing this, the module will be registered on stack and can be visible from outside.

Function takes a pointer to an instance of the module description structure and checks, that it is filled with valid parameters. If the parameters are correct and the desired slot is free, the function will copy the instance to the stack. Application can modify the module instance and the pointer to it after invoking the function.

Warning
It is required to invoke PN_API_DEV_applyEquipmentConfiguration() function to finalize new equipment configuration of the device: that means after pulling / plugging of modules / submodules.
Parameters
[in]slotNumber_pNumber of the slot.
[in]pModuleDescriptor_pModule to be plugged.
Returns
PN_API_DEV_EError_t as uint32_t value.
Return values
PN_API_DEV_eOKModule was plugged successfuly.
PN_API_DEV_eERROR_PLUG_MODULE_INVALID_SLOTInvalid slot number (> PNC_SLOT_MAX).
PN_API_DEV_eERROR_PLUG_MODULE_SLOT_ALREADY_PLUGGEDThe slot is already plugged.
PN_API_DEV_eERROR_PLUG_MODULE_INVALID_MODULE_TYPEInvalid type of the module.
Example
#include <PN_API_DEV.h>
//Create an instance of module description structure and fill it
//Plug Module
....
// Finish equipment configuration
PN_API_DEV_plugModule
uint32_t PN_API_DEV_plugModule(uint16_t slotNumber_p, PN_API_DEV_SModuleDescriptor_t *pModuleDescriptor_p)
Plug a module.
Definition: PN_API_main.c:1118
PN_API_DEV_applyEquipmentConfiguration
uint32_t PN_API_DEV_applyEquipmentConfiguration(void)
Apply equipment configuration.
Definition: PN_API_main.c:1062