Private
Public Access
2
0

examples: misc static code analysis fixes

Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Alex Tereschenko
2017-06-05 16:53:58 +02:00
committed by Brendan Le Foll
parent bb3584fcdb
commit 32340f6819
7 changed files with 14 additions and 20 deletions

View File

@@ -33,9 +33,6 @@ main()
mraa::Aio* a0;
a0 = new mraa::Aio(0);
if (a0 == NULL) {
return MRAA_ERROR_UNSPECIFIED;
}
for (;;) {
adc_value = a0->read();

View File

@@ -56,12 +56,10 @@ main(int argc, char** argv)
//! [Interesting]
mraa::Gpio* gpio = new mraa::Gpio(iopin);
if (gpio == NULL) {
return mraa::ERROR_UNSPECIFIED;
}
mraa::Result response = gpio->dir(mraa::DIR_OUT);
if (response != mraa::SUCCESS) {
mraa::printError(response);
delete gpio;
return 1;
}

View File

@@ -53,5 +53,6 @@ main()
sleep(1);
}
delete x;
return EXIT_SUCCESS;
}

View File

@@ -46,9 +46,6 @@ main()
mraa::Pwm* pwm;
pwm = new mraa::Pwm(3);
if (pwm == NULL) {
return MRAA_ERROR_UNSPECIFIED;
}
fprintf(stdout, "Cycling PWM on IO3 (pwm3) \n");
pwm->enable(true);

View File

@@ -27,8 +27,6 @@
//! [Interesting]
#include "uart_ow.hpp"
using namespace std;
int
main(int argc, char** argv)
{
@@ -38,21 +36,23 @@ main(int argc, char** argv)
mraa::Result rv;
if ((rv = uart->reset()) == mraa::SUCCESS) {
cout << "Reset succeeded, device(s) detected!" << endl;
std::cout << "Reset succeeded, device(s) detected!" << std::endl;
} else {
cout << "Reset failed, returned " << int(rv) << ". No devices on bus?" << endl;
std::cout << "Reset failed, returned " << int(rv) << ". No devices on bus?" << std::endl;
delete uart;
return 1;
}
cout << "Looking for devices..." << endl;
std::cout << "Looking for devices..." << std::endl;
;
uint8_t count = 0;
// start the search from scratch
string id = uart->search(true);
std::string id = uart->search(true);
if (id.empty()) {
cout << "No devices detected." << endl;
std::cout << "No devices detected." << std::endl;
delete uart;
return 1;
}
@@ -73,7 +73,7 @@ main(int argc, char** argv)
id = uart->search(false);
}
cout << "Exiting..." << endl;
std::cout << "Exiting..." << std::endl;
delete uart;