From f1d3f298955eec396bcc1e791f3e6fbbb6c4c3e0 Mon Sep 17 00:00:00 2001 From: barthess Date: Wed, 7 Dec 2011 20:15:19 +0000 Subject: I2C. F1x testhal clean ups. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/i2c_dev@3575 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32F1xx/I2C/fake.c | 20 ++++++++++++++++++++ testhal/STM32F1xx/I2C/fake.h | 20 ++++++++++++++++++++ testhal/STM32F1xx/I2C/i2c_pns.c | 22 +++++++++++++++++++++- testhal/STM32F1xx/I2C/i2c_pns.h | 20 ++++++++++++++++++++ testhal/STM32F1xx/I2C/lis3.c | 25 ++++++++++++++++++++++--- testhal/STM32F1xx/I2C/lis3.h | 20 ++++++++++++++++++++ testhal/STM32F1xx/I2C/main.c | 37 +++++++++++++++++++------------------ testhal/STM32F1xx/I2C/main.h | 19 ------------------- testhal/STM32F1xx/I2C/tmp75.c | 20 ++++++++++++++++++++ testhal/STM32F1xx/I2C/tmp75.h | 20 ++++++++++++++++++++ 10 files changed, 182 insertions(+), 41 deletions(-) delete mode 100644 testhal/STM32F1xx/I2C/main.h (limited to 'testhal/STM32F1xx') diff --git a/testhal/STM32F1xx/I2C/fake.c b/testhal/STM32F1xx/I2C/fake.c index 75f242207..53779893e 100644 --- a/testhal/STM32F1xx/I2C/fake.c +++ b/testhal/STM32F1xx/I2C/fake.c @@ -1,3 +1,23 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + /** * Not responding slave test */ diff --git a/testhal/STM32F1xx/I2C/fake.h b/testhal/STM32F1xx/I2C/fake.h index a83652e29..04f4206bf 100644 --- a/testhal/STM32F1xx/I2C/fake.h +++ b/testhal/STM32F1xx/I2C/fake.h @@ -1,3 +1,23 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + #ifndef FAKE_H_ #define FAKE_H_ diff --git a/testhal/STM32F1xx/I2C/i2c_pns.c b/testhal/STM32F1xx/I2C/i2c_pns.c index 95218b583..1c73482e3 100644 --- a/testhal/STM32F1xx/I2C/i2c_pns.c +++ b/testhal/STM32F1xx/I2C/i2c_pns.c @@ -1,10 +1,30 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + #include "ch.h" #include "hal.h" #include "i2c_pns.h" - #include "lis3.h" + /* I2C1 */ static const I2CConfig i2cfg1 = { OPMODE_I2C, diff --git a/testhal/STM32F1xx/I2C/i2c_pns.h b/testhal/STM32F1xx/I2C/i2c_pns.h index 4dfdf320e..dae359ecf 100644 --- a/testhal/STM32F1xx/I2C/i2c_pns.h +++ b/testhal/STM32F1xx/I2C/i2c_pns.h @@ -1,3 +1,23 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + #ifndef I2C_PNS_H_ #define I2C_PNS_H_ diff --git a/testhal/STM32F1xx/I2C/lis3.c b/testhal/STM32F1xx/I2C/lis3.c index d52d526e2..d3369ac82 100644 --- a/testhal/STM32F1xx/I2C/lis3.c +++ b/testhal/STM32F1xx/I2C/lis3.c @@ -1,7 +1,26 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + /** - * This is most complex and difficult device. - * It realize "read through write" paradigm. This is not standard, but - * most of I2C devices use this paradigm. + * This is device realize "read through write" paradigm. This is not + * standard, but most of I2C devices use this paradigm. * You must write to device reading address, send restart to bus, * and then begin reading process. */ diff --git a/testhal/STM32F1xx/I2C/lis3.h b/testhal/STM32F1xx/I2C/lis3.h index e50359bde..0c2eefa5d 100644 --- a/testhal/STM32F1xx/I2C/lis3.h +++ b/testhal/STM32F1xx/I2C/lis3.h @@ -1,3 +1,23 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + #include #include "ch.h" diff --git a/testhal/STM32F1xx/I2C/main.c b/testhal/STM32F1xx/I2C/main.c index 0ca040e88..60cb1f3ae 100644 --- a/testhal/STM32F1xx/I2C/main.c +++ b/testhal/STM32F1xx/I2C/main.c @@ -1,21 +1,22 @@ -/** - * Lets imagine that we have board with LIS3LV02DL accelerometer on channel #1 - * and MAX1236 ADC, TMP75 thermometer on channel #2. - * - * NOTE: I assume, that you have datasheets on all this stuff. - * - * NOTE: Also, I assume, that you know how to I2C works. - * - * In order from simplicity to complexity: - * TMP75 - * MAX1236 - * LIS3LV02DL - * - * Project splitted to separate source files for each device. - * - * Data from sensors we will be read from different thread sleeping different - * amount of time. - */ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ #include diff --git a/testhal/STM32F1xx/I2C/main.h b/testhal/STM32F1xx/I2C/main.h deleted file mode 100644 index 1435a05e5..000000000 --- a/testhal/STM32F1xx/I2C/main.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * main.h - * - * Created on: 25.03.2011 - * Author: barthess - */ - -#ifndef MAIN_H_ -#define MAIN_H_ - - -// глобальные флаги -#define GET_FILTERED_RAW_GYRO TRUE -#define GET_FILTERED_RAW_ACCEL TRUE - - - - -#endif /* MAIN_H_ */ diff --git a/testhal/STM32F1xx/I2C/tmp75.c b/testhal/STM32F1xx/I2C/tmp75.c index 7acc8c668..630a76dac 100644 --- a/testhal/STM32F1xx/I2C/tmp75.c +++ b/testhal/STM32F1xx/I2C/tmp75.c @@ -1,3 +1,23 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + /** * TMP75 is most simple I2C device in our case. It is already useful with * default settings after powerup. diff --git a/testhal/STM32F1xx/I2C/tmp75.h b/testhal/STM32F1xx/I2C/tmp75.h index ab4b5fa9b..13648b154 100644 --- a/testhal/STM32F1xx/I2C/tmp75.h +++ b/testhal/STM32F1xx/I2C/tmp75.h @@ -1,3 +1,23 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + #ifndef TMP75_H_ #define TMP75_H_ -- cgit v1.2.3