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.
Fork of FastIO by
Revision 2:1a6ed4b84590, committed 2014-07-04
- Comitter:
- Sissors
- Date:
- Fri Jul 04 17:28:45 2014 +0000
- Parent:
- 1:85a4a54f15e3
- Child:
- 3:3dd9466e73fc
- Commit message:
- Added support for unsupported targets :P
Changed in this revision
--- a/FastIO.h Wed Jul 02 06:01:51 2014 +0000
+++ b/FastIO.h Fri Jul 04 17:28:45 2014 +0000
@@ -7,7 +7,9 @@
#include "FastIO_KLXX.h"
#ifndef INIT_PIN
-#error Target is not supported
+#warning Target is not supported by FastIO
+#warning Reverting to regular DigitalInOut
+#include "FastIO_Unsupported.h"
#endif
#include "mbed.h"
@@ -36,6 +38,10 @@
FastInOut() {
INIT_PIN;
}
+
+ ~FastInOut() {
+ DESTROY_PIN;
+ }
void write(int value) {
if ( value )
--- a/FastIO_KLXX.h Wed Jul 02 06:01:51 2014 +0000 +++ b/FastIO_KLXX.h Fri Jul 04 17:28:45 2014 +0000 @@ -12,6 +12,7 @@ #define PCR ((__IO uint32_t*)(PORTA_BASE + pin)) #define INIT_PIN container.mask = PINMASK; pin_function(pin, 1) +#define DESTROY_PIN #define SET_DIR_INPUT (PORT_BASE->PDDR &= ~PINMASK) #define SET_DIR_OUTPUT (PORT_BASE->PDDR |= PINMASK)
--- a/FastIO_LPC11UXX.h Wed Jul 02 06:01:51 2014 +0000 +++ b/FastIO_LPC11UXX.h Fri Jul 04 17:28:45 2014 +0000 @@ -12,6 +12,7 @@ static inline void initpin(PinName pin); #define INIT_PIN container.mask = PINMASK; initpin(pin) +#define DESTROY_PIN #define SET_DIR_INPUT (LPC_GPIO->DIR[PORT] &= ~PINMASK) #define SET_DIR_OUTPUT (LPC_GPIO->DIR[PORT] |= PINMASK)
--- a/FastIO_LPC1768.h Wed Jul 02 06:01:51 2014 +0000 +++ b/FastIO_LPC1768.h Fri Jul 04 17:28:45 2014 +0000 @@ -14,6 +14,7 @@ #define PINSELMASK (0x03 << (((pin - P0_0)%16)*2) ) #define INIT_PIN container.mask = PINMASK; (PINSELREG &= ~PINSELMASK) +#define DESTROY_PIN #define SET_DIR_INPUT (LPC_GPIO->FIODIR &= ~PINMASK) #define SET_DIR_OUTPUT (LPC_GPIO->FIODIR |= PINMASK)
--- a/FastIO_LPC81X.h Wed Jul 02 06:01:51 2014 +0000 +++ b/FastIO_LPC81X.h Fri Jul 04 17:28:45 2014 +0000 @@ -12,6 +12,7 @@ static void gpio_enable(void); #define INIT_PIN container.mask = PINMASK; container.reg_in = &LPC_GPIO_PORT->PIN0; gpio_enable(); pin_function(pin, 0) +#define DESTROY_PIN #define SET_DIR_INPUT (LPC_GPIO_PORT->DIR0 &= ~PINMASK) #define SET_DIR_OUTPUT (LPC_GPIO_PORT->DIR0 |= PINMASK)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/FastIO_Unsupported.h Fri Jul 04 17:28:45 2014 +0000
@@ -0,0 +1,18 @@
+#include "mbed.h"
+
+typedef struct {
+ DigitalInOut *_pin;
+} fastio_vars;
+
+#define INIT_PIN container._pin = new DigitalInOut(pin)
+#define DESTROY_PIN delete(container._pin)
+
+#define SET_DIR_INPUT container._pin->input()
+#define SET_DIR_OUTPUT container._pin->output()
+#define SET_MODE(pull) container._pin->mode(pull)
+
+#define WRITE_PIN_SET container._pin->write(1)
+#define WRITE_PIN_CLR container._pin->write(0)
+
+#define READ_PIN container._pin->read()
+
