Вы здесь

Function Return Value

In the previous chapter we saw how you can use the return value of the DlnXXXGetPortCount() function to check if the corresponding interface is implemented by the DLN-series adapter. The same approach can be applied for all functions from the DLN API.

For example, some of the adapters have internal pull-up resistors on GPIO pins, while others do not. Moreover, the pull-up resistors may be available only for a subset of GPIO pins. You can enable these pull-ups with the DlnGpioPinPullupEnable() function. This function, as well as all other DLN API functions, returns the DLN_RESULT value. If the return value is equal to DLN_RES_NOT_IMPLEMENTED, you can’t enable the internal pull-up resistor for current pin.

This approach of checking for the available functionality sometimes has an undesirable side effect. If the function succeeds, it performs an action (for example, DlnGpioPinPullupEnable() function enables the pull-up resistor if it can do so). If you need to check the supported functionality, but not to perform an action, use the DlnGetCommandRestriction() function. As you will see in the following section, this function may also provide some additional information about the requested functionality.

Rating: 
Средняя: 1 (1 оценка)

Языки

Вход на сайт