Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed by
helper.h@1:6b7f447ca868, 2008-04-30 (annotated)
- Committer:
- simon.ford@mbed.co.uk
- Date:
- Wed Apr 30 15:43:24 2008 +0000
- Revision:
- 1:6b7f447ca868
- Parent:
- 0:82220227f4fa
Fixes:
- ADC bug
- Newlines at end of files
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
simon.ford@mbed.co.uk | 0:82220227f4fa | 1 | /* mbed Microcontroller Library - Helper |
simon.ford@mbed.co.uk | 0:82220227f4fa | 2 | * Copyright (c) 2007-2008, sford |
simon.ford@mbed.co.uk | 0:82220227f4fa | 3 | */ |
simon.ford@mbed.co.uk | 0:82220227f4fa | 4 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 5 | #ifndef MBED_HELPER_H |
simon.ford@mbed.co.uk | 0:82220227f4fa | 6 | #define MBED_HELPER_H |
simon.ford@mbed.co.uk | 0:82220227f4fa | 7 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 8 | /* Section: helper |
simon.ford@mbed.co.uk | 0:82220227f4fa | 9 | * A collection of useful functions not found in the standard C libraries |
simon.ford@mbed.co.uk | 0:82220227f4fa | 10 | */ |
simon.ford@mbed.co.uk | 0:82220227f4fa | 11 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 12 | namespace mbed { |
simon.ford@mbed.co.uk | 0:82220227f4fa | 13 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 14 | /* Function: min |
simon.ford@mbed.co.uk | 0:82220227f4fa | 15 | * Return the minimum of two integers |
simon.ford@mbed.co.uk | 0:82220227f4fa | 16 | */ |
simon.ford@mbed.co.uk | 0:82220227f4fa | 17 | int min(int a, int b); |
simon.ford@mbed.co.uk | 0:82220227f4fa | 18 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 19 | /* Function: min |
simon.ford@mbed.co.uk | 0:82220227f4fa | 20 | * Return the minimum of two floating-point numbers |
simon.ford@mbed.co.uk | 0:82220227f4fa | 21 | */ |
simon.ford@mbed.co.uk | 0:82220227f4fa | 22 | float min(float a, float b); |
simon.ford@mbed.co.uk | 0:82220227f4fa | 23 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 24 | /* Function: max |
simon.ford@mbed.co.uk | 0:82220227f4fa | 25 | * Return the maximum of two integers |
simon.ford@mbed.co.uk | 0:82220227f4fa | 26 | */ |
simon.ford@mbed.co.uk | 0:82220227f4fa | 27 | int max(int a, int b); |
simon.ford@mbed.co.uk | 0:82220227f4fa | 28 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 29 | /* Function: max |
simon.ford@mbed.co.uk | 0:82220227f4fa | 30 | * Return the maximum of two floating-point numbers |
simon.ford@mbed.co.uk | 0:82220227f4fa | 31 | */ |
simon.ford@mbed.co.uk | 0:82220227f4fa | 32 | float max(float a, float b); |
simon.ford@mbed.co.uk | 0:82220227f4fa | 33 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 34 | /* Function: clamp |
simon.ford@mbed.co.uk | 0:82220227f4fa | 35 | * Return the value, clamped between a minimum and maximum integer value |
simon.ford@mbed.co.uk | 0:82220227f4fa | 36 | */ |
simon.ford@mbed.co.uk | 0:82220227f4fa | 37 | int clamp(int value, int minimum, int maximum); |
simon.ford@mbed.co.uk | 0:82220227f4fa | 38 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 39 | /* Function: clamp |
simon.ford@mbed.co.uk | 0:82220227f4fa | 40 | * Return the value, clamped between a minimum and maximum floating-point value |
simon.ford@mbed.co.uk | 0:82220227f4fa | 41 | */ |
simon.ford@mbed.co.uk | 0:82220227f4fa | 42 | float clamp(float value, float minimum, float maximum); |
simon.ford@mbed.co.uk | 0:82220227f4fa | 43 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 44 | } // namespace mbed |
simon.ford@mbed.co.uk | 0:82220227f4fa | 45 | |
simon.ford@mbed.co.uk | 1:6b7f447ca868 | 46 | #endif |
simon.ford@mbed.co.uk | 1:6b7f447ca868 | 47 |