code petit robot pour homologation

Fork of CRAC-Strat_2017_V2 by CRAC Team

Committer:
antbig
Date:
Wed Apr 13 22:04:54 2016 +0000
Revision:
0:ad97421fb1fb
Ajout interruption fin de match

Who changed what in which revision?

UserRevisionLine numberNew contents of line
antbig 0:ad97421fb1fb 1 /* mbed Microcontroller Library - AnalogIn
antbig 0:ad97421fb1fb 2 * Copyright (c) 2006-2011 ARM Limited. All rights reserved.
antbig 0:ad97421fb1fb 3 */
antbig 0:ad97421fb1fb 4
antbig 0:ad97421fb1fb 5 #ifndef MBED_ANALOGIN_H
antbig 0:ad97421fb1fb 6 #define MBED_ANALOGIN_H
antbig 0:ad97421fb1fb 7
antbig 0:ad97421fb1fb 8 #include "device.h"
antbig 0:ad97421fb1fb 9
antbig 0:ad97421fb1fb 10 #if DEVICE_ANALOGIN
antbig 0:ad97421fb1fb 11
antbig 0:ad97421fb1fb 12 #include "platform.h"
antbig 0:ad97421fb1fb 13 #include "PinNames.h"
antbig 0:ad97421fb1fb 14 #include "PeripheralNames.h"
antbig 0:ad97421fb1fb 15 #include "Base.h"
antbig 0:ad97421fb1fb 16
antbig 0:ad97421fb1fb 17 namespace mbed {
antbig 0:ad97421fb1fb 18
antbig 0:ad97421fb1fb 19 /* Class: AnalogIn
antbig 0:ad97421fb1fb 20 * An analog input, used for reading the voltage on a pin
antbig 0:ad97421fb1fb 21 *
antbig 0:ad97421fb1fb 22 * Example:
antbig 0:ad97421fb1fb 23 * > // Print messages when the AnalogIn is greater than 50%
antbig 0:ad97421fb1fb 24 * >
antbig 0:ad97421fb1fb 25 * > #include "mbed.h"
antbig 0:ad97421fb1fb 26 * >
antbig 0:ad97421fb1fb 27 * > AnalogIn temperature(p20);
antbig 0:ad97421fb1fb 28 * >
antbig 0:ad97421fb1fb 29 * > int main() {
antbig 0:ad97421fb1fb 30 * > while(1) {
antbig 0:ad97421fb1fb 31 * > if(temperature > 0.5) {
antbig 0:ad97421fb1fb 32 * > printf("Too hot! (%f)", temperature.read());
antbig 0:ad97421fb1fb 33 * > }
antbig 0:ad97421fb1fb 34 * > }
antbig 0:ad97421fb1fb 35 * > }
antbig 0:ad97421fb1fb 36 */
antbig 0:ad97421fb1fb 37 class AnalogIn : public Base {
antbig 0:ad97421fb1fb 38
antbig 0:ad97421fb1fb 39 public:
antbig 0:ad97421fb1fb 40
antbig 0:ad97421fb1fb 41 /* Constructor: AnalogIn
antbig 0:ad97421fb1fb 42 * Create an AnalogIn, connected to the specified pin
antbig 0:ad97421fb1fb 43 *
antbig 0:ad97421fb1fb 44 * Variables:
antbig 0:ad97421fb1fb 45 * pin - AnalogIn pin to connect to
antbig 0:ad97421fb1fb 46 * name - (optional) A string to identify the object
antbig 0:ad97421fb1fb 47 */
antbig 0:ad97421fb1fb 48 AnalogIn(PinName pin, const char *name = NULL);
antbig 0:ad97421fb1fb 49
antbig 0:ad97421fb1fb 50 /* Function: read
antbig 0:ad97421fb1fb 51 * Read the input voltage, represented as a float in the range [0.0, 1.0]
antbig 0:ad97421fb1fb 52 *
antbig 0:ad97421fb1fb 53 * Variables:
antbig 0:ad97421fb1fb 54 * returns - A floating-point value representing the current input voltage,
antbig 0:ad97421fb1fb 55 * measured as a percentage
antbig 0:ad97421fb1fb 56 */
antbig 0:ad97421fb1fb 57 float read();
antbig 0:ad97421fb1fb 58
antbig 0:ad97421fb1fb 59 /* Function: read_u16
antbig 0:ad97421fb1fb 60 * Read the input voltage, represented as an unsigned short in the range [0x0, 0xFFFF]
antbig 0:ad97421fb1fb 61 *
antbig 0:ad97421fb1fb 62 * Variables:
antbig 0:ad97421fb1fb 63 * returns - 16-bit unsigned short representing the current input voltage,
antbig 0:ad97421fb1fb 64 * normalised to a 16-bit value
antbig 0:ad97421fb1fb 65 */
antbig 0:ad97421fb1fb 66 unsigned short read_u16();
antbig 0:ad97421fb1fb 67
antbig 0:ad97421fb1fb 68 #ifdef MBED_OPERATORS
antbig 0:ad97421fb1fb 69 /* Function: operator float
antbig 0:ad97421fb1fb 70 * An operator shorthand for <read()>
antbig 0:ad97421fb1fb 71 *
antbig 0:ad97421fb1fb 72 * The float() operator can be used as a shorthand for <read()> to simplify common code sequences
antbig 0:ad97421fb1fb 73 *
antbig 0:ad97421fb1fb 74 * Example:
antbig 0:ad97421fb1fb 75 * > float x = volume.read();
antbig 0:ad97421fb1fb 76 * > float x = volume;
antbig 0:ad97421fb1fb 77 * >
antbig 0:ad97421fb1fb 78 * > if(volume.read() > 0.25) { ... }
antbig 0:ad97421fb1fb 79 * > if(volume > 0.25) { ... }
antbig 0:ad97421fb1fb 80 */
antbig 0:ad97421fb1fb 81 operator float();
antbig 0:ad97421fb1fb 82 #endif
antbig 0:ad97421fb1fb 83
antbig 0:ad97421fb1fb 84 #ifdef MBED_RPC
antbig 0:ad97421fb1fb 85 virtual const struct rpc_method *get_rpc_methods();
antbig 0:ad97421fb1fb 86 static struct rpc_class *get_rpc_class();
antbig 0:ad97421fb1fb 87 #endif
antbig 0:ad97421fb1fb 88
antbig 0:ad97421fb1fb 89 protected:
antbig 0:ad97421fb1fb 90
antbig 0:ad97421fb1fb 91 ADCName _adc;
antbig 0:ad97421fb1fb 92
antbig 0:ad97421fb1fb 93 };
antbig 0:ad97421fb1fb 94
antbig 0:ad97421fb1fb 95 } // namespace mbed
antbig 0:ad97421fb1fb 96
antbig 0:ad97421fb1fb 97 #endif
antbig 0:ad97421fb1fb 98
antbig 0:ad97421fb1fb 99 #endif