projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix the bug related to the empty version list
[bertos.git]
/
bertos
/
drv
/
i2c_bitbang.c
diff --git
a/bertos/drv/i2c_bitbang.c
b/bertos/drv/i2c_bitbang.c
index 1b7b787823f49ae52e202ae3b749a3ac3aea7061..1d7e98d6819c0d7b86ec09829e3ca38cad274455 100644
(file)
--- a/
bertos/drv/i2c_bitbang.c
+++ b/
bertos/drv/i2c_bitbang.c
@@
-32,7
+32,7
@@
*
* \brief I2C bitbang driver (implementation)
*
*
* \brief I2C bitbang driver (implementation)
*
- * \version $Id
: adc.c 1604 2008-08-10 17:19:51Z bernie
$
+ * \version $Id$
* \author Francesco Sacchi <batt@develer.com>
*/
* \author Francesco Sacchi <batt@develer.com>
*/
@@
-51,7
+51,7
@@
#include "hw/hw_i2c_bitbang.h"
#include "hw/hw_i2c_bitbang.h"
-INLINE bool i2c_start(void)
+INLINE bool i2c_
bitbang_
start(void)
{
SDA_HI;
SCL_HI;
{
SDA_HI;
SCL_HI;
@@
-62,7
+62,7
@@
INLINE bool i2c_start(void)
return !SDA_IN;
}
return !SDA_IN;
}
-void i2c_stop(void)
+void i2c_
bitbang_
stop(void)
{
SDA_LO;
SCL_HI;
{
SDA_LO;
SCL_HI;
@@
-70,7
+70,7
@@
void i2c_stop(void)
SDA_HI;
}
SDA_HI;
}
-bool i2c_put(uint8_t _data)
+bool i2c_
bitbang_
put(uint8_t _data)
{
/* Add ACK bit */
uint16_t data = (_data << 1) | 1;
{
/* Add ACK bit */
uint16_t data = (_data << 1) | 1;
@@
-94,7
+94,7
@@
bool i2c_put(uint8_t _data)
return ack;
}
return ack;
}
-bool i2c_start_w(uint8_t id)
+bool i2c_
bitbang_
start_w(uint8_t id)
{
id &= ~I2C_READBIT;
/*
{
id &= ~I2C_READBIT;
/*
@@
-104,9
+104,9
@@
bool i2c_start_w(uint8_t id)
* keep trying until the deveice responds with an ACK.
*/
ticks_t start = timer_clock();
* keep trying until the deveice responds with an ACK.
*/
ticks_t start = timer_clock();
- while (i2c_start())
+ while (i2c_
bitbang_
start())
{
{
- if (i2c_put(id))
+ if (i2c_
bitbang_
put(id))
return true;
else if (timer_clock() - start > ms_to_ticks(CONFIG_I2C_START_TIMEOUT))
{
return true;
else if (timer_clock() - start > ms_to_ticks(CONFIG_I2C_START_TIMEOUT))
{
@@
-119,12
+119,12
@@
bool i2c_start_w(uint8_t id)
return false;
}
return false;
}
-bool i2c_start_r(uint8_t id)
+bool i2c_
bitbang_
start_r(uint8_t id)
{
id |= I2C_READBIT;
{
id |= I2C_READBIT;
- if (i2c_start())
+ if (i2c_
bitbang_
start())
{
{
- if (i2c_put(id))
+ if (i2c_
bitbang_
put(id))
return true;
LOG_ERR("NACK on I2c start read\n");
return true;
LOG_ERR("NACK on I2c start read\n");
@@
-133,7
+133,7
@@
bool i2c_start_r(uint8_t id)
return false;
}
return false;
}
-int i2c_get(bool ack)
+int i2c_
bitbang_
get(bool ack)
{
uint8_t data = 0;
for (uint8_t i = 0x80; i != 0; i >>= 1)
{
uint8_t data = 0;
for (uint8_t i = 0x80; i != 0; i >>= 1)
@@
-169,7
+169,7
@@
MOD_DEFINE(i2c);
/**
* Initialize i2c module.
*/
/**
* Initialize i2c module.
*/
-void i2c_init(void)
+void i2c_
bitbang_
init(void)
{
MOD_CHECK(timer);
I2C_BITBANG_HW_INIT;
{
MOD_CHECK(timer);
I2C_BITBANG_HW_INIT;