Platform drivers for Mbed.
Dependents: EVAL-CN0535-FMCZ EVAL-CN0535-FMCZ EVAL-AD568x-AD569x EVAL-AD7606 ... more
gpio_extra.h@20:4951ea6abee5, 2021-11-29 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
mahphalke |
17:af1f2416dd26 | 1 | /***************************************************************************//** |
mahphalke |
17:af1f2416dd26 | 2 | * @file gpio_extra.h |
mahphalke |
17:af1f2416dd26 | 3 | * @brief: Header containing extra types required for GPIO 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 GPIO_EXTRA_H |
mahphalke |
17:af1f2416dd26 | 14 | #define GPIO_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 | * gpio init and read/write operations. |
mahphalke |
17:af1f2416dd26 | 41 | **/ |
mahphalke |
17:af1f2416dd26 | 42 | |
mahphalke |
17:af1f2416dd26 | 43 | /** |
mahphalke |
17:af1f2416dd26 | 44 | * @struct mbed_gpio_init_param |
mahphalke |
17:af1f2416dd26 | 45 | * @brief Structure holding the GPIO init parameters for mbed platform. |
mahphalke |
17:af1f2416dd26 | 46 | */ |
mahphalke |
17:af1f2416dd26 | 47 | typedef struct mbed_gpio_init_param { |
mahphalke |
17:af1f2416dd26 | 48 | uint8_t pin_mode; // GPIO pin mode (PinMode) |
mahphalke |
17:af1f2416dd26 | 49 | } mbed_gpio_init_param; |
mahphalke |
17:af1f2416dd26 | 50 | |
mahphalke |
17:af1f2416dd26 | 51 | /** |
mahphalke |
17:af1f2416dd26 | 52 | * @struct mbed_gpio_desc |
mahphalke |
17:af1f2416dd26 | 53 | * @brief GPIO specific descriptor for the mbed platform. |
mahphalke |
17:af1f2416dd26 | 54 | */ |
mahphalke |
17:af1f2416dd26 | 55 | typedef struct mbed_gpio_desc { |
mahphalke |
17:af1f2416dd26 | 56 | uint8_t direction; |
mahphalke |
17:af1f2416dd26 | 57 | void *gpio_pin; // GPIO pin instance (DigitalIn/DigitalOut) |
mahphalke |
17:af1f2416dd26 | 58 | uint8_t pin_mode; |
mahphalke |
17:af1f2416dd26 | 59 | } mbed_gpio_desc; |
mahphalke |
17:af1f2416dd26 | 60 | |
mahphalke |
17:af1f2416dd26 | 61 | |
mahphalke |
17:af1f2416dd26 | 62 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 63 | /************************ Functions Declarations ******************************/ |
mahphalke |
17:af1f2416dd26 | 64 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 65 | |
mahphalke |
17:af1f2416dd26 | 66 | |
mahphalke |
17:af1f2416dd26 | 67 | #ifdef __cplusplus // Closing extern c |
mahphalke |
17:af1f2416dd26 | 68 | } |
mahphalke |
17:af1f2416dd26 | 69 | #endif |
mahphalke |
17:af1f2416dd26 | 70 | |
mahphalke |
17:af1f2416dd26 | 71 | #endif /* GPIO_EXTRA_H */ |