summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoey Castillo <jose.castillo@gmail.com>2021-08-04 12:03:54 -0400
committerJoey Castillo <jose.castillo@gmail.com>2021-08-04 12:09:33 -0400
commit15050f8ace8b514f21ea3bbb29a8585ea349917c (patch)
tree9b8164c479cd05a3498818b95ca984afeee50d1c
parent99942154f70da83a1b3c3c624166a03ca5c5e886 (diff)
downloadSensor-Watch-15050f8ace8b514f21ea3bbb29a8585ea349917c.tar.gz
Sensor-Watch-15050f8ace8b514f21ea3bbb29a8585ea349917c.tar.bz2
Sensor-Watch-15050f8ace8b514f21ea3bbb29a8585ea349917c.zip
drop legacy terminology. how hard was that?
-rw-r--r--watch-library/hal/include/hal_i2c_m_sync.h44
-rw-r--r--watch-library/hal/src/hal_i2c_m_sync.c14
-rw-r--r--watch-library/watch/watch.c4
3 files changed, 31 insertions, 31 deletions
diff --git a/watch-library/hal/include/hal_i2c_m_sync.h b/watch-library/hal/include/hal_i2c_m_sync.h
index 24afd639..f7772483 100644
--- a/watch-library/hal/include/hal_i2c_m_sync.h
+++ b/watch-library/hal/include/hal_i2c_m_sync.h
@@ -42,7 +42,7 @@ extern "C" {
#endif
/**
- * \addtogroup doc_driver_hal_i2c_master_sync
+ * \addtogroup doc_driver_hal_i2c_controller_sync
*
* @{
*/
@@ -55,7 +55,7 @@ extern "C" {
struct i2c_m_sync_desc {
struct _i2c_m_sync_device device;
struct io_descriptor io;
- uint16_t slave_addr;
+ uint16_t periph_addr;
};
/**
@@ -90,19 +90,19 @@ int32_t i2c_m_sync_init(struct i2c_m_sync_desc *i2c, void *hw);
int32_t i2c_m_sync_deinit(struct i2c_m_sync_desc *i2c);
/**
- * \brief Set the slave device address
+ * \brief Set the peripheral device address
*
- * This function sets the next transfer target slave I2C device address.
+ * This function sets the next transfer target peripheral I2C device address.
* It takes no effect to any already started access.
*
* \param[in] i2c An I2C descriptor, which is used to communicate through I2C
- * \param[in] addr The slave address to access
- * \param[in] addr_len The slave address length, can be I2C_M_TEN or I2C_M_SEVEN
+ * \param[in] addr The peripheral address to access
+ * \param[in] addr_len The peripheral address length, can be I2C_M_TEN or I2C_M_SEVEN
*
- * \return Masked slave address. The mask is a maximum 10-bit address, and 10th
+ * \return Masked peripheral address. The mask is a maximum 10-bit address, and 10th
* bit is set if a 10-bit address is used
*/
-int32_t i2c_m_sync_set_slaveaddr(struct i2c_m_sync_desc *i2c, int16_t addr, int32_t addr_len);
+int32_t i2c_m_sync_set_periphaddr(struct i2c_m_sync_desc *i2c, int16_t addr, int32_t addr_len);
/**
* \brief Set baudrate
@@ -112,7 +112,7 @@ int32_t i2c_m_sync_set_slaveaddr(struct i2c_m_sync_desc *i2c, int16_t addr, int3
*
* \param[in] i2c An I2C descriptor, which is used to communicate through I2C
* \param[in] clkrate Unused parameter. Should always be 0
- * \param[in] baudrate The baudrate value set to master
+ * \param[in] baudrate The baudrate value set to controller
*
* \return Whether successfully set the baudrate
* \retval -1 The passed parameters were invalid or the device is already enabled
@@ -147,18 +147,18 @@ int32_t i2c_m_sync_enable(struct i2c_m_sync_desc *i2c);
int32_t i2c_m_sync_disable(struct i2c_m_sync_desc *i2c);
/**
- * \brief Sync version of write command to I2C slave
+ * \brief Sync version of write command to I2C peripheral
*
- * This function will write the value to a specified register in the I2C slave device and
+ * This function will write the value to a specified register in the I2C peripheral device and
* then wait for this operation to be done.
*
* The sequence of this routine is
* sta->address(write)->ack->reg address->ack->resta->address(write)->ack->reg value->nack->stt
*
* \param[in] i2c An I2C descriptor, which is used to communicate through I2C
- * \param[in] reg The internal address/register of the I2C slave device
- * \param[in] buffer The buffer holding data to write to the I2C slave device
- * \param[in] length The length (in bytes) to write to the I2C slave device
+ * \param[in] reg The internal address/register of the I2C peripheral device
+ * \param[in] buffer The buffer holding data to write to the I2C peripheral device
+ * \param[in] length The length (in bytes) to write to the I2C peripheral device
*
* \return Whether successfully write to the device
* \retval <0 The passed parameters were invalid or write fail
@@ -167,18 +167,18 @@ int32_t i2c_m_sync_disable(struct i2c_m_sync_desc *i2c);
int32_t i2c_m_sync_cmd_write(struct i2c_m_sync_desc *i2c, uint8_t reg, uint8_t *buffer, uint8_t length);
/**
- * \brief Sync version of read register value from I2C slave
+ * \brief Sync version of read register value from I2C peripheral
*
- * This function will read a byte value from a specified register in the I2C slave device and
+ * This function will read a byte value from a specified register in the I2C peripheral device and
* then wait for this operation to be done.
*
* The sequence of this routine is
* sta->address(write)->ack->reg address->ack->resta->address(read)->ack->reg value->nack->stt
*
* \param[in] i2c An I2C descriptor, which is used to communicate through I2C
- * \param[in] reg The internal address/register of the I2C slave device
- * \param[in] buffer The buffer to hold the read data from the I2C slave device
- * \param[in] length The length (in bytes) to read from the I2C slave device
+ * \param[in] reg The internal address/register of the I2C peripheral device
+ * \param[in] buffer The buffer to hold the read data from the I2C peripheral device
+ * \param[in] length The length (in bytes) to read from the I2C peripheral device
*
* \return Whether successfully read from the device
* \retval <0 The passed parameters were invalid or read fail
@@ -187,10 +187,10 @@ int32_t i2c_m_sync_cmd_write(struct i2c_m_sync_desc *i2c, uint8_t reg, uint8_t *
int32_t i2c_m_sync_cmd_read(struct i2c_m_sync_desc *i2c, uint8_t reg, uint8_t *buffer, uint8_t length);
/**
- * \brief Sync version of transfer message to/from the I2C slave
+ * \brief Sync version of transfer message to/from the I2C peripheral
*
- * This function will transfer a message between the I2C slave and the master. This function will wait for the operation
- * to be done.
+ * This function will transfer a message between the I2C peripheral and the controller.
+ * This function will wait for the operation to be done.
*
* \param[in] i2c An I2C descriptor, which is used to communicate through I2C
* \param[in] msg An i2c_m_msg struct
diff --git a/watch-library/hal/src/hal_i2c_m_sync.c b/watch-library/hal/src/hal_i2c_m_sync.c
index 30821a27..9be16be4 100644
--- a/watch-library/hal/src/hal_i2c_m_sync.c
+++ b/watch-library/hal/src/hal_i2c_m_sync.c
@@ -48,7 +48,7 @@ static int32_t i2c_m_sync_read(struct io_descriptor *io, uint8_t *buf, const uin
struct _i2c_m_msg msg;
int32_t ret;
- msg.addr = i2c->slave_addr;
+ msg.addr = i2c->periph_addr;
msg.len = n;
msg.flags = I2C_M_STOP | I2C_M_RD;
msg.buffer = buf;
@@ -71,7 +71,7 @@ static int32_t i2c_m_sync_write(struct io_descriptor *io, const uint8_t *buf, co
struct _i2c_m_msg msg;
int32_t ret;
- msg.addr = i2c->slave_addr;
+ msg.addr = i2c->periph_addr;
msg.len = n;
msg.flags = I2C_M_STOP;
msg.buffer = (uint8_t *)buf;
@@ -141,11 +141,11 @@ int32_t i2c_m_sync_disable(struct i2c_m_sync_desc *i2c)
}
/**
- * \brief Sync version of i2c set slave address
+ * \brief Sync version of i2c set peripheral address
*/
-int32_t i2c_m_sync_set_slaveaddr(struct i2c_m_sync_desc *i2c, int16_t addr, int32_t addr_len)
+int32_t i2c_m_sync_set_periphaddr(struct i2c_m_sync_desc *i2c, int16_t addr, int32_t addr_len)
{
- return i2c->slave_addr = (addr & 0x3ff) | (addr_len & I2C_M_TEN);
+ return i2c->periph_addr = (addr & 0x3ff) | (addr_len & I2C_M_TEN);
}
/**
@@ -164,7 +164,7 @@ int32_t i2c_m_sync_cmd_write(struct i2c_m_sync_desc *i2c, uint8_t reg, uint8_t *
struct _i2c_m_msg msg;
int32_t ret;
- msg.addr = i2c->slave_addr;
+ msg.addr = i2c->periph_addr;
msg.len = 1;
msg.flags = 0;
msg.buffer = &reg;
@@ -198,7 +198,7 @@ int32_t i2c_m_sync_cmd_read(struct i2c_m_sync_desc *i2c, uint8_t reg, uint8_t *b
struct _i2c_m_msg msg;
int32_t ret;
- msg.addr = i2c->slave_addr;
+ msg.addr = i2c->periph_addr;
msg.len = 1;
msg.flags = 0;
msg.buffer = &reg;
diff --git a/watch-library/watch/watch.c b/watch-library/watch/watch.c
index ffb7d446..484cfada 100644
--- a/watch-library/watch/watch.c
+++ b/watch-library/watch/watch.c
@@ -358,12 +358,12 @@ void watch_enable_i2c() {
}
void watch_i2c_send(int16_t addr, uint8_t *buf, uint16_t length) {
- i2c_m_sync_set_slaveaddr(&I2C_0, addr, I2C_M_SEVEN);
+ i2c_m_sync_set_periphaddr(&I2C_0, addr, I2C_M_SEVEN);
io_write(I2C_0_io, buf, length);
}
void watch_i2c_receive(int16_t addr, uint8_t *buf, uint16_t length) {
- i2c_m_sync_set_slaveaddr(&I2C_0, addr, I2C_M_SEVEN);
+ i2c_m_sync_set_periphaddr(&I2C_0, addr, I2C_M_SEVEN);
io_read(I2C_0_io, buf, length);
}