From: Walter Fetter Lages Date: Thu, 31 Jan 2019 05:44:34 +0000 (-0200) Subject: Move delay to an independent file. X-Git-Tag: f1~10 X-Git-Url: http://git.ece.ufrgs.br/?a=commitdiff_plain;h=ead6713e8cf0833fc8ef41ae3e6b6a4030a78390;p=bno055.git Move delay to an independent file. --- diff --git a/include/bno055_delay.h b/include/bno055_delay.h new file mode 100644 index 0000000..26631e0 --- /dev/null +++ b/include/bno055_delay.h @@ -0,0 +1,41 @@ +/****************************************************************************** + BNO055 Library + Delay + Copyright (C) 2019 Walter Fetter Lages + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see + . + +*******************************************************************************/ + +#ifndef __BNO055_DELAY_H__ +#define __BNO055_DELAY_H__ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include + +/* Brief : Delay routine + * \param : delay in ms +*/ +extern void BNO055_delay(u32 ms); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/lib/Makefile b/lib/Makefile index 1771b88..558bc76 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -1,5 +1,5 @@ TARGET=libbno055ifc.a -SRCS=bno055_tty.c +SRCS=bno055_tty.c bno055_delay.c FLAGS=-O2 -Wall -MMD INCLUDE=-I. -I../include -I../../BNO055_driver diff --git a/lib/bno055_delay.c b/lib/bno055_delay.c new file mode 100644 index 0000000..593e1e4 --- /dev/null +++ b/lib/bno055_delay.c @@ -0,0 +1,29 @@ +/****************************************************************************** + BNO055 Library + Delay + Copyright (C) 2019 Walter Fetter Lages + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see + . + +*******************************************************************************/ + +#include + +#include + +void BNO055_delay(u32 ms) +{ + usleep(ms*1000); +} diff --git a/lib/bno055_tty.c b/lib/bno055_tty.c index 2e23cc9..2e4847b 100644 --- a/lib/bno055_tty.c +++ b/lib/bno055_tty.c @@ -24,6 +24,7 @@ #include #include +#include #include s8 BNO055_tty_init(int fd,struct bno055_t *bno055) @@ -42,7 +43,7 @@ s8 BNO055_tty_init(int fd,struct bno055_t *bno055) bno055->bus_write=BNO055_tty_write; bno055->bus_read=BNO055_tty_read; - bno055->delay_msec=BNO055_tty_delay_ms; + bno055->delay_msec=BNO055_delay; bno055->dev_addr=fd; return BNO055_SUCCESS; @@ -118,8 +119,3 @@ s8 BNO055_tty_read(u8 dev_addr,u8 reg_addr,u8 *reg_data,u8 cnt) } return BNO055_SUCCESS; } - -void BNO055_tty_delay_ms(u32 ms) -{ - usleep(ms*1000); -}