Platform drivers for Mbed.

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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers platform_support.cpp Source File

platform_support.cpp

Go to the documentation of this file.
00001 /***************************************************************************//**
00002  *   @file     platform_support.cpp
00003  *   @brief:   support functions and declarations for particular platform
00004  *   @details: This is a platform specific file that supports functionality
00005  *             required from application generic file. This file should be
00006  *             modified according to platform that you are working with.
00007 ********************************************************************************
00008  * Copyright (c) 2019 - 2021 Analog Devices, Inc.
00009  * All rights reserved.
00010  *
00011  * This software is proprietary to Analog Devices, Inc. and its licensors.
00012  * By using this software you agree to the terms of the associated
00013  * Analog Devices Software License Agreement.
00014 *******************************************************************************/
00015 
00016 /******************************************************************************/
00017 /************************ Includes Files **************************************/
00018 /******************************************************************************/
00019 #include <mbed.h>
00020 
00021 // Platform support needs to be C-compatible to work with other drivers
00022 #ifdef __cplusplus
00023 extern "C"
00024 {
00025 #endif
00026 
00027 #include "platform_support.h"
00028 
00029 /******************************************************************************/
00030 /********************** Variables and User defined data types *****************/
00031 /******************************************************************************/
00032 
00033 /******************************************************************************/
00034 /************************ Variable Declarations *******************************/
00035 /******************************************************************************/
00036 
00037 // Configure and instantiate UnbufferedSerial object to access the stdin.
00038 // The default mbed baud rate is 9600, unless is it overriden in the
00039 // mbed_app.json file, or by creating another UnbufferedSerial object using
00040 // the same pins.
00041 static UnbufferedSerial port(USBTX, USBRX);
00042 
00043 /******************************************************************************/
00044 /************************ Functions Definitions *******************************/
00045 /******************************************************************************/
00046 
00047 /**
00048   * @brief  getchar, but does not block if nothing waiting to be read
00049   * @param  None
00050   * @return character if available, NULL otherwise
00051   */
00052 char getchar_noblock(void)
00053 {
00054     char rx_char = '\0';
00055 
00056     // Return the character read from the serial port
00057     if (port.readable() > 0) {
00058         port.read(&rx_char, 1);
00059     }
00060 
00061     return rx_char;
00062 }
00063 
00064 
00065 #ifdef __cplusplus // Closing extern c
00066 }
00067 #endif