dRonin
adbada4
dRonin firmware
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
pios_i2c_config.h
Go to the documentation of this file.
1
/*
2
* pios_i2c_config.h
3
*
4
* Created on: May 8, 2011
5
* Author: Michael Smith
6
*/
7
8
#ifndef PIOS_I2C_CONFIG_H_
9
#define PIOS_I2C_CONFIG_H_
10
14
#define I2C_CONFIG(_i2c, _scl_gpio, _scl_pin, _sda_gpio, _sda_pin) \
15
{ \
16
.regs = _i2c, \
17
.remap = GPIO_AF_ ## _i2c, \
18
.init = { \
19
.I2C_ClockSpeed = 400000,
/* bits/s */
\
20
.I2C_Mode = I2C_Mode_I2C, \
21
.I2C_DutyCycle = I2C_DutyCycle_2, \
22
.I2C_OwnAddress1 = 0, \
23
.I2C_Ack = I2C_Ack_Enable, \
24
.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit, \
25
}, \
26
.transfer_timeout_ms = 50, \
27
.scl = { \
28
.gpio = _scl_gpio, \
29
.init = { \
30
.GPIO_Pin = _scl_pin, \
31
.GPIO_Mode = GPIO_Mode_AF, \
32
.GPIO_Speed = GPIO_Speed_50MHz, \
33
.GPIO_OType = GPIO_OType_OD, \
34
.GPIO_PuPd = GPIO_PuPd_NOPULL, \
35
}, \
36
}, \
37
.sda = { \
38
.gpio = _sda_gpio, \
39
.init = { \
40
.GPIO_Pin = _sda_pin, \
41
.GPIO_Mode = GPIO_Mode_AF, \
42
.GPIO_Speed = GPIO_Speed_50MHz, \
43
.GPIO_OType = GPIO_OType_OD, \
44
.GPIO_PuPd = GPIO_PuPd_NOPULL, \
45
}, \
46
}, \
47
.event = { \
48
.flags = 0,
/* FIXME: check this */
\
49
.init = { \
50
.NVIC_IRQChannel = _i2c ## _EV_IRQn, \
51
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGHEST, \
52
.NVIC_IRQChannelSubPriority = 0, \
53
.NVIC_IRQChannelCmd = ENABLE, \
54
}, \
55
}, \
56
.error = { \
57
.flags = 0,
/* FIXME: check this */
\
58
.init = { \
59
.NVIC_IRQChannel = _i2c ## _ER_IRQn, \
60
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGHEST, \
61
.NVIC_IRQChannelSubPriority = 0, \
62
.NVIC_IRQChannelCmd = ENABLE, \
63
}, \
64
}, \
65
}
66
67
#endif
/* PIOS_I2C_CONFIG_H_ */
flight
PiOS
STM32F4xx
inc
pios_i2c_config.h
Generated by
1.8.6