mirror of
https://github.com/eclipse/upm.git
synced 2025-03-14 20:47:30 +03:00
ANDROID: Treat utilities as its own library
Since src/utilities now builds a C/C++ library, other targets which were using symbols from utilities now need to include the correct target dependency. This is mainly for upm_delay* functions. Added utilities-c target to all sensor library CMakeLists.txt which require it. Moved macro for __FILENAME__ from upm_utilities.h to upm_fti.h since ONLY the FTI headers used this. Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
parent
0bd68e4e2b
commit
21ecbd90eb
@ -26,6 +26,7 @@
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include "buzzer.hpp"
|
||||
#include "upm_utilities.h"
|
||||
|
||||
|
||||
int
|
||||
|
@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "lcm1602.hpp"
|
||||
#include "upm_utilities.h"
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
@ -32,16 +33,16 @@ main(int argc, char **argv)
|
||||
lcd->setCursor(0,0);
|
||||
lcd->write("Hello World");
|
||||
//! [Interesting]
|
||||
sleep(3);
|
||||
upm_delay(3);
|
||||
lcd->setCursor(1,2);
|
||||
lcd->write("Hello World");
|
||||
sleep(3);
|
||||
upm_delay(3);
|
||||
lcd->setCursor(2,4);
|
||||
lcd->write("Hello World");
|
||||
sleep(3);
|
||||
upm_delay(3);
|
||||
lcd->setCursor(3,6);
|
||||
lcd->write("Hello World");
|
||||
sleep(3);
|
||||
upm_delay(3);
|
||||
delete lcd;
|
||||
|
||||
return 0;
|
||||
|
@ -23,7 +23,8 @@
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <lcm1602.hpp>
|
||||
#include "lcm1602.hpp"
|
||||
#include "upm_utilities.h"
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
@ -47,7 +48,7 @@ main(int argc, char **argv)
|
||||
lcd->write("Hello World");
|
||||
|
||||
printf("Sleeping for 5 seconds\n");
|
||||
sleep(5);
|
||||
upm_delay(5);
|
||||
delete lcd;
|
||||
//! [Interesting]
|
||||
return 0;
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <signal.h>
|
||||
|
||||
#include "max30100.hpp"
|
||||
#include "upm_utilities.h"
|
||||
|
||||
using namespace upm;
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "lcm1602.h"
|
||||
#include "upm_utilities.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "lcm1602.h"
|
||||
#include "upm_utilities.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
@ -34,7 +34,6 @@ extern "C" {
|
||||
|
||||
#include <upm_types.h>
|
||||
#include <upm_math.h>
|
||||
#include <upm_utilities.h>
|
||||
|
||||
#define upm_perror(...) perror(args, __VA_ARGS__)
|
||||
|
||||
|
@ -32,6 +32,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Get filename w/o path */
|
||||
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
|
||||
|
||||
/**
|
||||
* The UPM Function Table Interface (FTI)
|
||||
*/
|
||||
|
@ -5,4 +5,4 @@ upm_mixed_module_init (NAME apa102
|
||||
CPP_HDR apa102.hpp
|
||||
CPP_SRC apa102.cxx
|
||||
FTI_SRC apa102_fti.c
|
||||
REQUIRES mraa)
|
||||
REQUIRES mraa utilities-c)
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include "apa102.h"
|
||||
#include "upm_utilities.h"
|
||||
|
||||
apa102_context apa102_init(int ledcount, int bus, int cs) {
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include "bh1750.h"
|
||||
#include "upm_utilities.h"
|
||||
|
||||
bh1750_context bh1750_init(int bus, uint8_t addr, BH1750_OPMODES_T mode)
|
||||
{
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include "enc03r.h"
|
||||
#include "upm_utilities.h"
|
||||
|
||||
enc03r_context enc03r_init(int pin, float aref)
|
||||
{
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <syslog.h>
|
||||
|
||||
#include "ims.h"
|
||||
#include "upm_utilities.h"
|
||||
|
||||
ims_context* ims_init(int16_t i2c_bus, int16_t i2c_address)
|
||||
{
|
||||
|
@ -33,6 +33,7 @@
|
||||
*/
|
||||
|
||||
#include "m24lr64e.h"
|
||||
#include "upm_utilities.h"
|
||||
|
||||
// forward declarations - these were protected methods in original C++
|
||||
// code. Might need to expose them?
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "max30100.h"
|
||||
#include "upm_utilities.h"
|
||||
|
||||
max30100_context* max30100_init(int16_t i2c_bus)
|
||||
{
|
||||
|
@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
#include "mq303a.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
mq303a_context mq303a_init(int pin, int heater_pin) {
|
||||
// make sure MRAA is initialized
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include "nunchuck.h"
|
||||
#include "upm_utilities.h"
|
||||
|
||||
// This is not changeable
|
||||
#define NUNCHUCK_I2C_ADDR 0x52
|
||||
|
@ -4,4 +4,4 @@ upm_mixed_module_init (NAME p9813
|
||||
C_SRC p9813.c
|
||||
CPP_HDR p9813.hpp
|
||||
CPP_SRC p9813.cxx
|
||||
REQUIRES mraa)
|
||||
REQUIRES mraa utilities-c)
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include "p9813.h"
|
||||
#include "upm_utilities.h"
|
||||
|
||||
p9813_context p9813_init(int ledcount, int clk, int data) {
|
||||
|
||||
@ -100,9 +101,9 @@ upm_result_t p9813_send_byte(p9813_context dev, uint8_t data)
|
||||
mraa_gpio_write(dev->data, (data & 0x80) >> 7);
|
||||
// Pulse the clock
|
||||
mraa_gpio_write(dev->clk, 1);
|
||||
usleep(20);
|
||||
upm_delay_us(20);
|
||||
mraa_gpio_write(dev->clk, 0);
|
||||
usleep(20);
|
||||
upm_delay_us(20);
|
||||
|
||||
// Shift to the next data bit
|
||||
data <<= 1;
|
||||
|
@ -22,6 +22,7 @@
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "rsc.h"
|
||||
#include "upm_utilities.h"
|
||||
|
||||
upm_result_t rsc_eeprom_read(rsc_context dev, uint16_t address, uint8_t* buf, int len, uint8_t arglen);
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "es08a.h"
|
||||
#include "upm_utilities.h"
|
||||
|
||||
es08a_context es08a_init(int32_t pin, int32_t min_pulse_width,
|
||||
int32_t max_pulse_width) {
|
||||
|
@ -23,6 +23,7 @@
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "es9257.h"
|
||||
#include "upm_utilities.h"
|
||||
|
||||
es9257_context es9257_init(int32_t pin, int32_t min_pulse_width,
|
||||
int32_t max_pulse_width) {
|
||||
|
@ -28,6 +28,7 @@
|
||||
*/
|
||||
|
||||
#include "tsl2561.h"
|
||||
#include "upm_utilities.h"
|
||||
|
||||
// forward declaration
|
||||
upm_result_t tsl2561_compute_lux(const tsl2561_context dev, int *int_data);
|
||||
|
@ -31,8 +31,8 @@
|
||||
#endif
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <upm_platform.h>
|
||||
#include <upm_utilities.h>
|
||||
#include "upm_platform.h"
|
||||
#include "upm_utilities.h"
|
||||
|
||||
// https://airnow.gov/index.cfm?action=aqibasics.aqi
|
||||
static struct aqi {
|
||||
|
@ -62,10 +62,6 @@ typedef uint32_t upm_clock_t;
|
||||
|
||||
#endif /* UPM_PLATFORM_ZEPHYR */
|
||||
|
||||
|
||||
/* Get filename w/o path */
|
||||
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
|
||||
|
||||
/**
|
||||
* Delay for a number of seconds
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user