Skip to content

Commit

Permalink
twi: hal improvements #25
Browse files Browse the repository at this point in the history
  • Loading branch information
jnaulet committed Apr 29, 2023
1 parent 71e9d08 commit 8e6a0d1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions drivers/include/twi.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ typedef enum {

typedef uint16_t twi_addr_t;

/* Constants: TWI R/W
*
* TWI_WRITE - Twi write command (0)
* TWI_READ - Twi read command (1)
*/
#define TWI_WRITE 0
#define TWI_READ 1

/* Constants: TWI addresses
*
* TWI_ADDR_GENERAL - General call address (0)
Expand All @@ -62,6 +70,17 @@ struct twi_settings {
*/
int twi_setup(struct twi *ctx, struct twi_settings *settings);

/* Function: twi_poll
* Polls TWI interface for transfer (slave mode)
*
* Paramters:
* ctx - A TWI instance
*
* Returns:
* TWI_READ if a read is recv, TWI_WRITE if write is recv, -errno otherwise
*/
int twi_poll(struct twi *ctx);

/* Function: twi_write
* Write data to a TWI interface
*
Expand Down

0 comments on commit 8e6a0d1

Please sign in to comment.