projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Sistema l'errore da me commesso in fase di conversione...
[bertos.git]
/
drv
/
twi.c
diff --git
a/drv/twi.c
b/drv/twi.c
old mode 100755
(executable)
new mode 100644
(file)
index
f2c73f9
..
52112d2
--- a/
drv/twi.c
+++ b/
drv/twi.c
@@
-1,4
+1,4
@@
-/*
!
+/*
*
* \file
* <!--
* Copyright 2003, 2004, 2005 Develer S.r.l. (http://www.develer.com/)
* \file
* <!--
* Copyright 2003, 2004, 2005 Develer S.r.l. (http://www.develer.com/)
@@
-15,6
+15,12
@@
/*#*
*#* $Log$
/*#*
*#* $Log$
+ *#* Revision 1.8 2007/06/07 14:35:12 batt
+ *#* Merge from project_ks.
+ *#*
+ *#* Revision 1.7 2006/07/19 12:56:26 bernie
+ *#* Convert to new Doxygen style.
+ *#*
*#* Revision 1.6 2006/03/20 17:49:50 bernie
*#* Make the TWI driver more generic to work with devices other than EEPROMS.
*#*
*#* Revision 1.6 2006/03/20 17:49:50 bernie
*#* Make the TWI driver more generic to work with devices other than EEPROMS.
*#*
@@
-40,7
+46,7
@@
#include <cfg/debug.h>
#include <cfg/cpu.h>
#include <cfg/macros.h> // BV()
#include <cfg/debug.h>
#include <cfg/cpu.h>
#include <cfg/macros.h> // BV()
-#include <hw
.h>
+#include <hw
_cpu.h> /* CLOCK_FREQ */
#include <appconfig.h>
#include <compat/twi.h>
#include <appconfig.h>
#include <compat/twi.h>
@@
-52,7
+58,7
@@
#define READ_BIT BV(0)
#define READ_BIT BV(0)
-/*
!
+/*
*
* Send START condition on the bus.
*
* \return true on success, false otherwise.
* Send START condition on the bus.
*
* \return true on success, false otherwise.
@@
-70,7
+76,7
@@
static bool twi_start(void)
}
}
-/*
!
+/*
*
* Send START condition and select slave for write.
* \c id is the device id comprehensive of address left shifted by 1.
* The LSB of \c id is ignored and reset to 0 for write operation.
* Send START condition and select slave for write.
* \c id is the device id comprehensive of address left shifted by 1.
* The LSB of \c id is ignored and reset to 0 for write operation.
@@
-104,7
+110,7
@@
bool twi_start_w(uint8_t id)
}
}
-/*
!
+/*
*
* Send START condition and select slave for read.
* \c id is the device id comprehensive of address left shifted by 1.
* The LSB of \c id is ignored and set to 1 for read operation.
* Send START condition and select slave for read.
* \c id is the device id comprehensive of address left shifted by 1.
* The LSB of \c id is ignored and set to 1 for read operation.
@@
-129,7
+135,7
@@
bool twi_start_r(uint8_t id)
}
}
-/*
!
+/*
*
* Send STOP condition.
*/
void twi_stop(void)
* Send STOP condition.
*/
void twi_stop(void)
@@
-138,7
+144,7
@@
void twi_stop(void)
}
}
-/*
!
+/*
*
* Put a single byte in master transmitter mode
* to the selected slave device through the TWI bus.
*
* Put a single byte in master transmitter mode
* to the selected slave device through the TWI bus.
*
@@
-158,7
+164,7
@@
bool twi_put(const uint8_t data)
}
}
-/*
!
+/*
*
* Send a sequence of bytes in master transmitter mode
* to the selected slave device through the TWI bus.
*
* Send a sequence of bytes in master transmitter mode
* to the selected slave device through the TWI bus.
*
@@
-177,7
+183,7
@@
bool twi_send(const void *_buf, size_t count)
}
}
-/*
!
+/*
*
* Receive a sequence of one or more bytes from the
* selected slave device in master receive mode through
* the TWI bus.
* Receive a sequence of one or more bytes from the
* selected slave device in master receive mode through
* the TWI bus.
@@
-222,7
+228,7
@@
bool twi_recv(void *_buf, size_t count)
}
}
-/*
!
+/*
*
* Initialize TWI module.
*/
void twi_init(void)
* Initialize TWI module.
*/
void twi_init(void)
@@
-235,12
+241,12
@@
void twi_init(void)
* probably due to some unwanted interaction between the
* port pin and the TWI lines.
*/
* probably due to some unwanted interaction between the
* port pin and the TWI lines.
*/
-#if
defined(__AVR_ATmega64__)
+#if
CPU_AVR_ATMEGA64 || CPU_AVR_ATMEGA128 || CPU_AVR_ATMEGA1281
PORTD |= BV(PD0) | BV(PD1);
PORTD |= BV(PD0) | BV(PD1);
- DDRD |= BV(PD0) | BV(PD1);
-#elif
defined(__AVR_ATmega8__)
+ DDRD
|= BV(PD0) | BV(PD1);
+#elif
CPU_AVR_ATMEGA8
PORTC |= BV(PC4) | BV(PC5);
PORTC |= BV(PC4) | BV(PC5);
- DDRC |= BV(PC4) | BV(PC5);
+ DDRC
|= BV(PC4) | BV(PC5);
#else
#error Unsupported architecture
#endif
#else
#error Unsupported architecture
#endif