Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SerialWireOutput.h Source File

SerialWireOutput.h

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2017-2019 ARM Limited
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #ifndef MBED_SERIALWIREOUTPUT_H
00019 #define MBED_SERIALWIREOUTPUT_H
00020 
00021 #include "platform/platform.h"
00022 
00023 #if defined(DEVICE_ITM)
00024 
00025 #include "platform/FileHandle.h"
00026 
00027 namespace mbed {
00028 /**
00029  * \defgroup drivers_SerialWireOutput SerialWireOutput class
00030  * \ingroup drivers-public-api
00031  * @{
00032  */
00033 
00034 class SerialWireOutput : public FileHandle {
00035 
00036 public:
00037 
00038     SerialWireOutput(void);
00039 
00040     virtual ssize_t write(const void *buffer, size_t size);
00041 
00042     virtual ssize_t read(void *buffer, size_t size)
00043     {
00044         /* Reading is not supported by this file handle */
00045         return -EBADF;
00046     }
00047 
00048     virtual off_t seek(off_t offset, int whence = SEEK_SET)
00049     {
00050         /* Seeking is not support by this file handler */
00051         return -ESPIPE;
00052     }
00053 
00054     virtual off_t size()
00055     {
00056         /* Size is not defined for this file handle */
00057         return -EINVAL;
00058     }
00059 
00060     virtual int isatty()
00061     {
00062         /* File handle is used for terminal output */
00063         return true;
00064     }
00065 
00066     virtual int close()
00067     {
00068         return 0;
00069     }
00070 };
00071 
00072 /** @}*/
00073 
00074 } // namespace mbed
00075 
00076 #endif // DEVICE_ITM
00077 
00078 #endif // MBED_SERIALWIREOUTPUT_H