Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
firmware
boards
breezy
breezystm32
examples
i2csniff
i2csniff.c
Go to the documentation of this file.
1
/*
2
i2sniff.c : sniff and report I^2C devices
3
4
Copyright (C) 2016 Simon D. Levy
5
6
Adapted from https://github.com/multiwii/baseflight/blob/master/src/drv_adc.c
7
8
Don't forget to supply external power for external sensors (like MB1242 sonar)!
9
10
This file is part of BreezySTM32.
11
12
BreezySTM32 is free software: you can redistribute it and/or modify
13
it under the terms of the GNU General Public License as published by
14
the Free Software Foundation, either version 3 of the License, or
15
(at your option) any later version.
16
17
BreezySTM32 is distributed in the hope that it will be useful,
18
but WITHOUT ANY WARRANTY; without even the implied warranty of
19
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
GNU General Public License for more details.
21
22
You should have received a copy of the GNU General Public License
23
along with BreezySTM32. If not, see <http://www.gnu.org/licenses/>.
24
*/
25
26
#include <
breezystm32.h
>
27
28
void
setup
(
void
)
29
{
30
i2cInit
(
I2CDEV_2
);
31
}
32
33
void
loop
(
void
)
34
{
35
uint8_t
addr
;
36
37
for
(addr=0; addr<128; ++
addr
)
38
if
(
i2cWrite
(addr, 0x00, 0x00))
39
printf
(
"Found device at address 0X%02X\n"
, addr);
40
41
printf
(
"--------------------------\n"
);
42
43
delay
(1000);
44
}
i2cInit
void i2cInit(I2CDevice index)
Definition:
drv_i2c.c:420
printf
#define printf
Definition:
printf.h:119
loop
void loop(void)
Definition:
i2csniff.c:33
i2cWrite
bool i2cWrite(uint8_t addr_, uint8_t reg_, uint8_t data)
Definition:
drv_i2c.c:152
setup
void setup(void)
Definition:
i2csniff.c:28
addr
static volatile uint8_t addr
Definition:
drv_i2c.c:95
breezystm32.h
I2CDEV_2
Definition:
drv_i2c.h:26
delay
void delay(uint32_t ms)
Definition:
system.c:98
rosflight_firmware
Author(s): Daniel Koch
, James Jackson
autogenerated on Wed Jul 3 2019 19:59:24