mbed library sources
Fork of mbed-src by
Revision 212:34d62c0b2af6, committed 2014-05-26
- Comitter:
- mbed_official
- Date:
- Mon May 26 18:15:07 2014 +0100
- Parent:
- 211:fb8edfff6ae1
- Child:
- 213:cc557cb04877
- Commit message:
- Synchronized with git revision f65b7d907785089e8dd942446f1c974b3a213a39
Full URL: https://github.com/mbedmicro/mbed/commit/f65b7d907785089e8dd942446f1c974b3a213a39/
Changed in this revision
--- a/api/BusIn.h Sun May 25 08:00:07 2014 +0100 +++ b/api/BusIn.h Mon May 26 18:15:07 2014 +0100 @@ -51,13 +51,13 @@ * An integer with each bit corresponding to the value read from the associated DigitalIn pin */ int read(); - + /** Set the input pin mode * * @param mode PullUp, PullDown, PullNone */ void mode(PinMode pull); - + #ifdef MBED_OPERATORS /** A shorthand for read() */ @@ -66,6 +66,11 @@ protected: DigitalIn* _pin[16]; + + /* disallow copy constructor and assignment operators */ +private: + BusIn(const BusIn&); + BusIn & operator = (const BusIn&); }; } // namespace mbed
--- a/api/BusInOut.h Sun May 25 08:00:07 2014 +0100 +++ b/api/BusInOut.h Mon May 26 18:15:07 2014 +0100 @@ -86,6 +86,11 @@ protected: DigitalInOut* _pin[16]; + + /* disallow copy constructor and assignment operators */ +private: + BusInOut(const BusInOut&); + BusInOut & operator = (const BusInOut&); }; } // namespace mbed
--- a/api/BusOut.h Sun May 25 08:00:07 2014 +0100 +++ b/api/BusOut.h Mon May 26 18:15:07 2014 +0100 @@ -69,6 +69,11 @@ protected: DigitalOut* _pin[16]; + + /* disallow copy constructor and assignment operators */ +private: + BusOut(const BusOut&); + BusOut & operator = (const BusOut&); }; } // namespace mbed
--- a/api/CAN.h Sun May 25 08:00:07 2014 +0100 +++ b/api/CAN.h Mon May 26 18:15:07 2014 +0100 @@ -33,7 +33,7 @@ public: /** Creates empty CAN message. */ - CANMessage() { + CANMessage() : CAN_Message() { len = 8; type = CANData; format = CANStandard; @@ -159,17 +159,17 @@ GlobalTest, SilentTest }; - + /** Change CAN operation to the specified mode * * @param mode The new operation mode (CAN::Normal, CAN::Silent, CAN::LocalTest, CAN::GlobalTest, CAN::SilentTest) * * @returns * 0 if mode change failed or unsupported, - * 1 if mode change was successful + * 1 if mode change was successful */ int mode(Mode mode); - + /** Filter out incomming messages * * @param id the id to filter on @@ -182,7 +182,7 @@ * new filter handle if successful */ int filter(unsigned int id, unsigned int mask, CANFormat format = CANAny, int handle = 0); - + /** Returns number of read errors to detect read overflow errors. */ unsigned char rderror(); @@ -202,7 +202,7 @@ BeIrq, IdIrq }; - + /** Attach a function to call whenever a CAN frame received interrupt is * generated. *
--- a/api/CallChain.h Sun May 25 08:00:07 2014 +0100 +++ b/api/CallChain.h Mon May 26 18:15:07 2014 +0100 @@ -56,7 +56,7 @@ * } * @endcode */ - + typedef FunctionPointer* pFunctionPointer_t; class CallChain { @@ -64,7 +64,7 @@ /** Create an empty chain * * @param size (optional) Initial size of the chain - */ + */ CallChain(int size = 4); virtual ~CallChain(); @@ -98,7 +98,7 @@ * The function object created for 'function' */ pFunctionPointer_t add_front(void (*function)(void)); - + /** Add a function at the beginning of the chain * * @param tptr pointer to the object to call the member function on @@ -150,7 +150,7 @@ /** Call all the functions in the chain in sequence */ void call(); - + #ifdef MBED_OPERATORS void operator ()(void) { call(); @@ -168,6 +168,11 @@ pFunctionPointer_t* _chain; int _size; int _elements; + + /* disallow copy constructor and assignment operators */ +private: + CallChain(const CallChain&); + CallChain & operator = (const CallChain&); }; } // namespace mbed
--- a/api/DigitalIn.h Sun May 25 08:00:07 2014 +0100 +++ b/api/DigitalIn.h Mon May 26 18:15:07 2014 +0100 @@ -50,7 +50,7 @@ * * @param pin DigitalIn pin to connect to */ - DigitalIn(PinName pin) { + DigitalIn(PinName pin) : gpio() { gpio_init_in(&gpio, pin); } @@ -59,7 +59,7 @@ * @param pin DigitalIn pin to connect to * @param mode the initial mode of the pin */ - DigitalIn(PinName pin, PinMode mode) { + DigitalIn(PinName pin, PinMode mode) : gpio() { gpio_init_in_ex(&gpio, pin, mode); } /** Read the input, represented as 0 or 1 (int)
--- a/api/DigitalInOut.h Sun May 25 08:00:07 2014 +0100 +++ b/api/DigitalInOut.h Mon May 26 18:15:07 2014 +0100 @@ -31,7 +31,7 @@ * * @param pin DigitalInOut pin to connect to */ - DigitalInOut(PinName pin) { + DigitalInOut(PinName pin) : gpio() { gpio_init_in(&gpio, pin); } @@ -42,7 +42,7 @@ * @param mode the initial mode of the pin * @param value the initial value of the pin if is an output */ - DigitalInOut(PinName pin, PinDirection direction, PinMode mode, int value) { + DigitalInOut(PinName pin, PinDirection direction, PinMode mode, int value) : gpio() { gpio_init_inout(&gpio, pin, direction, mode, value); }
--- a/api/DigitalOut.h Sun May 25 08:00:07 2014 +0100 +++ b/api/DigitalOut.h Mon May 26 18:15:07 2014 +0100 @@ -45,7 +45,7 @@ * * @param pin DigitalOut pin to connect to */ - DigitalOut(PinName pin) { + DigitalOut(PinName pin) : gpio() { gpio_init_out(&gpio, pin); } @@ -54,7 +54,7 @@ * @param pin DigitalOut pin to connect to * @param value the initial pin value */ - DigitalOut(PinName pin, int value){ + DigitalOut(PinName pin, int value) : gpio() { gpio_init_out_ex(&gpio, pin, value); }
--- a/api/FileBase.h Sun May 25 08:00:07 2014 +0100 +++ b/api/FileBase.h Mon May 26 18:15:07 2014 +0100 @@ -68,6 +68,11 @@ FileBase *_next; const char *_name; PathType _path_type; + + /* disallow copy constructor and assignment operators */ +private: + FileBase(const FileBase&); + FileBase & operator = (const FileBase&); }; } // namespace mbed
--- a/api/FunctionPointer.h Sun May 25 08:00:07 2014 +0100 +++ b/api/FunctionPointer.h Mon May 26 18:15:07 2014 +0100 @@ -83,10 +83,10 @@ (o->*m)(); } - void (*_function)(void); // static function pointer - 0 if none attached - void *_object; // object this pointer - 0 if none attached - char _member[16]; // raw member function pointer storage - converted back by registered _membercaller - void (*_membercaller)(void*, char*); // registered membercaller function to convert back and call _member on _object + void (*_function)(void); // static function pointer - 0 if none attached + void *_object; // object this pointer - 0 if none attached + char _member[16]; // raw member function pointer storage - converted back by registered _membercaller + void (*_membercaller)(void*, char*); // registered membercaller function to convert back and call _member on _object }; } // namespace mbed
--- a/api/SPI.h Sun May 25 08:00:07 2014 +0100 +++ b/api/SPI.h Mon May 26 18:15:07 2014 +0100 @@ -92,6 +92,10 @@ */ virtual int write(int value); +public: + virtual ~SPI() { + } + protected: spi_t _spi;
--- a/api/Serial.h Sun May 25 08:00:07 2014 +0100 +++ b/api/Serial.h Mon May 26 18:15:07 2014 +0100 @@ -59,7 +59,7 @@ protected: virtual int _getc(); - virtual int _putc(int c); + virtual int _putc(int c); }; } // namespace mbed
--- a/api/SerialBase.h Sun May 25 08:00:07 2014 +0100 +++ b/api/SerialBase.h Mon May 26 18:15:07 2014 +0100 @@ -106,11 +106,11 @@ /** Generate a break condition on the serial line */ void send_break(); - + #if DEVICE_SERIAL_FC /** Set the flow control type on the serial port * - * @param type the flow control type (Disabled, RTS, CTS, RTSCTS) + * @param type the flow control type (Disabled, RTS, CTS, RTSCTS) * @param flow1 the first flow control pin (RTS for RTS or RTSCTS, CTS for CTS) * @param flow2 the second flow control pin (CTS for RTSCTS) */ @@ -121,7 +121,8 @@ protected: SerialBase(PinName tx, PinName rx); - + virtual ~SerialBase(); + int _base_getc(); int _base_putc(int c);
--- a/api/Stream.h Sun May 25 08:00:07 2014 +0100 +++ b/api/Stream.h Mon May 26 18:15:07 2014 +0100 @@ -49,6 +49,11 @@ virtual int _getc() = 0; std::FILE *_file; + + /* disallow copy constructor and assignment operators */ +private: + Stream(const Stream&); + Stream & operator = (const Stream&); }; } // namespace mbed
--- a/api/can_helper.h Sun May 25 08:00:07 2014 +0100 +++ b/api/can_helper.h Mon May 26 18:15:07 2014 +0100 @@ -41,6 +41,9 @@ unsigned char len; // Length of data field in bytes CANFormat format; // 0 - STANDARD, 1- EXTENDED IDENTIFIER CANType type; // 0 - DATA FRAME, 1 - REMOTE FRAME + + virtual ~CAN_Message() { + } }; typedef struct CAN_Message CAN_Message;
--- a/common/CAN.cpp Sun May 25 08:00:07 2014 +0100 +++ b/common/CAN.cpp Mon May 26 18:15:07 2014 +0100 @@ -21,7 +21,7 @@ namespace mbed { -CAN::CAN(PinName rd, PinName td) { +CAN::CAN(PinName rd, PinName td) : _can(), _irq() { can_init(&_can, rd, td); can_irq_init(&_can, (&CAN::_irq_handler), (uint32_t)this); }
--- a/common/CallChain.cpp Sun May 25 08:00:07 2014 +0100 +++ b/common/CallChain.cpp Mon May 26 18:15:07 2014 +0100 @@ -3,13 +3,13 @@ namespace mbed { -CallChain::CallChain(int size) : _size(size), _elements(0) { +CallChain::CallChain(int size) : _chain(), _size(size), _elements(0) { _chain = new pFunctionPointer_t[size](); } CallChain::~CallChain() { clear(); - delete _chain; + delete _chain; } pFunctionPointer_t CallChain::add(void (*function)(void)) {
--- a/common/FileBase.cpp Sun May 25 08:00:07 2014 +0100 +++ b/common/FileBase.cpp Mon May 26 18:15:07 2014 +0100 @@ -19,10 +19,9 @@ FileBase *FileBase::_head = NULL; -FileBase::FileBase(const char *name, PathType t) { - _name = name; - _path_type = t; - +FileBase::FileBase(const char *name, PathType t) : _next(NULL), + _name(name), + _path_type(t) { if (name != NULL) { // put this object at head of the list _next = _head;
--- a/common/FileSystemLike.cpp Sun May 25 08:00:07 2014 +0100 +++ b/common/FileSystemLike.cpp Mon May 26 18:15:07 2014 +0100 @@ -29,8 +29,7 @@ off_t n; struct dirent cur_entry; - BaseDirHandle() { - n = 0; + BaseDirHandle() : n(0), cur_entry() { } virtual int closedir() {
--- a/common/FunctionPointer.cpp Sun May 25 08:00:07 2014 +0100 +++ b/common/FunctionPointer.cpp Mon May 26 18:15:07 2014 +0100 @@ -17,7 +17,9 @@ namespace mbed { -FunctionPointer::FunctionPointer(void (*function)(void)) { +FunctionPointer::FunctionPointer(void (*function)(void)): _function(), + _object(), + _membercaller() { attach(function); }
--- a/common/I2C.cpp Sun May 25 08:00:07 2014 +0100 +++ b/common/I2C.cpp Mon May 26 18:15:07 2014 +0100 @@ -21,10 +21,9 @@ I2C *I2C::_owner = NULL; -I2C::I2C(PinName sda, PinName scl) { +I2C::I2C(PinName sda, PinName scl) : _i2c(), _hz(100000) { // The init function also set the frequency to 100000 i2c_init(&_i2c, sda, scl); - _hz = 100000; // Used to avoid unnecessary frequency updates _owner = this;
--- a/common/I2CSlave.cpp Sun May 25 08:00:07 2014 +0100 +++ b/common/I2CSlave.cpp Mon May 26 18:15:07 2014 +0100 @@ -19,7 +19,7 @@ namespace mbed { -I2CSlave::I2CSlave(PinName sda, PinName scl) { +I2CSlave::I2CSlave(PinName sda, PinName scl) : _i2c() { i2c_init(&_i2c, sda, scl); i2c_frequency(&_i2c, 100000); i2c_slave_mode(&_i2c, 1);
--- a/common/InterruptIn.cpp Sun May 25 08:00:07 2014 +0100 +++ b/common/InterruptIn.cpp Mon May 26 18:15:07 2014 +0100 @@ -19,7 +19,10 @@ namespace mbed { -InterruptIn::InterruptIn(PinName pin) { +InterruptIn::InterruptIn(PinName pin) : gpio(), + gpio_irq(), + _rise(), + _fall() { gpio_irq_init(&gpio_irq, pin, (&InterruptIn::_irq_handler), (uint32_t)this); gpio_init_in(&gpio, pin); }
--- a/common/LocalFileSystem.cpp Sun May 25 08:00:07 2014 +0100 +++ b/common/LocalFileSystem.cpp Mon May 26 18:15:07 2014 +0100 @@ -107,9 +107,7 @@ return fh; } -LocalFileHandle::LocalFileHandle(FILEHANDLE fh) { - _fh = fh; - pos = 0; +LocalFileHandle::LocalFileHandle(FILEHANDLE fh) : _fh(fh), pos(0) { } int LocalFileHandle::close() { @@ -163,8 +161,7 @@ struct dirent cur_entry; XFINFO info; - LocalDirHandle() { - info.fileID = 0; + LocalDirHandle() : cur_entry(), info() { } virtual int closedir() {
--- a/common/SPI.cpp Sun May 25 08:00:07 2014 +0100 +++ b/common/SPI.cpp Mon May 26 18:15:07 2014 +0100 @@ -19,11 +19,12 @@ namespace mbed { -SPI::SPI(PinName mosi, PinName miso, PinName sclk, PinName _unused) { +SPI::SPI(PinName mosi, PinName miso, PinName sclk, PinName _unused) : + _spi(), + _bits(8), + _mode(0), + _hz(1000000) { spi_init(&_spi, mosi, miso, sclk, NC); - _bits = 8; - _mode = 0; - _hz = 1000000; spi_format(&_spi, _bits, _mode, 0); spi_frequency(&_spi, _hz); }
--- a/common/SPISlave.cpp Sun May 25 08:00:07 2014 +0100 +++ b/common/SPISlave.cpp Mon May 26 18:15:07 2014 +0100 @@ -19,11 +19,13 @@ namespace mbed { -SPISlave::SPISlave(PinName mosi, PinName miso, PinName sclk, PinName ssel) { +SPISlave::SPISlave(PinName mosi, PinName miso, PinName sclk, PinName ssel) : + _spi(), + _bits(8), + _mode(0), + _hz(1000000) + { spi_init(&_spi, mosi, miso, sclk, ssel); - _bits = 8; - _mode = 0; - _hz = 1000000; spi_format(&_spi, _bits, _mode, 1); spi_frequency(&_spi, _hz); }
--- a/common/SerialBase.cpp Sun May 25 08:00:07 2014 +0100 +++ b/common/SerialBase.cpp Mon May 26 18:15:07 2014 +0100 @@ -20,9 +20,8 @@ namespace mbed { -SerialBase::SerialBase(PinName tx, PinName rx) { +SerialBase::SerialBase(PinName tx, PinName rx) : _serial(), _baud(9600) { serial_init(&_serial, tx, rx); - _baud = 9600; serial_irq_handler(&_serial, SerialBase::_irq_handler, (uint32_t)this); } @@ -71,7 +70,7 @@ // Wait for 1.5 frames before clearing the break condition // This will have different effects on our platforms, but should // ensure that we keep the break active for at least one frame. - // We consider a full frame (1 start bit + 8 data bits bits + + // We consider a full frame (1 start bit + 8 data bits bits + // 1 parity bit + 2 stop bits = 12 bits) for computation. // One bit time (in us) = 1000000/_baud // Twelve bits: 12000000/baud delay @@ -88,16 +87,16 @@ case RTS: serial_set_flow_control(&_serial, flow_type, flow1, NC); break; - + case CTS: serial_set_flow_control(&_serial, flow_type, NC, flow1); break; - + case RTSCTS: case Disabled: serial_set_flow_control(&_serial, flow_type, flow1, flow2); break; - + default: break; }
--- a/common/Stream.cpp Sun May 25 08:00:07 2014 +0100 +++ b/common/Stream.cpp Mon May 26 18:15:07 2014 +0100 @@ -19,7 +19,7 @@ namespace mbed { -Stream::Stream(const char *name) : FileLike(name) { +Stream::Stream(const char *name) : FileLike(name), _file(NULL) { /* open ourselves */ char buf[12]; /* :0x12345678 + null byte */ std::sprintf(buf, ":%p", this);
--- a/common/Timer.cpp Sun May 25 08:00:07 2014 +0100 +++ b/common/Timer.cpp Mon May 26 18:15:07 2014 +0100 @@ -18,7 +18,7 @@ namespace mbed { -Timer::Timer() { +Timer::Timer() : _running(), _start(), _time() { reset(); }
--- a/common/TimerEvent.cpp Sun May 25 08:00:07 2014 +0100 +++ b/common/TimerEvent.cpp Mon May 26 18:15:07 2014 +0100 @@ -20,7 +20,7 @@ namespace mbed { -TimerEvent::TimerEvent() { +TimerEvent::TimerEvent() : event() { us_ticker_set_handler((&TimerEvent::irq)); }
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/ethernet_api.c Sun May 25 08:00:07 2014 +0100 +++ b/targets/hal/TARGET_NXP/TARGET_LPC176X/ethernet_api.c Mon May 26 18:15:07 2014 +0100 @@ -52,27 +52,27 @@ #define ETHERNET_ADDR_SIZE 6 -PACKED struct RX_DESC_TypeDef { /* RX Descriptor struct */ +struct RX_DESC_TypeDef { /* RX Descriptor struct */ unsigned int Packet; unsigned int Ctrl; -}; +} PACKED; typedef struct RX_DESC_TypeDef RX_DESC_TypeDef; -PACKED struct RX_STAT_TypeDef { /* RX Status struct */ +struct RX_STAT_TypeDef { /* RX Status struct */ unsigned int Info; unsigned int HashCRC; -}; +} PACKED; typedef struct RX_STAT_TypeDef RX_STAT_TypeDef; -PACKED struct TX_DESC_TypeDef { /* TX Descriptor struct */ +struct TX_DESC_TypeDef { /* TX Descriptor struct */ unsigned int Packet; unsigned int Ctrl; -}; +} PACKED; typedef struct TX_DESC_TypeDef TX_DESC_TypeDef; -PACKED struct TX_STAT_TypeDef { /* TX Status struct */ +struct TX_STAT_TypeDef { /* TX Status struct */ unsigned int Info; -}; +} PACKED; typedef struct TX_STAT_TypeDef TX_STAT_TypeDef; /* MAC Configuration Register 1 */ @@ -436,9 +436,9 @@ int regv, tout; char mac[ETHERNET_ADDR_SIZE]; unsigned int clock = clockselect(); - + LPC_SC->PCONP |= 0x40000000; /* Power Up the EMAC controller. */ - + LPC_PINCON->PINSEL2 = 0x50150105; /* Enable P1 Ethernet Pins. */ LPC_PINCON->PINSEL3 = (LPC_PINCON->PINSEL3 & ~0x0000000F) | 0x00000005; @@ -531,9 +531,9 @@ void ethernet_free() { LPC_EMAC->IntEnable &= ~(INT_RX_DONE | INT_TX_DONE); LPC_EMAC->IntClear = 0xFFFF; - + LPC_SC->PCONP &= ~0x40000000; /* Power down the EMAC controller. */ - + LPC_PINCON->PINSEL2 &= ~0x50150105; /* Disable P1 ethernet pins. */ LPC_PINCON->PINSEL3 = (LPC_PINCON->PINSEL3 & ~0x0000000F) | 0x00000000; }