mirror of
https://github.com/eclipse/upm.git
synced 2025-07-05 19:31:15 +03:00
C examples: move mraa_init() calls out of C examples and into C drivers.
Signed-off-by: Jon Trulson <jtrulson@ics.com>
This commit is contained in:
@ -25,6 +25,14 @@
|
||||
#include "gp2y0a.h"
|
||||
|
||||
gp2y0a_context gp2y0a_init(uint8_t pin, float a_ref){
|
||||
// make sure MRAA is initialized
|
||||
int mraa_rv;
|
||||
if ((mraa_rv = mraa_init()) != MRAA_SUCCESS)
|
||||
{
|
||||
printf("%s: mraa_init() failed (%d).\n", __FUNCTION__, mraa_rv);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gp2y0a_context dev = (gp2y0a_context) malloc(sizeof(struct _gp2y0a_context));
|
||||
|
||||
dev->pin = pin;
|
||||
|
Reference in New Issue
Block a user