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.
platform_drivers/src/i2c_extra.h@8:ca65a811c522, 2021-10-27 (annotated)
- Committer:
- nsheth
- Date:
- Wed Oct 27 07:36:03 2021 +0000
- Revision:
- 8:ca65a811c522
Convert platform drivers away from library
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| nsheth | 8:ca65a811c522 | 1 | /***************************************************************************//** |
| nsheth | 8:ca65a811c522 | 2 | * @file i2c_extra.h |
| nsheth | 8:ca65a811c522 | 3 | * @brief: Header containing extra types required for I2C interface |
| nsheth | 8:ca65a811c522 | 4 | ******************************************************************************** |
| nsheth | 8:ca65a811c522 | 5 | * Copyright (c) 2020 Analog Devices, Inc. |
| nsheth | 8:ca65a811c522 | 6 | * |
| nsheth | 8:ca65a811c522 | 7 | * All rights reserved. |
| nsheth | 8:ca65a811c522 | 8 | * |
| nsheth | 8:ca65a811c522 | 9 | * This software is proprietary to Analog Devices, Inc. and its licensors. |
| nsheth | 8:ca65a811c522 | 10 | * By using this software you agree to the terms of the associated |
| nsheth | 8:ca65a811c522 | 11 | * Analog Devices Software License Agreement. |
| nsheth | 8:ca65a811c522 | 12 | *******************************************************************************/ |
| nsheth | 8:ca65a811c522 | 13 | |
| nsheth | 8:ca65a811c522 | 14 | #ifndef I2C_EXTRA_H |
| nsheth | 8:ca65a811c522 | 15 | #define I2C_EXTRA_H |
| nsheth | 8:ca65a811c522 | 16 | |
| nsheth | 8:ca65a811c522 | 17 | |
| nsheth | 8:ca65a811c522 | 18 | // Platform support needs to be C-compatible to work with other drivers |
| nsheth | 8:ca65a811c522 | 19 | #ifdef __cplusplus |
| nsheth | 8:ca65a811c522 | 20 | extern "C" |
| nsheth | 8:ca65a811c522 | 21 | { |
| nsheth | 8:ca65a811c522 | 22 | #endif |
| nsheth | 8:ca65a811c522 | 23 | |
| nsheth | 8:ca65a811c522 | 24 | /******************************************************************************/ |
| nsheth | 8:ca65a811c522 | 25 | /***************************** Include Files **********************************/ |
| nsheth | 8:ca65a811c522 | 26 | /******************************************************************************/ |
| nsheth | 8:ca65a811c522 | 27 | #include <stdio.h> |
| nsheth | 8:ca65a811c522 | 28 | |
| nsheth | 8:ca65a811c522 | 29 | /******************************************************************************/ |
| nsheth | 8:ca65a811c522 | 30 | /********************** Macros and Constants Definitions **********************/ |
| nsheth | 8:ca65a811c522 | 31 | /******************************************************************************/ |
| nsheth | 8:ca65a811c522 | 32 | |
| nsheth | 8:ca65a811c522 | 33 | /******************************************************************************/ |
| nsheth | 8:ca65a811c522 | 34 | /********************** Variables and User defined data types *****************/ |
| nsheth | 8:ca65a811c522 | 35 | /******************************************************************************/ |
| nsheth | 8:ca65a811c522 | 36 | |
| nsheth | 8:ca65a811c522 | 37 | /* |
| nsheth | 8:ca65a811c522 | 38 | * Note: The structure members are not strongly typed, as this file is included |
| nsheth | 8:ca65a811c522 | 39 | * in application specific '.c' files. The mbed code structure does not |
| nsheth | 8:ca65a811c522 | 40 | * allow inclusion of mbed driver files (e.g. mbed.h) into '.c' files. |
| nsheth | 8:ca65a811c522 | 41 | * All the members are hence typecasted to mbed specific type during |
| nsheth | 8:ca65a811c522 | 42 | * i2c init and read/write operations. |
| nsheth | 8:ca65a811c522 | 43 | **/ |
| nsheth | 8:ca65a811c522 | 44 | |
| nsheth | 8:ca65a811c522 | 45 | /** |
| nsheth | 8:ca65a811c522 | 46 | * @struct mbed_i2c_init_param |
| nsheth | 8:ca65a811c522 | 47 | * @brief Structure holding the I2C init parameters for mbed platform. |
| nsheth | 8:ca65a811c522 | 48 | */ |
| nsheth | 8:ca65a811c522 | 49 | typedef struct mbed_i2c_init_param { |
| nsheth | 8:ca65a811c522 | 50 | uint8_t i2c_sda_pin; // I2C SDA pin (PinName) |
| nsheth | 8:ca65a811c522 | 51 | uint8_t i2c_scl_pin; // I2C SCL pin (PinName) |
| nsheth | 8:ca65a811c522 | 52 | } mbed_i2c_init_param; |
| nsheth | 8:ca65a811c522 | 53 | |
| nsheth | 8:ca65a811c522 | 54 | /** |
| nsheth | 8:ca65a811c522 | 55 | * @struct mbed_i2c_desc |
| nsheth | 8:ca65a811c522 | 56 | * @brief I2C specific descriptor for the mbed platform. |
| nsheth | 8:ca65a811c522 | 57 | */ |
| nsheth | 8:ca65a811c522 | 58 | typedef struct mbed_i2c_desc { |
| nsheth | 8:ca65a811c522 | 59 | void *i2c_port; // I2C port instance (mbed::I2C) |
| nsheth | 8:ca65a811c522 | 60 | } mbed_i2c_desc; |
| nsheth | 8:ca65a811c522 | 61 | |
| nsheth | 8:ca65a811c522 | 62 | |
| nsheth | 8:ca65a811c522 | 63 | /******************************************************************************/ |
| nsheth | 8:ca65a811c522 | 64 | /************************ Functions Declarations ******************************/ |
| nsheth | 8:ca65a811c522 | 65 | /******************************************************************************/ |
| nsheth | 8:ca65a811c522 | 66 | |
| nsheth | 8:ca65a811c522 | 67 | |
| nsheth | 8:ca65a811c522 | 68 | #ifdef __cplusplus // Closing extern c |
| nsheth | 8:ca65a811c522 | 69 | } |
| nsheth | 8:ca65a811c522 | 70 | #endif |
| nsheth | 8:ca65a811c522 | 71 | |
| nsheth | 8:ca65a811c522 | 72 | #endif /* I2C_EXTRA_H */ |