mbed library for STMicroelectronics' X-NUCLEO-IKA01A1 expansion board.
Dependents: HelloWorld_IKA01A1
Fork of X_NUCLEO_IKA01A1 by
Library for STMicroelectronics' X-NUCLEO-IKA01A1 multifunctional expansion board based on operational amplifiers.
Components/Common/component_def.h@22:ff8d071bf79e, 2017-05-09 (annotated)
- Committer:
- Davidroid
- Date:
- Tue May 09 11:49:16 2017 +0000
- Revision:
- 22:ff8d071bf79e
Aligned to ARM mbed coding style.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Davidroid | 22:ff8d071bf79e | 1 | /** |
Davidroid | 22:ff8d071bf79e | 2 | ****************************************************************************** |
Davidroid | 22:ff8d071bf79e | 3 | * @file component_def.h |
Davidroid | 22:ff8d071bf79e | 4 | * @author AST |
Davidroid | 22:ff8d071bf79e | 5 | * @version V1.0.0 |
Davidroid | 22:ff8d071bf79e | 6 | * @date 1 April 2015 |
Davidroid | 22:ff8d071bf79e | 7 | * @brief Generic header file containing a generic component's definitions |
Davidroid | 22:ff8d071bf79e | 8 | * and I/O functions. |
Davidroid | 22:ff8d071bf79e | 9 | ****************************************************************************** |
Davidroid | 22:ff8d071bf79e | 10 | * @attention |
Davidroid | 22:ff8d071bf79e | 11 | * |
Davidroid | 22:ff8d071bf79e | 12 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
Davidroid | 22:ff8d071bf79e | 13 | * |
Davidroid | 22:ff8d071bf79e | 14 | * Redistribution and use in source and binary forms, with or without modification, |
Davidroid | 22:ff8d071bf79e | 15 | * are permitted provided that the following conditions are met: |
Davidroid | 22:ff8d071bf79e | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
Davidroid | 22:ff8d071bf79e | 17 | * this list of conditions and the following disclaimer. |
Davidroid | 22:ff8d071bf79e | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
Davidroid | 22:ff8d071bf79e | 19 | * this list of conditions and the following disclaimer in the documentation |
Davidroid | 22:ff8d071bf79e | 20 | * and/or other materials provided with the distribution. |
Davidroid | 22:ff8d071bf79e | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
Davidroid | 22:ff8d071bf79e | 22 | * may be used to endorse or promote products derived from this software |
Davidroid | 22:ff8d071bf79e | 23 | * without specific prior written permission. |
Davidroid | 22:ff8d071bf79e | 24 | * |
Davidroid | 22:ff8d071bf79e | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Davidroid | 22:ff8d071bf79e | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Davidroid | 22:ff8d071bf79e | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Davidroid | 22:ff8d071bf79e | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
Davidroid | 22:ff8d071bf79e | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Davidroid | 22:ff8d071bf79e | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
Davidroid | 22:ff8d071bf79e | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Davidroid | 22:ff8d071bf79e | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Davidroid | 22:ff8d071bf79e | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Davidroid | 22:ff8d071bf79e | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Davidroid | 22:ff8d071bf79e | 35 | * |
Davidroid | 22:ff8d071bf79e | 36 | ****************************************************************************** |
Davidroid | 22:ff8d071bf79e | 37 | */ |
Davidroid | 22:ff8d071bf79e | 38 | |
Davidroid | 22:ff8d071bf79e | 39 | |
Davidroid | 22:ff8d071bf79e | 40 | /* Define to prevent recursive inclusion -------------------------------------*/ |
Davidroid | 22:ff8d071bf79e | 41 | |
Davidroid | 22:ff8d071bf79e | 42 | #ifndef __COMPONENT_H |
Davidroid | 22:ff8d071bf79e | 43 | #define __COMPONENT_H |
Davidroid | 22:ff8d071bf79e | 44 | |
Davidroid | 22:ff8d071bf79e | 45 | |
Davidroid | 22:ff8d071bf79e | 46 | /* Types ---------------------------------------------------------------------*/ |
Davidroid | 22:ff8d071bf79e | 47 | |
Davidroid | 22:ff8d071bf79e | 48 | /** |
Davidroid | 22:ff8d071bf79e | 49 | * @brief Component's Context structure definition. |
Davidroid | 22:ff8d071bf79e | 50 | */ |
Davidroid | 22:ff8d071bf79e | 51 | typedef struct |
Davidroid | 22:ff8d071bf79e | 52 | { |
Davidroid | 22:ff8d071bf79e | 53 | /* Identity. */ |
Davidroid | 22:ff8d071bf79e | 54 | uint8_t who_am_i; |
Davidroid | 22:ff8d071bf79e | 55 | |
Davidroid | 22:ff8d071bf79e | 56 | /* ACTION ----------------------------------------------------------------*/ |
Davidroid | 22:ff8d071bf79e | 57 | /* There should be only a unique identifier for each component, which */ |
Davidroid | 22:ff8d071bf79e | 58 | /* should be the "who_am_i" parameter, hence this parameter is optional. */ |
Davidroid | 22:ff8d071bf79e | 59 | /* -----------------------------------------------------------------------*/ |
Davidroid | 22:ff8d071bf79e | 60 | /* Type. */ |
Davidroid | 22:ff8d071bf79e | 61 | uint8_t type; |
Davidroid | 22:ff8d071bf79e | 62 | |
Davidroid | 22:ff8d071bf79e | 63 | /* Configuration. */ |
Davidroid | 22:ff8d071bf79e | 64 | uint8_t address; |
Davidroid | 22:ff8d071bf79e | 65 | |
Davidroid | 22:ff8d071bf79e | 66 | /* Pointer to the Data. */ |
Davidroid | 22:ff8d071bf79e | 67 | void *p_data; |
Davidroid | 22:ff8d071bf79e | 68 | |
Davidroid | 22:ff8d071bf79e | 69 | /* Pointer to the Virtual Table. */ |
Davidroid | 22:ff8d071bf79e | 70 | void *p_vt; |
Davidroid | 22:ff8d071bf79e | 71 | |
Davidroid | 22:ff8d071bf79e | 72 | /* ACTION ----------------------------------------------------------------*/ |
Davidroid | 22:ff8d071bf79e | 73 | /* There should be only a unique virtual table for each component, which */ |
Davidroid | 22:ff8d071bf79e | 74 | /* should be the "p_vt" parameter, hence this parameter is optional. */ |
Davidroid | 22:ff8d071bf79e | 75 | /* -----------------------------------------------------------------------*/ |
Davidroid | 22:ff8d071bf79e | 76 | /* Pointer to the Extended Virtual Table. */ |
Davidroid | 22:ff8d071bf79e | 77 | void *p_ext_vt; |
Davidroid | 22:ff8d071bf79e | 78 | } handle_t; |
Davidroid | 22:ff8d071bf79e | 79 | |
Davidroid | 22:ff8d071bf79e | 80 | /** |
Davidroid | 22:ff8d071bf79e | 81 | * @brief Component's Status enumerator definition. |
Davidroid | 22:ff8d071bf79e | 82 | */ |
Davidroid | 22:ff8d071bf79e | 83 | typedef enum |
Davidroid | 22:ff8d071bf79e | 84 | { |
Davidroid | 22:ff8d071bf79e | 85 | COMPONENT_OK = 0, |
Davidroid | 22:ff8d071bf79e | 86 | COMPONENT_ERROR, |
Davidroid | 22:ff8d071bf79e | 87 | COMPONENT_TIMEOUT, |
Davidroid | 22:ff8d071bf79e | 88 | COMPONENT_NOT_IMPLEMENTED |
Davidroid | 22:ff8d071bf79e | 89 | } status_t; |
Davidroid | 22:ff8d071bf79e | 90 | |
Davidroid | 22:ff8d071bf79e | 91 | #endif /* __COMPONENT_H */ |
Davidroid | 22:ff8d071bf79e | 92 | |
Davidroid | 22:ff8d071bf79e | 93 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |