RTEMS
6.3
Toggle main menu visibility
Loading...
Searching...
No Matches
bsps
arm
stm32f4
include
bsp
i2c.h
Go to the documentation of this file.
1
6
7
/*
8
* Copyright (c) 2013 Christian Mauderer. All rights reserved.
9
*
10
* The license and distribution terms for this file may be
11
* found in the file LICENSE in this distribution or at
12
* http://www.rtems.org/license/LICENSE.
13
*/
14
15
/* The I2C-module can not run with libi2c. The reason for this is, that libi2c
16
* needs a possibility to generate a stop condition separately. This controller
17
* wants to generate the condition automatically when sending or receiving data.
18
*/
19
20
#ifndef LIBBSP_ARM_STM32F4_I2C_H
21
#define LIBBSP_ARM_STM32F4_I2C_H
22
23
#include <
rtems.h
>
24
25
#include <bsp/io.h>
26
#include <
bsp/stm32f4.h
>
27
28
#ifdef __cplusplus
29
extern
"C"
{
30
#endif
/* __cplusplus */
31
38
39
typedef
struct
{
44
uint16_t
addr
;
46
bool
read
;
48
size_t
len
;
50
uint8_t *
buf
;
51
}
stm32f4_i2c_message
;
52
53
typedef
struct
{
54
volatile
stm32f4_i2c
*regs;
55
size_t
index;
56
rtems_vector_number
vector;
57
rtems_id
mutex;
58
rtems_id
task_id;
59
uint8_t *data;
60
uint8_t *last;
61
size_t
len;
62
bool
read;
63
uint8_t addr_with_rw;
64
}
stm32f4_i2c_bus_entry
;
65
67
rtems_status_code
stm32f4_i2c_init
(
stm32f4_i2c_bus_entry
*
e
);
68
70
rtems_status_code
stm32f4_i2c_process_message
(
71
stm32f4_i2c_bus_entry
*
e
,
72
stm32f4_i2c_message
*
msg
73
);
74
76
rtems_status_code
stm32f4_i2c_set_bitrate
(
77
stm32f4_i2c_bus_entry
*
e
,
78
uint32_t br
79
);
80
81
extern
stm32f4_i2c_bus_entry
*
const
stm32f4_i2c1;
82
extern
stm32f4_i2c_bus_entry
*
const
stm32f4_i2c2;
83
85
86
#ifdef __cplusplus
87
}
88
#endif
/* __cplusplus */
89
90
#endif
/* LIBBSP_ARM_STM32F4_I2C_H */
rtems_vector_number
ISR_Vector_number rtems_vector_number
This integer type represents interrupt vector numbers.
Definition
intr.h:102
rtems_status_code
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition
status.h:85
rtems_id
Objects_Id rtems_id
This type represents RTEMS object identifiers.
Definition
types.h:94
stm32f4_i2c_process_message
rtems_status_code stm32f4_i2c_process_message(stm32f4_i2c_bus_entry *e, stm32f4_i2c_message *msg)
Process a i2c message.
Definition
i2c.c:263
stm32f4_i2c_init
rtems_status_code stm32f4_i2c_init(stm32f4_i2c_bus_entry *e)
Initialise the i2c module.
Definition
i2c.c:210
stm32f4_i2c_set_bitrate
rtems_status_code stm32f4_i2c_set_bitrate(stm32f4_i2c_bus_entry *e, uint32_t br)
Set another baud rate than the default one.
Definition
i2c.c:44
rtems.h
This header file defines the RTEMS Classic API.
stm32f4.h
Register definitions.
msg
Definition
b1553brm.c:94
stm32f4_i2c_bus_entry
Definition
i2c.h:53
stm32f4_i2c_message
Definition
i2c.h:39
stm32f4_i2c_message::addr
uint16_t addr
The address of the slave without the read write bit. A 7-Bit address should be placed in the bits [6....
Definition
i2c.h:44
stm32f4_i2c_message::buf
uint8_t * buf
Buffer for data.
Definition
i2c.h:50
stm32f4_i2c_message::len
size_t len
Size of data to read or write.
Definition
i2c.h:48
stm32f4_i2c_message::read
bool read
Read (true) or write (false) data.
Definition
i2c.h:46
stm32f4_i2c
Definition
stm32_i2c.h:27
e
unsigned e
Definition
tlb.h:13
Generated by
1.18.0