From f6a98c59209d8f21abdcb0a8411222ea4ef7c690 Mon Sep 17 00:00:00 2001
From: batt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Date: Mon, 6 Oct 2008 17:22:01 +0000
Subject: [PATCH] Merged from external project: 	********** 	r22418 | batt
 | 2008-10-03 12:53:56 +0200 (Fri, 03 Oct 2008) | 1 line

	Refactor to use log subsystem.
	**********


git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1879 38d2e660-2303-0410-9eaa-f027e97ec537
---
 bertos/cpu/avr/drv/i2c_avr.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/bertos/cpu/avr/drv/i2c_avr.c b/bertos/cpu/avr/drv/i2c_avr.c
index 61a5bdea..335d8330 100644
--- a/bertos/cpu/avr/drv/i2c_avr.c
+++ b/bertos/cpu/avr/drv/i2c_avr.c
@@ -41,6 +41,12 @@
 #include "hw/hw_cpu.h"  /* CLOCK_FREQ */
 
 #include "cfg/cfg_i2c.h"
+
+#define LOG_LEVEL  I2C_LOG_LEVEL
+#define LOG_FORMAT I2C_LOG_FORMAT
+
+#include <cfg/log.h>
+
 #include <cfg/debug.h>
 #include <cfg/macros.h> // BV()
 #include <cfg/module.h>
@@ -69,7 +75,7 @@ static bool i2c_start(void)
 	if (TW_STATUS == TW_START || TW_STATUS == TW_REP_START)
 		return true;
 
-	kprintf("!TW_(REP)START: %x\n", TWSR);
+	LOG_ERR("!TW_(REP)START: %x\n", TWSR);
 	return false;
 }
 
@@ -100,12 +106,12 @@ bool i2c_start_w(uint8_t id)
 			return true;
 		else if (TW_STATUS != TW_MT_SLA_NACK)
 		{
-			kprintf("!TW_MT_SLA_(N)ACK: %x\n", TWSR);
+			LOG_ERR("!TW_MT_SLA_(N)ACK: %x\n", TWSR);
 			break;
 		}
 		else if (timer_clock() - start > ms_to_ticks(CONFIG_I2C_START_TIMEOUT))
 		{
-			kprintf("Timeout on TWI_MT_START\n");
+			LOG_ERR("Timeout on TWI_MT_START\n");
 			break;
 		}
 	}
@@ -132,7 +138,7 @@ bool i2c_start_r(uint8_t id)
 		if (TW_STATUS == TW_MR_SLA_ACK)
 			return true;
 
-		kprintf("!TW_MR_SLA_ACK: %x\n", TWSR);
+		LOG_ERR("!TW_MR_SLA_ACK: %x\n", TWSR);
 	}
 
 	return false;
@@ -161,7 +167,7 @@ bool i2c_put(const uint8_t data)
 	WAIT_TWI_READY;
 	if (TW_STATUS != TW_MT_DATA_ACK)
 	{
-		kprintf("!TW_MT_DATA_ACK: %x\n", TWSR);
+		LOG_ERR("!TW_MT_DATA_ACK: %x\n", TWSR);
 		return false;
 	}
 	return true;
@@ -184,7 +190,7 @@ int i2c_get(bool ack)
 	{
 		if (TW_STATUS != TW_MR_DATA_ACK)
 		{
-			kprintf("!TW_MR_DATA_ACK: %x\n", TWSR);
+			LOG_ERR("!TW_MR_DATA_ACK: %x\n", TWSR);
 			return EOF;
 		}
 	}
@@ -192,7 +198,7 @@ int i2c_get(bool ack)
 	{
 		if (TW_STATUS != TW_MR_DATA_NACK)
 		{
-			kprintf("!TW_MR_DATA_NACK: %x\n", TWSR);
+			LOG_ERR("!TW_MR_DATA_NACK: %x\n", TWSR);
 			return EOF;
 		}
 	}
-- 
2.25.1