Вы здесь

Ports and Pins Count

The DLN API is logically divided into modules. Each module contains a set of functions and declarations for the specific interface (for example, GPIO, I2C Master interface, I2C Slave interface, etc.).

You can check if the specific interface is supported by the connected adapter by calling the corresponding DlnXXXGetPortCount() function.

All these functions return the DLN_RESULT value. If the interface is supported, the corresponding function returns the DLN_RES_SUCCESS value. Otherwise the return code is equal to DLN_RES_NOT_IMPLEMENTED.

If these functions succeed, they fill in the count parameter with the number of available ports.

The example below prints the number of I2C master ports supported by the connected DLN-series adapter:

C/C++
DlnConnect("localhost",
DLN_DEFAULT_SERVER_PORT);
 HDLN device;
 DlnOpenDevice(0, &device);

 uint8_t count;
 DLN_RESULT result = DlnI2cMasterGetPortCount(device, &count);
 if (DLN_SUCCEEDED(result))
  printf("The adapter has %d I2C master ports.\n", count);
 else
  printf("The adapter does not support an I2C master interface\n");

The GPIO ports consist of 8 pins. If the number of available GPIO pins is not multiple of 8, the last port (with the highest index) can have less that 8 pins. Use the DlnGpioGetPinCount() function to obtain the number of GPIO pins for the current DLN-series adapter.

Rating: 
Голосов пока нет

Языки

Вход на сайт