Private
Public Access
2
0

hook: move gpio init post hook

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
This commit is contained in:
Thomas Ingleby
2014-07-18 13:19:29 +01:00
committed by Brendan Le Foll
parent 5766b03068
commit e602460688
2 changed files with 9 additions and 8 deletions

View File

@@ -14,7 +14,7 @@ Any functionality perfomed here is done just before the normal function returns.
##Hooks
### GPIO
* init (pre-post) - On RAW functions
* init (pre-post)
* mode (replace-pre-post)
* dir (replace-pre-post)
* write (pre-post)

View File

@@ -61,6 +61,14 @@ mraa_gpio_init(int pin)
mraa_gpio_context r = mraa_gpio_init_raw(pinm);
r->phy_pin = pin;
if (advance_func->gpio_init_post != NULL) {
mraa_result_t ret = advance_func->gpio_init_post(r);
if (ret != MRAA_SUCCESS) {
free(r);
return NULL;
}
}
return r;
}
@@ -106,13 +114,6 @@ mraa_gpio_init_raw(int pin)
close(export);
}
if (advance_func->gpio_init_post != NULL) {
mraa_result_t ret = advance_func->gpio_init_post(dev);
if (ret != MRAA_SUCCESS) {
free(dev);
return NULL;
}
}
return dev;
}