不韋 呂 / Mbed 2 deprecated OpenCampus_Echo

Dependencies:   mbed

AnalogIO_1ch/AdcInternal.hpp

Committer:
MikamiUitOpen
Date:
2015-08-09
Revision:
5:0af77f24af2a
Parent:
0:b027da9cfc23

File content as of revision 5:0af77f24af2a:

//------------------------------------------------------
// Class for internal ADC for signal processing
//
// Copyright (c) 2014 MIKAMI, Naoki,  2014/06/17
//------------------------------------------------------

#ifndef ADC_INTERNAL_HPP
#define ADC_INTERNAL_HPP

#include "mbed.h"

namespace Mikami
{
    class Adc
    {
    public:
        explicit Adc(PinName pin = A0)
                    : adc_(pin) {}
        float Read()
            { return 2*(adc_.read() - 0.5f); }
    private:
        Adc(const Adc&);
        Adc& operator=(const Adc&);
        AnalogIn adc_;
    };
}
#endif  // ADC_INTERNAL_HPP