From 262a43c4d47f3500ef582159e49ffe30d2fcf38c Mon Sep 17 00:00:00 2001 From: asterix Date: Thu, 22 Jul 2010 10:20:01 +0000 Subject: [PATCH] Implement put function and remove send. git-svn-id: https://src.develer.com/svnoss/bertos/branches/i2c@4046 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/cpu/cortex-m3/drv/i2c_stm32.c | 32 ++++++---------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/bertos/cpu/cortex-m3/drv/i2c_stm32.c b/bertos/cpu/cortex-m3/drv/i2c_stm32.c index 9f782383..62f9dafa 100644 --- a/bertos/cpu/cortex-m3/drv/i2c_stm32.c +++ b/bertos/cpu/cortex-m3/drv/i2c_stm32.c @@ -175,37 +175,19 @@ void i2c_builtin_stop(void) bool i2c_builtin_put(const uint8_t data) { - return true; -} + i2c->DR = data; + WAIT_BTF(i2c); -int i2c_builtin_get(bool ack) -{ + if(check_i2cStatus(I2C_EVENT_MASTER_BYTE_TRANSMITTED)) + return true; - return 0; + return false; } -bool i2c_send(const void *_buf, size_t count) +int i2c_builtin_get(bool ack) { - const uint8_t *buf = (const uint8_t *)_buf; - - i2c->DR = *buf++; - count--; - - while (count) - { - ASSERT(buf); - WAIT_BTF(i2c); - - i2c->DR = *buf++; - count--; - - } - - if(check_i2cStatus(I2C_EVENT_MASTER_BYTE_TRANSMITTED)) - return true; - - return false; + return 0; } /** -- 2.25.1