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:
Jon Trulson
2016-09-28 17:33:57 -06:00
parent c3a5b8dd3c
commit e7c80217c2
68 changed files with 274 additions and 256 deletions

View File

@ -8,16 +8,9 @@
#include "a110x.h"
#include "upm_utilities.h"
#include "mraa.h"
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
a110x_context dev = a110x_init(2);
bool abc = 0;
while(1){

View File

@ -27,7 +27,6 @@
#include "bh1750.h"
#include "upm_utilities.h"
#include "mraa.h"
bool shouldRun = true;
@ -39,12 +38,6 @@ void sig_handler(int signo)
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
signal(SIGINT, sig_handler);
//! [Interesting]

View File

@ -8,16 +8,9 @@
#include "collision.h"
#include "upm_utilities.h"
#include "mraa.h"
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
collision_context dev = collision_init(2);
bool abc = 0;
while(1){

View File

@ -27,7 +27,6 @@
#include "dfrec.h"
#include "upm_utilities.h"
#include "mraa.h"
bool shouldRun = true;
@ -39,12 +38,6 @@ void sig_handler(int signo)
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
printf("Failed to initialize mraa\n");
return -1;
}
signal(SIGINT, sig_handler);
//! [Interesting]

View File

@ -27,7 +27,6 @@
#include "dfrorp.h"
#include "upm_utilities.h"
#include "mraa.h"
bool shouldRun = true;
@ -39,12 +38,6 @@ void sig_handler(int signo)
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
signal(SIGINT, sig_handler);
//! [Interesting]

View File

@ -27,7 +27,6 @@
#include "dfrph.h"
#include "upm_utilities.h"
#include "mraa.h"
bool shouldRun = true;
@ -39,12 +38,6 @@ void sig_handler(int signo)
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
signal(SIGINT, sig_handler);
//! [Interesting]

View File

@ -28,7 +28,6 @@
#include "ds18b20.h"
#include "upm_utilities.h"
#include "mraa.h"
bool shouldRun = true;
@ -40,12 +39,6 @@ void sig_handler(int signo)
int main(int argc, char **argv)
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
signal(SIGINT, sig_handler);
//! [Interesting]

View File

@ -27,7 +27,6 @@
#include "emg.h"
#include "upm_utilities.h"
#include "mraa.h"
bool shouldRun = true;
@ -39,12 +38,6 @@ void sig_handler(int signo)
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
signal(SIGINT, sig_handler);
//! [Interesting]

View File

@ -27,7 +27,6 @@
#include "flex.h"
#include "upm_utilities.h"
#include "mraa.h"
bool shouldRun = true;
@ -39,12 +38,6 @@ void sig_handler(int signo)
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
signal(SIGINT, sig_handler);
//! [Interesting]

View File

@ -8,16 +8,9 @@
#include "gp2y0a.h"
#include "upm_utilities.h"
#include "mraa.h"
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
gp2y0a_context dev = gp2y0a_init(14, 5.0);
float val;
while(1){

View File

@ -8,16 +8,9 @@
#include "grovemoisture.h"
#include "upm_utilities.h"
#include "mraa.h"
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
grovemoisture_context dev = grovemoisture_init(14);
int val;
while(1){

View File

@ -27,7 +27,6 @@
#include "gsr.h"
#include "upm_utilities.h"
#include "mraa.h"
bool shouldRun = true;
@ -39,12 +38,6 @@ void sig_handler(int signo)
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
signal(SIGINT, sig_handler);
//! [Interesting]

View File

@ -27,7 +27,6 @@
#include "hka5.h"
#include "upm_utilities.h"
#include "mraa.h"
bool shouldRun = true;
@ -39,12 +38,6 @@ void sig_handler(int signo)
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
signal(SIGINT, sig_handler);
//! [Interesting]

View File

@ -27,8 +27,6 @@
#include "joystick12.h"
#include "upm_utilities.h"
#include "mraa.h"
bool shouldRun = true;
@ -40,12 +38,6 @@ void sig_handler(int signo)
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
signal(SIGINT, sig_handler);
//! [Interesting]

View File

@ -27,7 +27,6 @@
#include "ldt0028.h"
#include "upm_utilities.h"
#include "mraa.h"
bool shouldRun = true;
@ -39,12 +38,6 @@ void sig_handler(int signo)
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
signal(SIGINT, sig_handler);
//! [Interesting]

View File

@ -8,16 +8,9 @@
#include "led.h"
#include "upm_utilities.h"
#include "mraa.h"
int main(void)
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
led_context dev = led_init(2);
while(1){
if(led_on(dev) != UPM_SUCCESS){

View File

@ -27,7 +27,6 @@
#include "light.h"
#include "upm_utilities.h"
#include "mraa.h"
bool shouldRun = true;
@ -39,12 +38,6 @@ void sig_handler(int signo)
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
signal(SIGINT, sig_handler);
//! [Interesting]

View File

@ -8,16 +8,9 @@
#include "loudness.h"
#include "upm_utilities.h"
#include "mraa.h"
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
loudness_context dev = loudness_init(14);
int val;
while(1){

View File

@ -6,16 +6,9 @@
#include "m24lr64e.h"
#include "upm_utilities.h"
#include "mraa.h"
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
m24lr64e_context dev = m24lr64e_init(0, M24LR64E_USER_MODE);
int addr = M24LR64E_EEPROM_I2C_LENGTH-1;
printf("address being accessed: %d\n", addr);

View File

@ -27,7 +27,6 @@
#include "mma7361.h"
#include "upm_utilities.h"
#include "mraa.h"
bool shouldRun = true;
@ -39,12 +38,6 @@ void sig_handler(int signo)
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
signal(SIGINT, sig_handler);
//! [Interesting]

View File

@ -8,16 +8,9 @@
#include "moisture.h"
#include "upm_utilities.h"
#include "mraa.h"
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
moisture_context dev = moisture_init(14);
int val;
while(1){

View File

@ -8,16 +8,9 @@
#include "mpr121.h"
#include "upm_utilities.h"
#include "mraa.h"
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
mpr121_context dev = mpr121_init(MPR121_I2C_BUS, MPR121_DEFAULT_I2C_ADDR);
if(mpr121_config_an3944(dev) != UPM_SUCCESS){

View File

@ -8,16 +8,8 @@
#include "mq303a.h"
#include "upm_utilities.h"
#include "mraa.h"
int main() {
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
/* --------- MQ303A EXAMPLE -------- */
mq303a_context dev = mq303a_init(0, 15);
printf("init done for mq303a\n");

View File

@ -27,7 +27,6 @@
#include "mqx.h"
#include "upm_utilities.h"
#include "mraa.h"
bool shouldRun = true;
@ -39,12 +38,6 @@ void sig_handler(int signo)
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
signal(SIGINT, sig_handler);
//! [Interesting]

View File

@ -27,7 +27,6 @@
#include "nmea_gps.h"
#include "upm_utilities.h"
#include "mraa.h"
bool shouldRun = true;
@ -41,12 +40,6 @@ void sig_handler(int signo)
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
signal(SIGINT, sig_handler);
//! [Interesting]

View File

@ -27,7 +27,6 @@
#include "nmea_gps.h"
#include "upm_utilities.h"
#include "mraa.h"
bool shouldRun = true;
@ -41,12 +40,6 @@ void sig_handler(int signo)
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
signal(SIGINT, sig_handler);
//! [Interesting]

View File

@ -27,7 +27,6 @@
#include "o2.h"
#include "upm_utilities.h"
#include "mraa.h"
bool shouldRun = true;
@ -39,12 +38,6 @@ void sig_handler(int signo)
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
signal(SIGINT, sig_handler);
//! [Interesting]

View File

@ -8,16 +8,9 @@
#include "es08a.h"
#include "upm_utilities.h"
#include "mraa.h"
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
es08a_context dev = es08a_init(3, ES08A_MIN_PULSE_WIDTH, ES08A_MAX_PULSE_WIDTH);
if(dev == NULL){
printf("unable to initialize the servo context\n");

View File

@ -27,7 +27,6 @@
#include "sht1x.h"
#include "upm_utilities.h"
#include "mraa.h"
bool shouldRun = true;
@ -39,12 +38,6 @@ void sig_handler(int signo)
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
signal(SIGINT, sig_handler);
//! [Interesting]

View File

@ -27,7 +27,6 @@
#include "slide.h"
#include "upm_utilities.h"
#include "mraa.h"
bool shouldRun = true;
@ -39,12 +38,6 @@ void sig_handler(int signo)
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
signal(SIGINT, sig_handler);
//! [Interesting]

View File

@ -8,16 +8,9 @@
#include "tsl2561.h"
#include "upm_utilities.h"
#include "mraa.h"
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
tsl2561_context dev = tsl2561_init(0, TSL2561_Address, GAIN_0X, INTEGRATION_TIME1_101MS);
float abc = 0;
if(tsl2561_get_lux(dev, &abc) != UPM_SUCCESS){

View File

@ -8,16 +8,9 @@
#include "ttp223.h"
#include "upm_utilities.h"
#include "mraa.h"
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
ttp223_context dev = ttp223_init(2);
bool abc = 0;
while(1){

View File

@ -27,7 +27,6 @@
#include "urm37.h"
#include "upm_utilities.h"
#include "mraa.h"
bool shouldRun = true;
@ -39,12 +38,6 @@ void sig_handler(int signo)
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
signal(SIGINT, sig_handler);
//! [Interesting]

View File

@ -27,7 +27,6 @@
#include "urm37.h"
#include "upm_utilities.h"
#include "mraa.h"
bool shouldRun = true;
@ -39,12 +38,6 @@ void sig_handler(int signo)
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
signal(SIGINT, sig_handler);
//! [Interesting]

View File

@ -27,7 +27,6 @@
#include "vdiv.h"
#include "upm_utilities.h"
#include "mraa.h"
bool shouldRun = true;
@ -39,12 +38,6 @@ void sig_handler(int signo)
int main()
{
if (mraa_init() != MRAA_SUCCESS)
{
perror("Failed to initialize mraa\n");
return -1;
}
signal(SIGINT, sig_handler);
//! [Interesting]