aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/AVR/MEGA/LLD/I2Cv1
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/ports/AVR/MEGA/LLD/I2Cv1')
-rw-r--r--os/hal/ports/AVR/MEGA/LLD/I2Cv1/hal_i2c_lld.c54
-rw-r--r--os/hal/ports/AVR/MEGA/LLD/I2Cv1/hal_i2c_lld.h62
2 files changed, 58 insertions, 58 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.
diff --git a/os/hal/ports/AVR/MEGA/LLD/I2Cv1/hal_i2c_lld.h b/os/hal/ports/AVR/MEGA/LLD/I2Cv1/hal_i2c_lld.h
index 5afec3382..b1a663022 100644
--- a/os/hal/ports/AVR/MEGA/LLD/I2Cv1/hal_i2c_lld.h
+++ b/os/hal/ports/AVR/MEGA/LLD/I2Cv1/hal_i2c_lld.h
@@ -27,40 +27,40 @@
#if HAL_USE_I2C || defined(__DOXYGEN__)
-/*===========================================================================*/
-/* Driver constants. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver constants. */
+/*==========================================================================*/
-/** @brief START transmitted.*/
+/** @brief START transmitted. */
#define TWI_START 0x08
-/** @brief Repeated START transmitted.*/
+/** @brief Repeated START transmitted. */
#define TWI_REPEAT_START 0x10
-/** @brief Arbitration Lost.*/
+/** @brief Arbitration Lost. */
#define TWI_ARBITRATION_LOST 0x38
-/** @brief Bus errors.*/
+/** @brief Bus errors. */
#define TWI_BUS_ERROR 0x00
-/** @brief SLA+W transmitted with ACK response.*/
+/** @brief SLA+W transmitted with ACK response. */
#define TWI_MASTER_TX_ADDR_ACK 0x18
-/** @brief SLA+W transmitted with NACK response.*/
+/** @brief SLA+W transmitted with NACK response. */
#define TWI_MASTER_TX_ADDR_NACK 0x20
-/** @brief DATA transmitted with ACK response.*/
+/** @brief DATA transmitted with ACK response. */
#define TWI_MASTER_TX_DATA_ACK 0x28
-/** @brief DATA transmitted with NACK response.*/
+/** @brief DATA transmitted with NACK response. */
#define TWI_MASTER_TX_DATA_NACK 0x30
-/** @brief SLA+R transmitted with ACK response.*/
+/** @brief SLA+R transmitted with ACK response. */
#define TWI_MASTER_RX_ADDR_ACK 0x40
-/** @brief SLA+R transmitted with NACK response.*/
+/** @brief SLA+R transmitted with NACK response. */
#define TWI_MASTER_RX_ADDR_NACK 0x48
-/** @brief DATA received with ACK response.*/
+/** @brief DATA received with ACK response. */
#define TWI_MASTER_RX_DATA_ACK 0x50
-/** @brief DATA received with NACK response.*/
+/** @brief DATA received with NACK response. */
#define TWI_MASTER_RX_DATA_NACK 0x58
-/*===========================================================================*/
-/* Driver pre-compile time settings. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver pre-compile time settings. */
+/*==========================================================================*/
/**
* @name Configuration options
@@ -76,13 +76,13 @@
#endif
/** @} */
-/*===========================================================================*/
-/* Derived constants and error checks. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Derived constants and error checks. */
+/*==========================================================================*/
-/*===========================================================================*/
-/* Driver data structures and types. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver data structures and types. */
+/*==========================================================================*/
/**
* @brief Type representing I2C address.
@@ -133,7 +133,7 @@ struct I2CDriver {
#if defined(I2C_DRIVER_EXT_FIELDS)
I2C_DRIVER_EXT_FIELDS
#endif
- /* End of the mandatory fields.*/
+ /* End of the mandatory fields. */
/**
* @brief Thread waiting for I/O completion.
*/
@@ -173,9 +173,9 @@ struct I2CDriver {
*/
typedef struct I2CDriver I2CDriver;
-/*===========================================================================*/
-/* Driver macros. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver macros. */
+/*==========================================================================*/
/**
* @brief Get errors from I2C driver.
@@ -186,9 +186,9 @@ typedef struct I2CDriver I2CDriver;
*/
#define i2c_lld_get_errors(i2cp) ((i2cp)->errors)
-/*===========================================================================*/
-/* External declarations. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* External declarations. */
+/*==========================================================================*/
#if !defined(__DOXYGEN__)
#if AVR_I2C_USE_I2C1