Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
i2c_arch.c
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2012 The Paparazzi Team
3
*
4
* This file is part of paparazzi.
5
*
6
* paparazzi is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2, or (at your option)
9
* any later version.
10
*
11
* paparazzi is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with paparazzi; see the file COPYING. If not, write to
18
* the Free Software Foundation, 59 Temple Place - Suite 330,
19
* Boston, MA 02111-1307, USA.
20
*/
21
27
#include "
mcu_periph/i2c.h
"
28
29
30
static
bool
__attribute__((unused))
i2c_sim_idle
(
struct
i2c_periph
*
p
__attribute__((unused))) {
return
true
; }
31
static
bool
__attribute__((unused))
i2c_sim_submit
(
struct
i2c_periph
*
p
__attribute__((unused)),
struct
i2c_transaction
*t __attribute__((unused))) {
return
true
;}
32
static
void
__attribute__((unused))
i2c_sim_setbitrate
(
struct
i2c_periph
*
p
__attribute__((unused)),
int
bitrate __attribute__((unused))) { }
33
void
i2c_event
(
void
) { }
34
35
#if USE_I2C0
36
struct
i2c_errors
i2c0_errors;
37
38
void
i2c0_hw_init(
void
)
39
{
40
i2c0.idle =
i2c_sim_idle
;
41
i2c0.submit =
i2c_sim_submit
;
42
i2c0.setbitrate =
i2c_sim_setbitrate
;
43
i2c0.errors = &i2c0_errors;
44
ZEROS_ERR_COUNTER
(i2c0_errors);
45
}
46
47
#endif
48
49
#if USE_I2C1
50
struct
i2c_errors
i2c1_errors;
51
52
void
i2c1_hw_init(
void
)
53
{
54
i2c1.idle =
i2c_sim_idle
;
55
i2c1.submit =
i2c_sim_submit
;
56
i2c1.setbitrate =
i2c_sim_setbitrate
;
57
i2c1.errors = &i2c1_errors;
58
ZEROS_ERR_COUNTER
(i2c1_errors);
59
}
60
61
#endif
62
63
#if USE_I2C2
64
struct
i2c_errors
i2c2_errors;
65
66
void
i2c2_hw_init(
void
)
67
{
68
i2c2.idle =
i2c_sim_idle
;
69
i2c2.submit =
i2c_sim_submit
;
70
i2c2.setbitrate =
i2c_sim_setbitrate
;
71
i2c2.errors = &i2c2_errors;
72
ZEROS_ERR_COUNTER
(i2c2_errors);
73
}
74
75
#endif
i2c_event
void i2c_event(void)
i2c_event() function
Definition:
i2c_arch.c:428
i2c_errors
I2C errors counter.
Definition:
i2c.h:165
i2c_transaction
I2C transaction structure.
Definition:
i2c.h:93
i2c_sim_idle
static bool i2c_sim_idle(struct i2c_periph *p)
Definition:
i2c_arch.c:30
i2c_sim_submit
static bool i2c_sim_submit(struct i2c_periph *p, struct i2c_transaction *t)
Definition:
i2c_arch.c:31
ZEROS_ERR_COUNTER
#define ZEROS_ERR_COUNTER(_i2c_err)
Definition:
i2c.h:181
i2c_sim_setbitrate
static void i2c_sim_setbitrate(struct i2c_periph *p, int bitrate)
Definition:
i2c_arch.c:32
i2c_periph
Definition:
i2c.h:144
i2c.h
p
static float p[2][2]
Definition:
ins_alt_float.c:268
sw
airborne
arch
sim
mcu_periph
i2c_arch.c
Generated on Tue Feb 1 2022 13:51:12 for Paparazzi UAS by
1.8.17