|
PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
|
1 #ifndef LIBPROPELLER_PIN_H_
2 #define LIBPROPELLER_PIN_H_
5 #define INLINE __attribute__((always_inline)) inline
112 void pwm(
const int decihz,
const bool useCTRA =
true,
Pin * alternatePin = NULL) {
116 const int frq = (decihz * (((1 << 30) /
CLKFREQ) << 2)) / 10;
117 int ctr = (0b00101000 << 23) + pinNumber;
119 if(alternatePin != NULL){
120 ctr += alternatePin->getPin() << 9;
121 alternatePin->setOutput();
143 unsigned int pin_mask;
185 return (
DIRA & pin_mask) ? true :
false;
190 return (
INA & pin_mask) != 0;
193 INLINE
void libpropeller::Pin::setOutput() {
197 #endif // LIBPROPELLER_PIN_H_
#define OUTA
Use to set output pin states when corresponding DIRA bits are 1.
#define INA
Use to read the pins when corresponding DIRA bits are 0.
#define FRQA
Counter A frequency register.
void pwm(const int decihz, const bool useCTRA=true, Pin *alternatePin=NULL)
#define FRQB
Counter B frequency register.
#define CLKFREQ
Returns the current clock frequency.
#define CTRB
Counter B control register.
#define DIRA
Use to set pins to input (0) or output (1).
#define CTRA
Counter A control register.