• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Generic i2c ops
3  *
4  * These ops always appear first in an implementation-specific
5  * object, so the generic ops can be cast to the implementation-
6  * specific object in the handlers.
7  *
8  * Written in 2010-2020 by Andy Green <andy@warmcat.com>
9  *
10  * This file is made available under the Creative Commons CC0 1.0
11  * Universal Public Domain Dedication.
12  */
13 
14 #if !defined(__LWS_I2C_H__)
15 #define __LWS_I2C_H__
16 
17 #include <stdint.h>
18 #include <stddef.h>
19 
20 typedef struct lws_i2c_ops {
21 	int  (*start)(struct lws_i2c_ops *ctx);
22 	void (*stop)(struct lws_i2c_ops *ctx);
23 	int  (*write)(struct lws_i2c_ops *ctx, uint8_t data);
24 	int  (*read)(struct lws_i2c_ops *ctx);
25 	void (*set_ack)(struct lws_i2c_ops *octx, int ack);
26 } lws_i2c_ops_t;
27 
28 int
29 lws_i2c_command(lws_i2c_ops_t *ctx, uint8_t ads, uint8_t c);
30 
31 int
32 lws_i2c_command_list(lws_i2c_ops_t *ctx, uint8_t ads, const uint8_t *buf, size_t len);
33 
34 #endif
35 
36