Platform drivers for Mbed.
Dependents: EVAL-CN0535-FMCZ EVAL-CN0535-FMCZ EVAL-AD568x-AD569x EVAL-AD7606 ... more
platform_support.cpp@17:af1f2416dd26, 2021-07-13 (annotated)
- Committer:
- mahphalke
- Date:
- Tue Jul 13 13:58:07 2021 +0530
- Revision:
- 17:af1f2416dd26
Restructured the directory- Removed inc/ and src/ folders and moved all source/header files at root
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mahphalke |
17:af1f2416dd26 | 1 | /***************************************************************************//** |
mahphalke |
17:af1f2416dd26 | 2 | * @file platform_support.cpp |
mahphalke |
17:af1f2416dd26 | 3 | * @brief: support functions and declarations for particular platform |
mahphalke |
17:af1f2416dd26 | 4 | * @details: This is a platform specific file that supports functionality |
mahphalke |
17:af1f2416dd26 | 5 | * required from application generic file. This file should be |
mahphalke |
17:af1f2416dd26 | 6 | * modified according to platform that you are working with. |
mahphalke |
17:af1f2416dd26 | 7 | ******************************************************************************** |
mahphalke |
17:af1f2416dd26 | 8 | * Copyright (c) 2019 - 2021 Analog Devices, Inc. |
mahphalke |
17:af1f2416dd26 | 9 | * All rights reserved. |
mahphalke |
17:af1f2416dd26 | 10 | * |
mahphalke |
17:af1f2416dd26 | 11 | * This software is proprietary to Analog Devices, Inc. and its licensors. |
mahphalke |
17:af1f2416dd26 | 12 | * By using this software you agree to the terms of the associated |
mahphalke |
17:af1f2416dd26 | 13 | * Analog Devices Software License Agreement. |
mahphalke |
17:af1f2416dd26 | 14 | *******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 15 | |
mahphalke |
17:af1f2416dd26 | 16 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 17 | /************************ Includes Files **************************************/ |
mahphalke |
17:af1f2416dd26 | 18 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 19 | #include <mbed.h> |
mahphalke |
17:af1f2416dd26 | 20 | |
mahphalke |
17:af1f2416dd26 | 21 | // Platform support needs to be C-compatible to work with other drivers |
mahphalke |
17:af1f2416dd26 | 22 | #ifdef __cplusplus |
mahphalke |
17:af1f2416dd26 | 23 | extern "C" |
mahphalke |
17:af1f2416dd26 | 24 | { |
mahphalke |
17:af1f2416dd26 | 25 | #endif |
mahphalke |
17:af1f2416dd26 | 26 | |
mahphalke |
17:af1f2416dd26 | 27 | #include "platform_support.h" |
mahphalke |
17:af1f2416dd26 | 28 | |
mahphalke |
17:af1f2416dd26 | 29 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 30 | /********************** Variables and User defined data types *****************/ |
mahphalke |
17:af1f2416dd26 | 31 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 32 | |
mahphalke |
17:af1f2416dd26 | 33 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 34 | /************************ Variable Declarations *******************************/ |
mahphalke |
17:af1f2416dd26 | 35 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 36 | |
mahphalke |
17:af1f2416dd26 | 37 | // Configure and instantiate UnbufferedSerial object to access the stdin. |
mahphalke |
17:af1f2416dd26 | 38 | // The default mbed baud rate is 9600, unless is it overriden in the |
mahphalke |
17:af1f2416dd26 | 39 | // mbed_app.json file, or by creating another UnbufferedSerial object using |
mahphalke |
17:af1f2416dd26 | 40 | // the same pins. |
mahphalke |
17:af1f2416dd26 | 41 | static UnbufferedSerial port(USBTX, USBRX); |
mahphalke |
17:af1f2416dd26 | 42 | |
mahphalke |
17:af1f2416dd26 | 43 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 44 | /************************ Functions Definitions *******************************/ |
mahphalke |
17:af1f2416dd26 | 45 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 46 | |
mahphalke |
17:af1f2416dd26 | 47 | /** |
mahphalke |
17:af1f2416dd26 | 48 | * @brief getchar, but does not block if nothing waiting to be read |
mahphalke |
17:af1f2416dd26 | 49 | * @param None |
mahphalke |
17:af1f2416dd26 | 50 | * @return character if available, NULL otherwise |
mahphalke |
17:af1f2416dd26 | 51 | */ |
mahphalke |
17:af1f2416dd26 | 52 | char getchar_noblock(void) |
mahphalke |
17:af1f2416dd26 | 53 | { |
mahphalke |
17:af1f2416dd26 | 54 | char rx_char = '\0'; |
mahphalke |
17:af1f2416dd26 | 55 | |
mahphalke |
17:af1f2416dd26 | 56 | // Return the character read from the serial port |
mahphalke |
17:af1f2416dd26 | 57 | if (port.readable() > 0) { |
mahphalke |
17:af1f2416dd26 | 58 | port.read(&rx_char, 1); |
mahphalke |
17:af1f2416dd26 | 59 | } |
mahphalke |
17:af1f2416dd26 | 60 | |
mahphalke |
17:af1f2416dd26 | 61 | return rx_char; |
mahphalke |
17:af1f2416dd26 | 62 | } |
mahphalke |
17:af1f2416dd26 | 63 | |
mahphalke |
17:af1f2416dd26 | 64 | |
mahphalke |
17:af1f2416dd26 | 65 | #ifdef __cplusplus // Closing extern c |
mahphalke |
17:af1f2416dd26 | 66 | } |
mahphalke |
17:af1f2416dd26 | 67 | #endif |