Wim Huiskamp / Mbed 2 deprecated mbed_nucleo_swo

Dependencies:   SWO mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers flip.cpp Source File

flip.cpp

00001 /* mbed SWO Library
00002  *  Copyright (c) 2017, v01: WH. External declared swo
00003  *
00004  * Simple implementation for tracing via Serial Wire Output(SWO) for Cortex-M processors.
00005  * It can be used with Host PC software such as ST-LINK Utility or Segger J-Link SWO viewer.
00006  * This sample implementation ensures that output via SWO is enabled in order to guarantee
00007  * that the application does not hang.
00008  *
00009  * Permission is hereby granted, free of charge, to any person obtaining a copy
00010  * of this software and associated documentation files (the "Software"), to deal
00011  * in the Software without restriction, including without limitation the rights
00012  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00013  * copies of the Software, and to permit persons to whom the Software is
00014  * furnished to do so, subject to the following conditions:
00015  *
00016  * The above copyright notice and this permission notice shall be included in
00017  * all copies or substantial portions of the Software.
00018  *
00019  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00020  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00021  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00022  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00023  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00024  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00025  * THE SOFTWARE.
00026  */
00027  
00028 #include "mbed.h"
00029 #include "flip.h"
00030 #include "SWO.h"
00031 
00032 extern SWO_Channel swo;
00033 
00034 /**
00035 * flip()
00036 *
00037 * @brief invert value and print a string via SWO.
00038 * @param int value The value to be printed.
00039 */
00040 int flip(int value) {
00041   swo.printf(" value=%d\n\r", value);
00042   return -value;
00043 }