Platform drivers for Mbed.

Dependents:   EVAL-CN0535-FMCZ EVAL-CN0535-FMCZ EVAL-AD568x-AD569x EVAL-AD7606 ... more

Committer:
Kjansen
Date:
Mon Nov 29 12:39:54 2021 +0000
Revision:
20:4951ea6abee5
Parent:
17:af1f2416dd26
The following changes were made:
1.) Modified udelay() function for generating more accurate smaller usec delays
2.) Implemented the irq_enable and irq_disable functions
3.) Removed the confusion b/w application created peripheral object and interrupt specific object
4.) Created PWM extra init structure and added PWM pin
5.) Added a module for timer and its related header file

Who changed what in which revision?

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