Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Components/ST_INTERFACES/Common/Component.h@0:293607457a02, 2020-10-16 (annotated)
- Committer:
- charlesmn
- Date:
- Fri Oct 16 15:04:28 2020 +0000
- Revision:
- 0:293607457a02
Change typo in name
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| charlesmn | 0:293607457a02 | 1 | /** | 
| charlesmn | 0:293607457a02 | 2 | ****************************************************************************** | 
| charlesmn | 0:293607457a02 | 3 | * @file Component.h | 
| charlesmn | 0:293607457a02 | 4 | * @author AST | 
| charlesmn | 0:293607457a02 | 5 | * @version V1.0.0 | 
| charlesmn | 0:293607457a02 | 6 | * @date April 13th, 2015 | 
| charlesmn | 0:293607457a02 | 7 | * @brief This file contains the abstract class describing the interface of a | 
| charlesmn | 0:293607457a02 | 8 | * generic component. | 
| charlesmn | 0:293607457a02 | 9 | ****************************************************************************** | 
| charlesmn | 0:293607457a02 | 10 | * @attention | 
| charlesmn | 0:293607457a02 | 11 | * | 
| charlesmn | 0:293607457a02 | 12 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> | 
| charlesmn | 0:293607457a02 | 13 | * | 
| charlesmn | 0:293607457a02 | 14 | * Redistribution and use in source and binary forms, with or without modification, | 
| charlesmn | 0:293607457a02 | 15 | * are permitted provided that the following conditions are met: | 
| charlesmn | 0:293607457a02 | 16 | * 1. Redistributions of source code must retain the above copyright notice, | 
| charlesmn | 0:293607457a02 | 17 | * this list of conditions and the following disclaimer. | 
| charlesmn | 0:293607457a02 | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, | 
| charlesmn | 0:293607457a02 | 19 | * this list of conditions and the following disclaimer in the documentation | 
| charlesmn | 0:293607457a02 | 20 | * and/or other materials provided with the distribution. | 
| charlesmn | 0:293607457a02 | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors | 
| charlesmn | 0:293607457a02 | 22 | * may be used to endorse or promote products derived from this software | 
| charlesmn | 0:293607457a02 | 23 | * without specific prior written permission. | 
| charlesmn | 0:293607457a02 | 24 | * | 
| charlesmn | 0:293607457a02 | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | 
| charlesmn | 0:293607457a02 | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 
| charlesmn | 0:293607457a02 | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 
| charlesmn | 0:293607457a02 | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | 
| charlesmn | 0:293607457a02 | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 
| charlesmn | 0:293607457a02 | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 
| charlesmn | 0:293607457a02 | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | 
| charlesmn | 0:293607457a02 | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 
| charlesmn | 0:293607457a02 | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
| charlesmn | 0:293607457a02 | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
| charlesmn | 0:293607457a02 | 35 | * | 
| charlesmn | 0:293607457a02 | 36 | ****************************************************************************** | 
| charlesmn | 0:293607457a02 | 37 | */ | 
| charlesmn | 0:293607457a02 | 38 | |
| charlesmn | 0:293607457a02 | 39 | |
| charlesmn | 0:293607457a02 | 40 | /* Define to prevent recursive inclusion -------------------------------------*/ | 
| charlesmn | 0:293607457a02 | 41 | |
| charlesmn | 0:293607457a02 | 42 | #ifndef __COMPONENT_CLASS_H | 
| charlesmn | 0:293607457a02 | 43 | #define __COMPONENT_CLASS_H | 
| charlesmn | 0:293607457a02 | 44 | |
| charlesmn | 0:293607457a02 | 45 | |
| charlesmn | 0:293607457a02 | 46 | /* Includes ------------------------------------------------------------------*/ | 
| charlesmn | 0:293607457a02 | 47 | |
| charlesmn | 0:293607457a02 | 48 | #include <stdint.h> | 
| charlesmn | 0:293607457a02 | 49 | |
| charlesmn | 0:293607457a02 | 50 | |
| charlesmn | 0:293607457a02 | 51 | /* Classes ------------------------------------------------------------------*/ | 
| charlesmn | 0:293607457a02 | 52 | |
| charlesmn | 0:293607457a02 | 53 | /** | 
| charlesmn | 0:293607457a02 | 54 | * An abstract class for Generic components. | 
| charlesmn | 0:293607457a02 | 55 | */ | 
| charlesmn | 0:293607457a02 | 56 | class Component { | 
| charlesmn | 0:293607457a02 | 57 | public: | 
| charlesmn | 0:293607457a02 | 58 | |
| charlesmn | 0:293607457a02 | 59 | /** | 
| charlesmn | 0:293607457a02 | 60 | * @brief Initializing the component. | 
| charlesmn | 0:293607457a02 | 61 | * @param[in] init pointer to device specific initalization structure. | 
| charlesmn | 0:293607457a02 | 62 | * @retval "0" in case of success, an error code otherwise. | 
| charlesmn | 0:293607457a02 | 63 | */ | 
| charlesmn | 0:293607457a02 | 64 | virtual int init(void *init) = 0; | 
| charlesmn | 0:293607457a02 | 65 | |
| charlesmn | 0:293607457a02 | 66 | /** | 
| charlesmn | 0:293607457a02 | 67 | * @brief Getting the ID of the component. | 
| charlesmn | 0:293607457a02 | 68 | * @param[out] id pointer to an allocated variable to store the ID into. | 
| charlesmn | 0:293607457a02 | 69 | * @retval "0" in case of success, an error code otherwise. | 
| charlesmn | 0:293607457a02 | 70 | */ | 
| charlesmn | 0:293607457a02 | 71 | virtual int read_id(uint8_t *id) = 0; | 
| charlesmn | 0:293607457a02 | 72 | |
| charlesmn | 0:293607457a02 | 73 | /** | 
| charlesmn | 0:293607457a02 | 74 | * @brief Destructor. | 
| charlesmn | 0:293607457a02 | 75 | */ | 
| charlesmn | 0:293607457a02 | 76 | virtual ~Component() {}; | 
| charlesmn | 0:293607457a02 | 77 | }; | 
| charlesmn | 0:293607457a02 | 78 | |
| charlesmn | 0:293607457a02 | 79 | #endif /* __COMPONENT_CLASS_H */ | 
| charlesmn | 0:293607457a02 | 80 | |
| charlesmn | 0:293607457a02 | 81 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |