aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/AVR/MEGA/LLD/I2Cv1/hal_i2c_lld.c
diff options
context:
space:
mode:
authorTheodore Ateba <tf.ateba@gmail.com>2018-01-20 22:33:54 +0000
committerTheodore Ateba <tf.ateba@gmail.com>2018-01-20 22:33:54 +0000
commit282bc3a8f0c8357737dda060c24abb439763ffd6 (patch)
treee88d9a5b4ae6ab463a7fc42c47ebb290b240597c /os/hal/ports/AVR/MEGA/LLD/I2Cv1/hal_i2c_lld.c
parent386f0d66f7aa1df1e62ec3a95f10d6c70693a9a4 (diff)
downloadChibiOS-282bc3a8f0c8357737dda060c24abb439763ffd6.tar.gz
ChibiOS-282bc3a8f0c8357737dda060c24abb439763ffd6.tar.bz2
ChibiOS-282bc3a8f0c8357737dda060c24abb439763ffd6.zip
AVR: Cleanup code source.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11377 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/ports/AVR/MEGA/LLD/I2Cv1/hal_i2c_lld.c')
-rw-r--r--os/hal/ports/AVR/MEGA/LLD/I2Cv1/hal_i2c_lld.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/os/hal/ports/AVR/MEGA/LLD/I2Cv1/hal_i2c_lld.c b/os/hal/ports/AVR/MEGA/LLD/I2Cv1/hal_i2c_lld.c
index 3052ffdbf..907a3b1a7 100644
--- a/os/hal/ports/AVR/MEGA/LLD/I2Cv1/hal_i2c_lld.c
+++ b/os/hal/ports/AVR/MEGA/LLD/I2Cv1/hal_i2c_lld.c
@@ -26,30 +26,30 @@
#if HAL_USE_I2C || defined(__DOXYGEN__)
-/*===========================================================================*/
-/* Driver local definitions. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver local definitions. */
+/*==========================================================================*/
-/*===========================================================================*/
-/* Driver exported variables. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver exported variables. */
+/*==========================================================================*/
-/** @brief I2C driver identifier.*/
+/** @brief I2C driver identifier. */
#if AVR_I2C_USE_I2C1 || defined(__DOXYGEN__)
I2CDriver I2CD1;
#endif
-/*===========================================================================*/
-/* Driver local variables and types. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver local variables and types. */
+/*==========================================================================*/
-/*===========================================================================*/
-/* Driver local functions. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver local functions. */
+/*==========================================================================*/
-/*===========================================================================*/
-/* Driver interrupt handlers. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver interrupt handlers. */
+/*==========================================================================*/
#if AVR_I2C_USE_I2C1 || defined(__DOXYGEN__)
/**
@@ -120,7 +120,7 @@ OSAL_IRQ_HANDLER(TWI_vect) {
i2cp->errors |= I2C_BUS_ERROR;
break;
default:
- /* FIXME: only gets here if there are other MASTERs in the bus */
+ /* FIXME: only gets here if there are other MASTERs in the bus. */
TWCR = ((1 << TWSTO) | (1 << TWINT) | (1 << TWEN));
_i2c_wakeup_error_isr(i2cp);
}
@@ -134,9 +134,9 @@ OSAL_IRQ_HANDLER(TWI_vect) {
}
#endif /* AVR_I2C_USE_I2C1 */
-/*===========================================================================*/
-/* Driver exported functions. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver exported functions. */
+/*==========================================================================*/
/**
* @brief Low level I2C driver initialization.
@@ -160,15 +160,15 @@ void i2c_lld_start(I2CDriver *i2cp) {
uint32_t clock_speed = 100000;
- /* TODO: Test TWI without external pull-ups (use internal) */
+ /* TODO: Test TWI without external pull-ups (use internal). */
- /* Configure prescaler to 1 */
+ /* Configure prescaler to 1. */
TWSR &= 0xF8;
if (i2cp->config != NULL)
clock_speed = i2cp->config->clock_speed;
- /* Configure baudrate */
+ /* Configure baudrate. */
TWBR = ((F_CPU / clock_speed) - 16) / 2;
}
@@ -182,7 +182,7 @@ void i2c_lld_start(I2CDriver *i2cp) {
void i2c_lld_stop(I2CDriver *i2cp) {
if (i2cp->state != I2C_STOP) {
- /* Disable TWI subsystem and stop all operations */
+ /* Disable TWI subsystem and stop all operations. */
TWCR &= ~(1 << TWEN);
}
}
@@ -196,7 +196,7 @@ void i2c_lld_stop(I2CDriver *i2cp) {
* @param[in] rxbytes number of bytes to be received
* @param[in] timeout the number of ticks before the operation timeouts,
* the following special values are allowed:
- * - @a TIME_INFINITE no timeout.
+ * - @a TIME_INFINITE no timeout
*
* @return The operation status.
* @retval MSG_OK if the function succeeded.
@@ -221,7 +221,7 @@ msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr,
i2cp->rxbytes = rxbytes;
i2cp->rxidx = 0;
- /* Send START */
+ /* Send START. */
TWCR = ((1 << TWSTA) | (1 << TWINT) | (1 << TWEN) | (1 << TWIE));
return osalThreadSuspendTimeoutS(&i2cp->thread, TIME_INFINITE);
@@ -238,7 +238,7 @@ msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr,
* @param[in] rxbytes number of bytes to be received
* @param[in] timeout the number of ticks before the operation timeouts,
* the following special values are allowed:
- * - @a TIME_INFINITE no timeout.
+ * - @a TIME_INFINITE no timeout
*
* @return The operation status.
* @retval MSG_OK if the function succeeded.