Jamie Satchell
/
JSatchell_SOFT253ReferredCoursework
Finished project.
Fork of ReferredCoursework2016 by
Components/Interfaces/GenericSensor.h@50:f507d4465c31, 2015-06-08 (annotated)
- Committer:
- Wolfgang Betz
- Date:
- Mon Jun 08 18:04:19 2015 +0200
- Revision:
- 50:f507d4465c31
- Parent:
- 48:cb18488509a5
Cleanup interfaces from not yet comfirmed methods
Potential generic methods to be put into interface classes from which to
derive other interfaces from are (among others):
- virtual int PowerOff(void) { /* not yet implemented */ return 0; }
- virtual int Reset(void) { /* not yet implemented */ return 0; }
- virtual void ConfigIT(uint16_t) { /* not yet implemented */ }
- virtual void EnableIT(uint8_t) { /* not yet implemented */ }
- virtual void DisableIT(uint8_t) { /* not yet implemented */ }
- virtual uint8_t ITStatus(uint16_t, uint16_t) { /* not yet implemented */ return 0; }
- virtual void ClearIT(uint16_t, uint16_t) { /* not yet implemented */ }
- virtual void AttachIT(void (*fptr)(void)) { /* not yet implemented */ }
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Wolfgang Betz |
46:badcff0675e8 | 1 | /** |
Wolfgang Betz |
46:badcff0675e8 | 2 | ****************************************************************************** |
Wolfgang Betz |
46:badcff0675e8 | 3 | * @file GenericSensor.h |
Wolfgang Betz |
46:badcff0675e8 | 4 | * @author AST / EST |
Wolfgang Betz |
46:badcff0675e8 | 5 | * @version V0.0.1 |
Wolfgang Betz |
46:badcff0675e8 | 6 | * @date 13-April-2015 |
Wolfgang Betz |
46:badcff0675e8 | 7 | * @brief This file contains the abstract class describing in general |
Wolfgang Betz |
46:badcff0675e8 | 8 | * the interfaces of a generic sensor |
Wolfgang Betz |
46:badcff0675e8 | 9 | ****************************************************************************** |
Wolfgang Betz |
46:badcff0675e8 | 10 | * @attention |
Wolfgang Betz |
46:badcff0675e8 | 11 | * |
Wolfgang Betz |
46:badcff0675e8 | 12 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
Wolfgang Betz |
46:badcff0675e8 | 13 | * |
Wolfgang Betz |
46:badcff0675e8 | 14 | * Redistribution and use in source and binary forms, with or without modification, |
Wolfgang Betz |
46:badcff0675e8 | 15 | * are permitted provided that the following conditions are met: |
Wolfgang Betz |
46:badcff0675e8 | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
Wolfgang Betz |
46:badcff0675e8 | 17 | * this list of conditions and the following disclaimer. |
Wolfgang Betz |
46:badcff0675e8 | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
Wolfgang Betz |
46:badcff0675e8 | 19 | * this list of conditions and the following disclaimer in the documentation |
Wolfgang Betz |
46:badcff0675e8 | 20 | * and/or other materials provided with the distribution. |
Wolfgang Betz |
46:badcff0675e8 | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
Wolfgang Betz |
46:badcff0675e8 | 22 | * may be used to endorse or promote products derived from this software |
Wolfgang Betz |
46:badcff0675e8 | 23 | * without specific prior written permission. |
Wolfgang Betz |
46:badcff0675e8 | 24 | * |
Wolfgang Betz |
46:badcff0675e8 | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Wolfgang Betz |
46:badcff0675e8 | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Wolfgang Betz |
46:badcff0675e8 | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Wolfgang Betz |
46:badcff0675e8 | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
Wolfgang Betz |
46:badcff0675e8 | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Wolfgang Betz |
46:badcff0675e8 | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
Wolfgang Betz |
46:badcff0675e8 | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Wolfgang Betz |
46:badcff0675e8 | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Wolfgang Betz |
46:badcff0675e8 | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Wolfgang Betz |
46:badcff0675e8 | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Wolfgang Betz |
46:badcff0675e8 | 35 | * |
Wolfgang Betz |
46:badcff0675e8 | 36 | ****************************************************************************** |
Wolfgang Betz |
46:badcff0675e8 | 37 | */ |
Wolfgang Betz |
46:badcff0675e8 | 38 | |
Wolfgang Betz |
46:badcff0675e8 | 39 | /* Define to prevent from recursive inclusion --------------------------------*/ |
Wolfgang Betz |
46:badcff0675e8 | 40 | #ifndef __GENERIC_SENSOR_CLASS_H |
Wolfgang Betz |
46:badcff0675e8 | 41 | #define __GENERIC_SENSOR_CLASS_H |
Wolfgang Betz |
46:badcff0675e8 | 42 | |
Wolfgang Betz |
46:badcff0675e8 | 43 | /* Includes ------------------------------------------------------------------*/ |
Wolfgang Betz |
46:badcff0675e8 | 44 | #include <stdint.h> |
Wolfgang Betz |
46:badcff0675e8 | 45 | |
Wolfgang Betz |
46:badcff0675e8 | 46 | /* Classes ------------------------------------------------------------------*/ |
Wolfgang Betz |
46:badcff0675e8 | 47 | /** An abstract class for Generic sensors |
Wolfgang Betz |
46:badcff0675e8 | 48 | */ |
Wolfgang Betz |
46:badcff0675e8 | 49 | class GenericSensor |
Wolfgang Betz |
46:badcff0675e8 | 50 | { |
Wolfgang Betz |
46:badcff0675e8 | 51 | public: |
Wolfgang Betz |
46:badcff0675e8 | 52 | /** |
Wolfgang Betz |
46:badcff0675e8 | 53 | * @brief Initialization of sensor |
Wolfgang Betz |
46:badcff0675e8 | 54 | * @param[out] ptr Pointer to device specific initalization structure |
Wolfgang Betz |
46:badcff0675e8 | 55 | * @return 0 in case of success, an error code otherwise |
Wolfgang Betz |
46:badcff0675e8 | 56 | */ |
Wolfgang Betz |
46:badcff0675e8 | 57 | virtual int Init(void *ptr) = 0; |
Wolfgang Betz |
46:badcff0675e8 | 58 | |
Wolfgang Betz |
46:badcff0675e8 | 59 | /** |
Wolfgang Betz |
46:badcff0675e8 | 60 | * @brief Get ID of sensor |
Wolfgang Betz |
46:badcff0675e8 | 61 | * @param[out] id Pointer to where to store the ID to |
Wolfgang Betz |
46:badcff0675e8 | 62 | * @return 0 in case of success, an error code otherwise |
Wolfgang Betz |
46:badcff0675e8 | 63 | */ |
Wolfgang Betz |
46:badcff0675e8 | 64 | virtual int ReadID(uint8_t *id) = 0; |
Wolfgang Betz |
46:badcff0675e8 | 65 | }; |
Wolfgang Betz |
46:badcff0675e8 | 66 | |
Wolfgang Betz |
46:badcff0675e8 | 67 | #endif /* __GENERIC_SENSOR_CLASS_H */ |