The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

helper.h

Committer:
simon.ford@mbed.co.uk
Date:
2008-04-30
Revision:
1:6b7f447ca868
Parent:
0:82220227f4fa

File content as of revision 1:6b7f447ca868:

/* mbed Microcontroller Library - Helper
 * Copyright (c) 2007-2008, sford
 */
 
#ifndef MBED_HELPER_H
#define MBED_HELPER_H

/* Section: helper
 *  A collection of useful functions not found in the standard C libraries
 */
 
namespace mbed {

/* Function: min
 *  Return the minimum of two integers
 */
int min(int a, int b);

/* Function: min
 *  Return the minimum of two floating-point numbers
 */
float min(float a, float b);

/* Function: max
 *  Return the maximum of two integers
 */
int max(int a, int b);

/* Function: max
 *  Return the maximum of two floating-point numbers
 */
float max(float a, float b);

/* Function: clamp
 *  Return the value, clamped between a minimum and maximum integer value
 */
int clamp(int value, int minimum, int maximum);

/* Function: clamp
 *  Return the value, clamped between a minimum and maximum floating-point value
 */
float clamp(float value, float minimum, float maximum);

} // namespace mbed

#endif