8 #include "libs/LPC17xx/sLPC17xx.h" // smoothed mbed.h lib
14 Pin
* from_string(std::string value
);
16 inline bool connected(){
20 inline bool equals(const Pin
& other
) const {
21 return (this->pin
== other
.pin
) && (this->port
== other
.port
);
24 inline Pin
* as_output(){
26 this->port
->FIODIR
|= 1<<this->pin
;
30 inline Pin
* as_input(){
32 this->port
->FIODIR
&= ~(1<<this->pin
);
36 Pin
* as_open_drain(void);
38 Pin
* as_repeater(void);
47 if (!this->valid
) return false;
48 return this->inverting
^ (( this->port
->FIOPIN
>> this->pin
) & 1);
51 inline void set(bool value
)
53 if (!this->valid
) return;
54 if ( this->inverting
^ value
)
55 this->port
->FIOSET
= 1 << this->pin
;
57 this->port
->FIOCLR
= 1 << this->pin
;
60 // these should be private, and use getters
61 LPC_GPIO_TypeDef
* port
;