Created
April 15, 2013 22:45
-
-
Save mokele/5391922 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static ERL_NIF_TERM | |
gpio_read_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) | |
{ | |
int pin; | |
if (!enif_get_int(env, argv[0], &pin)) | |
{ | |
return enif_make_badarg(env); | |
} | |
int read = gpio_read(pin); | |
if(read == -1) { | |
return error_failed_tuple; | |
} else { | |
return enif_make_int(env, read); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment