libyggdrasil  v1.0.0
i2c.h
Go to the documentation of this file.
1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * _____.___. .___ .__.__ *
3  * \__ | | ____ ____ __| _/___________ _____|__| | *
4  * / | |/ ___\ / ___\ / __ |\_ __ \__ \ / ___/ | | *
5  * \____ / /_/ > /_/ > /_/ | | | \// __ \_\___ \| | |__ *
6  * / ______\___ /\___ /\____ | |__| (____ /____ >__|____/ *
7  * \/ /_____//_____/ \/ \/ \/ *
8  * - Midgard - *
9  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
10  * This software can be used by students and other personal of the *
11  * Bern University of Applied Sciences under the terms of the MIT *
12  * license. *
13  * For other persons this software is under the terms of the GNU *
14  * General Public License version 2. *
15  * *
16  * Copyright © 2021, Bern University of Applied Sciences. *
17  * All rights reserved. *
18  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
26 #include <c/common/types.h>
27 
28 #include <stm32f7xx_hal.h>
29 
33 typedef struct {
34  I2C_HandleTypeDef *interface;
35 } i2c_t;
36 
44 
52 
61 C_LINKAGE void yggdrasil_I2C_Write(i2c_t i2c, u8 address, void *data, size_t size);
62 
72 C_LINKAGE void yggdrasil_I2C_WriteRegister(i2c_t i2c, u8 address, u8 reg, void *data, size_t size);
81 C_LINKAGE void yggdrasil_I2C_Read(i2c_t i2c, u8 address, void *data, size_t size);
82 
92 C_LINKAGE void yggdrasil_I2C_ReadRegister(i2c_t i2c, u8 address, u8 reg, void *data, size_t size);
93 
94 
95 
i2c_t::interface
I2C_HandleTypeDef * interface
Definition: i2c.h:34
types.h
Commonly used type definitions and helper templates.
yggdrasil_I2C_WriteRegister
C_LINKAGE void yggdrasil_I2C_WriteRegister(i2c_t i2c, u8 address, u8 reg, void *data, size_t size)
I2C write register.
Definition: i2c.cpp:61
u8
uint8_t u8
Unsigned integer definitions.
Definition: types.h:36
yggdrasil_I2C_Deinit
C_LINKAGE bool yggdrasil_I2C_Deinit(i2c_t i2c)
I2C deinitialization.
Definition: i2c.cpp:51
yggdrasil_I2C_Write
C_LINKAGE void yggdrasil_I2C_Write(i2c_t i2c, u8 address, void *data, size_t size)
I2C write.
Definition: i2c.cpp:56
yggdrasil_I2C_ReadRegister
C_LINKAGE void yggdrasil_I2C_ReadRegister(i2c_t i2c, u8 address, u8 reg, void *data, size_t size)
I2C read register.
Definition: i2c.cpp:74
yggdrasil_I2C_Read
C_LINKAGE void yggdrasil_I2C_Read(i2c_t i2c, u8 address, void *data, size_t size)
I2C read.
Definition: i2c.cpp:69
i2c_t
I2C handle type.
Definition: i2c.h:31
yggdrasil_I2C_Init
C_LINKAGE bool yggdrasil_I2C_Init(i2c_t i2c)
I2C initialization.
Definition: i2c.cpp:46
C_LINKAGE
#define C_LINKAGE
Definition: attributes.h:43