mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
Examples: Removing MRAA reference from examples
Signed-off-by: Abhishek Malik <abhishek.malik@intel.com>
This commit is contained in:
parent
e8aeaff162
commit
6cc5c9691d
@ -71,7 +71,7 @@ main(int argc, char** argv)
|
|||||||
upm::GPRS sensor(0);
|
upm::GPRS sensor(0);
|
||||||
|
|
||||||
// Set the baud rate, 19200 baud is the default.
|
// Set the baud rate, 19200 baud is the default.
|
||||||
if (sensor.setBaudRate(19200) != mraa::SUCCESS) {
|
if (sensor.setBaudRate(19200) != 0) {
|
||||||
cerr << "Failed to set tty baud rate" << endl;
|
cerr << "Failed to set tty baud rate" << endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ main(int argc, char** argv)
|
|||||||
upm::GroveGPRS sensor(0);
|
upm::GroveGPRS sensor(0);
|
||||||
|
|
||||||
// Set the baud rate, 19200 baud is the default.
|
// Set the baud rate, 19200 baud is the default.
|
||||||
if (sensor.setBaudRate(19200) != mraa::SUCCESS) {
|
if (sensor.setBaudRate(19200) != 0) {
|
||||||
cerr << "Failed to set tty baud rate" << endl;
|
cerr << "Failed to set tty baud rate" << endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -28,13 +28,14 @@
|
|||||||
#include "si1132.hpp"
|
#include "si1132.hpp"
|
||||||
#include "upm_utilities.h"
|
#include "upm_utilities.h"
|
||||||
|
|
||||||
#define FT4222_I2C_BUS 1
|
#define FT4222_I2C_BUS 1
|
||||||
|
#define DEFAULT_I2C_BUS 0
|
||||||
|
|
||||||
int
|
int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
//! [Interesting]
|
//! [Interesting]
|
||||||
upm::SI1132 lightSensor(mraa_get_sub_platform_id(FT4222_I2C_BUS));
|
upm::SI1132 lightSensor(DEFAULT_I2C_BUS);
|
||||||
while (true) {
|
while (true) {
|
||||||
float value = lightSensor.getVisibleLux();
|
float value = lightSensor.getVisibleLux();
|
||||||
std::cout << "Light level = " << value << " lux" << std::endl;
|
std::cout << "Light level = " << value << " lux" << std::endl;
|
||||||
|
@ -40,7 +40,7 @@ int
|
|||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
/* Create an instance of the T6713 sensor */
|
/* Create an instance of the T6713 sensor */
|
||||||
upm::T6713 sensor(mraa_get_sub_platform_id(FT4222_I2C_BUS));
|
upm::T6713 sensor(EDISON_I2C_BUS);
|
||||||
|
|
||||||
/* Show usage from the ICO2Sensor interface */
|
/* Show usage from the ICO2Sensor interface */
|
||||||
upm::ICO2Sensor* cO2Sensor = static_cast<upm::ICO2Sensor*>(&sensor);
|
upm::ICO2Sensor* cO2Sensor = static_cast<upm::ICO2Sensor*>(&sensor);
|
||||||
|
@ -28,13 +28,14 @@
|
|||||||
#include "t6713.hpp"
|
#include "t6713.hpp"
|
||||||
#include "upm_utilities.h"
|
#include "upm_utilities.h"
|
||||||
|
|
||||||
#define FT4222_I2C_BUS 0
|
#define FT4222_I2C_BUS 0
|
||||||
|
#define DEFAULT_I2C_BUS 0
|
||||||
|
|
||||||
int
|
int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
//! [Interesting]
|
//! [Interesting]
|
||||||
upm::T6713 cO2Sensor(mraa_get_sub_platform_id(FT4222_I2C_BUS));
|
upm::T6713 cO2Sensor(DEFAULT_I2C_BUS);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
uint16_t value = cO2Sensor.getPpm();
|
uint16_t value = cO2Sensor.getPpm();
|
||||||
|
@ -65,8 +65,14 @@ int GPRS::writeDataStr(std::string data)
|
|||||||
return m_uart.writeStr(data);
|
return m_uart.writeStr(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
mraa::Result GPRS::setBaudRate(int baud)
|
int GPRS::setBaudRate(int baud)
|
||||||
{
|
{
|
||||||
return m_uart.setBaudRate(baud);
|
int ret_code = m_uart.setBaudRate(baud);
|
||||||
|
if (ret_code != MRAA_SUCCESS) {
|
||||||
|
return ret_code;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
//return m_uart.setBaudRate(baud);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ namespace upm {
|
|||||||
* @param baud Desired baud rate.
|
* @param baud Desired baud rate.
|
||||||
* @return true if successful
|
* @return true if successful
|
||||||
*/
|
*/
|
||||||
mraa::Result setBaudRate(int baud=19200);
|
int setBaudRate(int baud=19200);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -65,8 +65,14 @@ int GroveGPRS::writeDataStr(std::string data)
|
|||||||
return m_uart.writeStr(data);
|
return m_uart.writeStr(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
mraa::Result GroveGPRS::setBaudRate(int baud)
|
int GroveGPRS::setBaudRate(int baud)
|
||||||
{
|
{
|
||||||
return m_uart.setBaudRate(baud);
|
int ret_code = m_uart.setBaudRate(baud);
|
||||||
|
if (ret_code != mraa::SUCCESS) {
|
||||||
|
return ret_code;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
//return m_uart.setBaudRate(baud);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ namespace upm {
|
|||||||
* @param baud Desired baud rate.
|
* @param baud Desired baud rate.
|
||||||
* @return true if successful
|
* @return true if successful
|
||||||
*/
|
*/
|
||||||
mraa::Result setBaudRate(int baud=19200);
|
int setBaudRate(int baud=19200);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user