8 #include "libs/LPC17xx/sLPC17xx.h" // smoothed mbed.h lib
20 Pin
* from_string(std::string value
);
22 inline bool connected(){
26 inline bool equals(const Pin
& other
) const {
27 return (this->pin
== other
.pin
) && (this->port
== other
.port
);
30 inline Pin
* as_output(){
32 this->port
->FIODIR
|= 1<<this->pin
;
36 inline Pin
* as_input(){
38 this->port
->FIODIR
&= ~(1<<this->pin
);
42 Pin
* as_open_drain(void);
44 Pin
* as_repeater(void);
52 inline bool get() const{
53 if (!this->valid
) return false;
54 return this->inverting
^ (( this->port
->FIOPIN
>> this->pin
) & 1);
57 inline void set(bool value
)
59 if (!this->valid
) return;
60 if ( this->inverting
^ value
)
61 this->port
->FIOSET
= 1 << this->pin
;
63 this->port
->FIOCLR
= 1 << this->pin
;
66 mbed::PwmOut
*hardware_pwm();
68 mbed::InterruptIn
*interrupt_pin();
70 bool is_inverting() const { return inverting
; }
71 void set_inverting(bool f
) { inverting
= f
; }
73 // these should be private, and use getters
74 LPC_GPIO_TypeDef
* port
;