Skip to content

Commit

Permalink
Merge pull request #2 from mbedmicro/master
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
NitinBhaskar committed Feb 13, 2015
2 parents b6885d1 + fba1390 commit 1ad67de
Show file tree
Hide file tree
Showing 287 changed files with 28,230 additions and 10,755 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ NXP:
* LPC810 (Cortex-M0+)
* [LPC812](http://developer.mbed.org/platforms/NXP-LPC800-MAX/) (Cortex-M0+)
* [EA LPC4088](http://developer.mbed.org/platforms/EA-LPC4088/) (Cortex-M4F)
* [EA LPC4088 DM](http://developer.mbed.org/platforms/EA-LPC4088-Display-Module/) (Cortex-M4F)
* LPC4330 (Cortex-M4F + Cortex-M0)
* [LPC1347](http://developer.mbed.org/platforms/DipCortex-M3/) (Cortex-M3)
* [LPC1114](http://developer.mbed.org/platforms/LPC1114FN28/) (Cortex-M0)
Expand Down
2 changes: 1 addition & 1 deletion libraries/USBDevice/USBDevice/USBEndpoints.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ typedef enum {
} EP_STATUS;

/* Include configuration for specific target */
#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC4088)
#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC4088) || defined(TARGET_LPC4088_DM)
#include "USBEndpoints_LPC17_LPC23.h"
#elif defined(TARGET_LPC11UXX) || defined(TARGET_LPC1347) || defined (TARGET_LPC11U6X) || defined (TARGET_LPC1549)
#include "USBEndpoints_LPC11U.h"
Expand Down
2 changes: 1 addition & 1 deletion libraries/USBDevice/USBDevice/USBHAL_LPC40.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#if defined(TARGET_LPC4088)
#if defined(TARGET_LPC4088) || defined(TARGET_LPC4088_DM)

#include "USBHAL.h"

Expand Down
20 changes: 20 additions & 0 deletions libraries/mbed/api/BusIn.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,35 @@ class BusIn {
*/
void mode(PinMode pull);

/** Binary mask of bus pins connected to actual pins (not NC pins)
* If bus pin is in NC state make corresponding bit will be cleared (set to 0), else bit will be set to 1
*
* @returns
* Binary mask of connected pins
*/
int mask() {
return _nc_mask;
}

#ifdef MBED_OPERATORS
/** A shorthand for read()
*/
operator int();

/** Access to particular bit in random-iterator fashion
*/
DigitalIn & operator[] (int index);
#endif

protected:
DigitalIn* _pin[16];

/** Mask of bus's NC pins
* If bit[n] is set to 1 - pin is connected
* if bit[n] is cleared - pin is not connected (NC)
*/
int _nc_mask;

/* disallow copy constructor and assignment operators */
private:
BusIn(const BusIn&);
Expand Down
21 changes: 20 additions & 1 deletion libraries/mbed/api/BusInOut.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class BusInOut {
*/
void write(int value);


/** Read the value currently output on the bus
*
* @returns
Expand All @@ -73,12 +72,26 @@ class BusInOut {
*/
void mode(PinMode pull);

/** Binary mask of bus pins connected to actual pins (not NC pins)
* If bus pin is in NC state make corresponding bit will be cleared (set to 0), else bit will be set to 1
*
* @returns
* Binary mask of connected pins
*/
int mask() {
return _nc_mask;
}

#ifdef MBED_OPERATORS
/** A shorthand for write()
*/
BusInOut& operator= (int v);
BusInOut& operator= (BusInOut& rhs);

/** Access to particular bit in random-iterator fashion
*/
DigitalInOut& operator[] (int index);

/** A shorthand for read()
*/
operator int();
Expand All @@ -87,6 +100,12 @@ class BusInOut {
protected:
DigitalInOut* _pin[16];

/** Mask of bus's NC pins
* If bit[n] is set to 1 - pin is connected
* if bit[n] is cleared - pin is not connected (NC)
*/
int _nc_mask;

/* disallow copy constructor and assignment operators */
private:
BusInOut(const BusInOut&);
Expand Down
20 changes: 20 additions & 0 deletions libraries/mbed/api/BusOut.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,26 @@ class BusOut {
*/
int read();

/** Binary mask of bus pins connected to actual pins (not NC pins)
* If bus pin is in NC state make corresponding bit will be cleared (set to 0), else bit will be set to 1
*
* @returns
* Binary mask of connected pins
*/
int mask() {
return _nc_mask;
}

#ifdef MBED_OPERATORS
/** A shorthand for write()
*/
BusOut& operator= (int v);
BusOut& operator= (BusOut& rhs);

/** Access to particular bit in random-iterator fashion
*/
DigitalOut& operator[] (int index);

/** A shorthand for read()
*/
operator int();
Expand All @@ -70,6 +84,12 @@ class BusOut {
protected:
DigitalOut* _pin[16];

/** Mask of bus's NC pins
* If bit[n] is set to 1 - pin is connected
* if bit[n] is cleared - pin is not connected (NC)
*/
int _nc_mask;

/* disallow copy constructor and assignment operators */
private:
BusOut(const BusOut&);
Expand Down
10 changes: 10 additions & 0 deletions libraries/mbed/api/DigitalIn.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ class DigitalIn {
gpio_mode(&gpio, pull);
}

/** Return the output setting, represented as 0 or 1 (int)
*
* @returns
* Non zero value if pin is connected to uc GPIO
* 0 if gpio object was initialized with NC
*/
int is_connected() {
return gpio_is_connected(&gpio);
}

#ifdef MBED_OPERATORS
/** An operator shorthand for read()
*/
Expand Down
10 changes: 10 additions & 0 deletions libraries/mbed/api/DigitalInOut.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ class DigitalInOut {
gpio_mode(&gpio, pull);
}

/** Return the output setting, represented as 0 or 1 (int)
*
* @returns
* Non zero value if pin is connected to uc GPIO
* 0 if gpio object was initialized with NC
*/
int is_connected() {
return gpio_is_connected(&gpio);
}

#ifdef MBED_OPERATORS
/** A shorthand for write()
*/
Expand Down
10 changes: 10 additions & 0 deletions libraries/mbed/api/DigitalOut.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ class DigitalOut {
return gpio_read(&gpio);
}

/** Return the output setting, represented as 0 or 1 (int)
*
* @returns
* Non zero value if pin is connected to uc GPIO
* 0 if gpio object was initialized with NC
*/
int is_connected() {
return gpio_is_connected(&gpio);
}

#ifdef MBED_OPERATORS
/** A shorthand for write()
*/
Expand Down
2 changes: 1 addition & 1 deletion libraries/mbed/api/mbed.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#ifndef MBED_H
#define MBED_H

#define MBED_LIBRARY_VERSION 92
#define MBED_LIBRARY_VERSION 93

#include "platform.h"

Expand Down
16 changes: 16 additions & 0 deletions libraries/mbed/common/BusIn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,29 @@
* limitations under the License.
*/
#include "BusIn.h"
#include "mbed_assert.h"

namespace mbed {

BusIn::BusIn(PinName p0, PinName p1, PinName p2, PinName p3, PinName p4, PinName p5, PinName p6, PinName p7, PinName p8, PinName p9, PinName p10, PinName p11, PinName p12, PinName p13, PinName p14, PinName p15) {
PinName pins[16] = {p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15};

_nc_mask = 0;
for (int i=0; i<16; i++) {
_pin[i] = (pins[i] != NC) ? new DigitalIn(pins[i]) : 0;
if (pins[i] != NC) {
_nc_mask |= (1 << i);
}
}
}

BusIn::BusIn(PinName pins[16]) {
_nc_mask = 0;
for (int i=0; i<16; i++) {
_pin[i] = (pins[i] != NC) ? new DigitalIn(pins[i]) : 0;
if (pins[i] != NC) {
_nc_mask |= (1 << i);
}
}
}

Expand Down Expand Up @@ -61,6 +70,13 @@ void BusIn::mode(PinMode pull) {
BusIn::operator int() {
return read();
}

DigitalIn& BusIn::operator[] (int index) {
MBED_ASSERT(index >= 0 && index <= 16);
MBED_ASSERT(_pin[index]);
return *_pin[index];
}

#endif

} // namespace mbed
15 changes: 15 additions & 0 deletions libraries/mbed/common/BusInOut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,29 @@
* limitations under the License.
*/
#include "BusInOut.h"
#include "mbed_assert.h"

namespace mbed {

BusInOut::BusInOut(PinName p0, PinName p1, PinName p2, PinName p3, PinName p4, PinName p5, PinName p6, PinName p7, PinName p8, PinName p9, PinName p10, PinName p11, PinName p12, PinName p13, PinName p14, PinName p15) {
PinName pins[16] = {p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15};

_nc_mask = 0;
for (int i=0; i<16; i++) {
_pin[i] = (pins[i] != NC) ? new DigitalInOut(pins[i]) : 0;
if (pins[i] != NC) {
_nc_mask |= (1 << i);
}
}
}

BusInOut::BusInOut(PinName pins[16]) {
_nc_mask = 0;
for (int i=0; i<16; i++) {
_pin[i] = (pins[i] != NC) ? new DigitalInOut(pins[i]) : 0;
if (pins[i] != NC) {
_nc_mask |= (1 << i);
}
}
}

Expand Down Expand Up @@ -92,6 +101,12 @@ BusInOut& BusInOut::operator= (BusInOut& rhs) {
return *this;
}

DigitalInOut& BusInOut::operator[] (int index) {
MBED_ASSERT(index >= 0 && index <= 16);
MBED_ASSERT(_pin[index]);
return *_pin[index];
}

BusInOut::operator int() {
return read();
}
Expand Down
15 changes: 15 additions & 0 deletions libraries/mbed/common/BusOut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,29 @@
* limitations under the License.
*/
#include "BusOut.h"
#include "mbed_assert.h"

namespace mbed {

BusOut::BusOut(PinName p0, PinName p1, PinName p2, PinName p3, PinName p4, PinName p5, PinName p6, PinName p7, PinName p8, PinName p9, PinName p10, PinName p11, PinName p12, PinName p13, PinName p14, PinName p15) {
PinName pins[16] = {p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15};

_nc_mask = 0;
for (int i=0; i<16; i++) {
_pin[i] = (pins[i] != NC) ? new DigitalOut(pins[i]) : 0;
if (pins[i] != NC) {
_nc_mask |= (1 << i);
}
}
}

BusOut::BusOut(PinName pins[16]) {
_nc_mask = 0;
for (int i=0; i<16; i++) {
_pin[i] = (pins[i] != NC) ? new DigitalOut(pins[i]) : 0;
if (pins[i] != NC) {
_nc_mask |= (1 << i);
}
}
}

Expand Down Expand Up @@ -68,6 +77,12 @@ BusOut& BusOut::operator= (BusOut& rhs) {
return *this;
}

DigitalOut& BusOut::operator[] (int index) {
MBED_ASSERT(index >= 0 && index <= 16);
MBED_ASSERT(_pin[index]);
return *_pin[index];
}

BusOut::operator int() {
return read();
}
Expand Down
46 changes: 0 additions & 46 deletions libraries/mbed/common/exit.c

This file was deleted.

Loading

0 comments on commit 1ad67de

Please sign in to comment.