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.
AnalogIO_1ch/AdcInternal.hpp
- Committer:
- MikamiUitOpen
- Date:
- 2014-07-28
- Revision:
- 0:b027da9cfc23
File content as of revision 0:b027da9cfc23:
//------------------------------------------------------
// 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