OPTIGA Trust M  1.1.0
C++ library for Optiga Trust M Chip Security Controller
pal_i2c.h
Go to the documentation of this file.
1 
39 #ifndef _PAL_I2C_H_
40 #define _PAL_I2C_H_
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 #include "pal.h"
47 
49 #define PAL_I2C_EVENT_SUCCESS (0x0000)
50 #define PAL_I2C_EVENT_ERROR (0x0001)
52 #define PAL_I2C_EVENT_BUSY (0x0002)
54 
56 typedef struct pal_i2c
57 {
61  uint8_t slave_address;
66 
67 } pal_i2c_t;
68 
98 LIBRARY_EXPORTS pal_status_t pal_i2c_init(const pal_i2c_t * p_i2c_context);
99 
133 LIBRARY_EXPORTS pal_status_t pal_i2c_set_bitrate(const pal_i2c_t * p_i2c_context, uint16_t bitrate);
134 
170 LIBRARY_EXPORTS pal_status_t pal_i2c_write(pal_i2c_t * p_i2c_context, uint8_t * p_data, uint16_t length);
171 
204 LIBRARY_EXPORTS pal_status_t pal_i2c_read(pal_i2c_t * p_i2c_context, uint8_t * p_data, uint16_t length);
205 
233 LIBRARY_EXPORTS pal_status_t pal_i2c_deinit(const pal_i2c_t * p_i2c_context);
234 
235 #ifdef __cplusplus
236 }
237 #endif
238 
239 #endif /* _PAL_I2C_H_ */
240 
This file provides the prototype declarations of platform abstraction layer.
LIBRARY_EXPORTS pal_status_t pal_i2c_set_bitrate(const pal_i2c_t *p_i2c_context, uint16_t bitrate)
Sets the I2C Master bitrate.
Definition: pal_i2c_arduino.cpp:147
uint8_t slave_address
I2C slave address.
Definition: pal_i2c.h:61
void * upper_layer_event_handler
Pointer to store the callers handler.
Definition: pal_i2c.h:65
LIBRARY_EXPORTS pal_status_t pal_i2c_deinit(const pal_i2c_t *p_i2c_context)
De-initializes the I2C master.
Definition: pal_i2c_arduino.cpp:258
LIBRARY_EXPORTS pal_status_t pal_i2c_init(const pal_i2c_t *p_i2c_context)
Initializes the I2C master.
Definition: pal_i2c_arduino.cpp:132
PAL I2C context structure.
Definition: pal_i2c.h:56
LIBRARY_EXPORTS pal_status_t pal_i2c_write(pal_i2c_t *p_i2c_context, uint8_t *p_data, uint16_t length)
Writes on I2C bus.
Definition: pal_i2c_arduino.cpp:168
LIBRARY_EXPORTS pal_status_t pal_i2c_read(pal_i2c_t *p_i2c_context, uint8_t *p_data, uint16_t length)
Reads from I2C bus.
Definition: pal_i2c_arduino.cpp:206
void * p_upper_layer_ctx
Pointer to store the callers context information.
Definition: pal_i2c.h:63
struct pal_i2c pal_i2c_t
PAL I2C context structure.
void * p_i2c_hw_config
Pointer to I2C master platform specific context.
Definition: pal_i2c.h:59
uint16_t pal_status_t
PAL return status.
Definition: pal.h:60