Replacement for regular GPIO (DigitalIn, DigitalOut, DigitalInOut) classes which has superior speed. (modified for use opendrain in stm32)
Fork of FastIO by
FastIO_Unsupported.h@2:1a6ed4b84590, 2014-07-04 (annotated)
- Committer:
- Sissors
- Date:
- Fri Jul 04 17:28:45 2014 +0000
- Revision:
- 2:1a6ed4b84590
Added support for unsupported targets :P
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Sissors | 2:1a6ed4b84590 | 1 | #include "mbed.h" |
Sissors | 2:1a6ed4b84590 | 2 | |
Sissors | 2:1a6ed4b84590 | 3 | typedef struct { |
Sissors | 2:1a6ed4b84590 | 4 | DigitalInOut *_pin; |
Sissors | 2:1a6ed4b84590 | 5 | } fastio_vars; |
Sissors | 2:1a6ed4b84590 | 6 | |
Sissors | 2:1a6ed4b84590 | 7 | #define INIT_PIN container._pin = new DigitalInOut(pin) |
Sissors | 2:1a6ed4b84590 | 8 | #define DESTROY_PIN delete(container._pin) |
Sissors | 2:1a6ed4b84590 | 9 | |
Sissors | 2:1a6ed4b84590 | 10 | #define SET_DIR_INPUT container._pin->input() |
Sissors | 2:1a6ed4b84590 | 11 | #define SET_DIR_OUTPUT container._pin->output() |
Sissors | 2:1a6ed4b84590 | 12 | #define SET_MODE(pull) container._pin->mode(pull) |
Sissors | 2:1a6ed4b84590 | 13 | |
Sissors | 2:1a6ed4b84590 | 14 | #define WRITE_PIN_SET container._pin->write(1) |
Sissors | 2:1a6ed4b84590 | 15 | #define WRITE_PIN_CLR container._pin->write(0) |
Sissors | 2:1a6ed4b84590 | 16 | |
Sissors | 2:1a6ed4b84590 | 17 | #define READ_PIN container._pin->read() |
Sissors | 2:1a6ed4b84590 | 18 |