mraa: add deinit function for valgrind testing
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
@@ -186,6 +186,14 @@ mraa_result_t mraa_init() __attribute__((constructor));
|
|||||||
mraa_result_t mraa_init();
|
mraa_result_t mraa_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* De-Initilise MRAA
|
||||||
|
*
|
||||||
|
* This is not a strict requirement but useful to test memory leaks and for
|
||||||
|
* people who like super clean code.
|
||||||
|
*/
|
||||||
|
void mraa_deinit();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a pin is able to use the passed in mode.
|
* Checks if a pin is able to use the passed in mode.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ int
|
|||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
fprintf(stdout, "hello mraa\n Version: %s\n", mraa_get_version());
|
fprintf(stdout, "hello mraa\n Version: %s\n", mraa_get_version());
|
||||||
|
mraa_deinit();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//! [Interesting]
|
//! [Interesting]
|
||||||
|
|||||||
@@ -98,6 +98,13 @@ mraa_init()
|
|||||||
return MRAA_SUCCESS;
|
return MRAA_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mraa_deinit()
|
||||||
|
{
|
||||||
|
free(plat->pins);
|
||||||
|
free(plat);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
mraa_set_priority(const unsigned int priority)
|
mraa_set_priority(const unsigned int priority)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user