gpio: Silence own use of deprecated mraa_gpio_use_mmaped
The warning is aiming at external use, not our own one. Silence the latter by adding an internal service that the deprecated function calls and use that service in the remaining mraa use cases. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
@@ -288,6 +288,9 @@ mraa_result_t mraa_gpio_owner(mraa_gpio_context dev, mraa_boolean_t owner);
|
|||||||
*/
|
*/
|
||||||
DEPRECATED mraa_result_t mraa_gpio_use_mmaped(mraa_gpio_context dev, mraa_boolean_t mmap);
|
DEPRECATED mraa_result_t mraa_gpio_use_mmaped(mraa_gpio_context dev, mraa_boolean_t mmap);
|
||||||
|
|
||||||
|
/* remaining internal use only */
|
||||||
|
mraa_result_t mraa_gpio_use_mmaped_internal(mraa_gpio_context dev, mraa_boolean_t mmap);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a pin number of the gpio, invalid will return -1
|
* Get a pin number of the gpio, invalid will return -1
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -327,7 +327,7 @@ class Gpio
|
|||||||
Result
|
Result
|
||||||
useMmap(bool enable)
|
useMmap(bool enable)
|
||||||
{
|
{
|
||||||
return (Result) mraa_gpio_use_mmaped(m_gpio, (mraa_boolean_t) enable);
|
return (Result) mraa_gpio_use_mmaped_internal(m_gpio, (mraa_boolean_t) enable);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get pin number of Gpio. If raw param is True will return the
|
* Get pin number of Gpio. If raw param is True will return the
|
||||||
|
|||||||
@@ -1740,7 +1740,7 @@ mraa_gpio_owner(mraa_gpio_context dev, mraa_boolean_t own)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mraa_result_t
|
mraa_result_t
|
||||||
mraa_gpio_use_mmaped(mraa_gpio_context dev, mraa_boolean_t mmap_en)
|
mraa_gpio_use_mmaped_internal(mraa_gpio_context dev, mraa_boolean_t mmap_en)
|
||||||
{
|
{
|
||||||
if (dev == NULL) {
|
if (dev == NULL) {
|
||||||
syslog(LOG_ERR, "gpio: use_mmaped: context is invalid");
|
syslog(LOG_ERR, "gpio: use_mmaped: context is invalid");
|
||||||
@@ -1756,6 +1756,12 @@ mraa_gpio_use_mmaped(mraa_gpio_context dev, mraa_boolean_t mmap_en)
|
|||||||
return MRAA_ERROR_FEATURE_NOT_IMPLEMENTED;
|
return MRAA_ERROR_FEATURE_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mraa_result_t
|
||||||
|
mraa_gpio_use_mmaped(mraa_gpio_context dev, mraa_boolean_t mmap_en)
|
||||||
|
{
|
||||||
|
return mraa_gpio_use_mmaped_internal(dev, mmap_en);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
mraa_gpio_get_pin(mraa_gpio_context dev)
|
mraa_gpio_get_pin(mraa_gpio_context dev)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ gpio_set(int pin, int level, mraa_boolean_t raw)
|
|||||||
if (gpio != NULL) {
|
if (gpio != NULL) {
|
||||||
mraa_gpio_dir(gpio, MRAA_GPIO_OUT);
|
mraa_gpio_dir(gpio, MRAA_GPIO_OUT);
|
||||||
if (raw != 0) {
|
if (raw != 0) {
|
||||||
if (mraa_gpio_use_mmaped(gpio, 1) != MRAA_SUCCESS) {
|
if (mraa_gpio_use_mmaped_internal(gpio, 1) != MRAA_SUCCESS) {
|
||||||
fprintf(stdout,
|
fprintf(stdout,
|
||||||
"mmapped access to gpio %d not supported, falling back to normal mode\n", pin);
|
"mmapped access to gpio %d not supported, falling back to normal mode\n", pin);
|
||||||
}
|
}
|
||||||
@@ -114,7 +114,7 @@ gpio_get(int pin, int* level, mraa_boolean_t raw)
|
|||||||
if (gpio != NULL) {
|
if (gpio != NULL) {
|
||||||
mraa_gpio_dir(gpio, MRAA_GPIO_IN);
|
mraa_gpio_dir(gpio, MRAA_GPIO_IN);
|
||||||
if (raw != 0) {
|
if (raw != 0) {
|
||||||
if (mraa_gpio_use_mmaped(gpio, 1) != MRAA_SUCCESS) {
|
if (mraa_gpio_use_mmaped_internal(gpio, 1) != MRAA_SUCCESS) {
|
||||||
fprintf(stdout,
|
fprintf(stdout,
|
||||||
"mmapped access to gpio %d not supported, falling back to normal mode\n", pin);
|
"mmapped access to gpio %d not supported, falling back to normal mode\n", pin);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user