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 {
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 }
void i2cInit(I2CDevice index)
Definition: drv_i2c.c:420
#define printf
Definition: printf.h:119
void loop(void)
Definition: i2csniff.c:33
bool i2cWrite(uint8_t addr_, uint8_t reg_, uint8_t data)
Definition: drv_i2c.c:152
void setup(void)
Definition: i2csniff.c:28
static volatile uint8_t addr
Definition: drv_i2c.c:95
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