mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-06 16:58:48 +08:00
[i2c] convenience functions return i2c_submit success
This commit is contained in:
@@ -69,32 +69,32 @@ void i2c_init(struct i2c_periph* p) {
|
||||
}
|
||||
|
||||
|
||||
void i2c_transmit(struct i2c_periph* p, struct i2c_transaction* t,
|
||||
bool_t i2c_transmit(struct i2c_periph* p, struct i2c_transaction* t,
|
||||
uint8_t s_addr, uint8_t len)
|
||||
{
|
||||
t->type = I2CTransTx;
|
||||
t->slave_addr = s_addr;
|
||||
t->len_w = len;
|
||||
t->len_r = 0;
|
||||
i2c_submit(p, t);
|
||||
return i2c_submit(p, t);
|
||||
}
|
||||
|
||||
void i2c_receive(struct i2c_periph* p, struct i2c_transaction* t,
|
||||
bool_t i2c_receive(struct i2c_periph* p, struct i2c_transaction* t,
|
||||
uint8_t s_addr, uint16_t len)
|
||||
{
|
||||
t->type = I2CTransRx;
|
||||
t->slave_addr = s_addr;
|
||||
t->len_w = 0;
|
||||
t->len_r = len;
|
||||
i2c_submit(p, t);
|
||||
return i2c_submit(p, t);
|
||||
}
|
||||
|
||||
void i2c_transceive(struct i2c_periph* p, struct i2c_transaction* t,
|
||||
bool_t i2c_transceive(struct i2c_periph* p, struct i2c_transaction* t,
|
||||
uint8_t s_addr, uint8_t len_w, uint16_t len_r)
|
||||
{
|
||||
t->type = I2CTransTxRx;
|
||||
t->slave_addr = s_addr;
|
||||
t->len_w = len_w;
|
||||
t->len_r = len_r;
|
||||
i2c_submit(p, t);
|
||||
return i2c_submit(p, t);
|
||||
}
|
||||
|
||||
@@ -176,15 +176,17 @@ extern void i2c_event(void);
|
||||
* Convenience functions.
|
||||
* Usually these are preferred over i2c_submit,
|
||||
* as they explicitly set the transaction type again.
|
||||
*
|
||||
* Return FALSE if submitting the transaction failed.
|
||||
*/
|
||||
extern void i2c_transmit(struct i2c_periph* p, struct i2c_transaction* t,
|
||||
uint8_t s_addr, uint8_t len);
|
||||
extern bool_t i2c_transmit(struct i2c_periph* p, struct i2c_transaction* t,
|
||||
uint8_t s_addr, uint8_t len);
|
||||
|
||||
extern void i2c_receive(struct i2c_periph* p, struct i2c_transaction* t,
|
||||
uint8_t s_addr, uint16_t len);
|
||||
extern bool_t i2c_receive(struct i2c_periph* p, struct i2c_transaction* t,
|
||||
uint8_t s_addr, uint16_t len);
|
||||
|
||||
extern void i2c_transceive(struct i2c_periph* p, struct i2c_transaction* t,
|
||||
uint8_t s_addr, uint8_t len_w, uint16_t len_r);
|
||||
extern bool_t i2c_transceive(struct i2c_periph* p, struct i2c_transaction* t,
|
||||
uint8_t s_addr, uint8_t len_w, uint16_t len_r);
|
||||
|
||||
/** @}*/
|
||||
/** @}*/
|
||||
|
||||
Reference in New Issue
Block a user