#include <rpiPWM.h>
Public Member Functions | |
int | getCounts () const |
int | getDivisor () const |
double | getDutyCycle () const |
double | getFrequency () const |
int | getMode () const |
rpiPWM () | |
rpiPWM (double Hz, unsigned int cnts, double duty, int m) | |
unsigned int | setCounts (const unsigned int &cnts) |
void | setDirection (int pwm_mod, int _direction) |
unsigned int | setDutyCycle (const double &duty, int pwm_no) |
unsigned int | setDutyCycleCount (const unsigned int &cnts, int pwm_no) |
unsigned int | setDutyCycleForce (const double &duty, const int &m, int pwm_no) |
unsigned int | setFrequency (const double &hz) |
unsigned int | setMode (const int &m) |
~rpiPWM () | |
Static Public Attributes | |
static const int | ERRCOUNT = 2 |
static const int | ERRDUTY = 3 |
static const int | ERRFREQ = 1 |
static const int | ERRMODE = 4 |
static const int | MSMODE = 2 |
static const int | PWMMODE = 1 |
Private Member Functions | |
void | configPWM () |
void | configPWMPin () |
volatile unsigned * | mapRegAddr (unsigned long baseAddr) |
Private Attributes | |
volatile unsigned * | clk |
unsigned int | counts |
int | direction0 |
int | direction1 |
int | dirLast0 |
int | dirLast1 |
unsigned int | divisor |
double | dutyCycle |
double | frequency |
volatile unsigned * | gpio |
int | mode |
volatile unsigned * | pwm |
Static Private Attributes | |
static const int | BCM2708_PERI_BASE = 0x3F000000 |
static const int | BLOCK_SIZE = 4096 |
static const int | CLOCK_BASE = (BCM2708_PERI_BASE + 0x101000) |
static const int | GPIO_BASE = (BCM2708_PERI_BASE + 0x200000) |
static const int | PWM_BASE = (BCM2708_PERI_BASE + 0x20C000) |
static const int | PWM_CTL = 0 |
static const int | PWM_DAT1 = 5 |
static const int | PWM_DAT2 = 9 |
static const int | PWM_RNG1 = 4 |
static const int | PWM_RNG2 = 8 |
static const int | PWMCLK_CNTL = 40 |
static const int | PWMCLK_DIV = 41 |
rpiPWM::rpiPWM | ( | ) |
rpiPWM::rpiPWM | ( | double | Hz, |
unsigned int | cnts, | ||
double | duty, | ||
int | m | ||
) |
rpiPWM::~rpiPWM | ( | ) |
void rpiPWM::configPWM | ( | ) | [private] |
void rpiPWM::configPWMPin | ( | ) | [private] |
int rpiPWM::getCounts | ( | ) | const |
int rpiPWM::getDivisor | ( | ) | const |
double rpiPWM::getDutyCycle | ( | ) | const |
double rpiPWM::getFrequency | ( | ) | const |
int rpiPWM::getMode | ( | ) | const |
volatile unsigned* rpiPWM::mapRegAddr | ( | unsigned long | baseAddr | ) | [private] |
unsigned int rpiPWM::setCounts | ( | const unsigned int & | cnts | ) |
void rpiPWM::setDirection | ( | int | pwm_mod, |
int | _direction | ||
) |
unsigned int rpiPWM::setDutyCycle | ( | const double & | duty, |
int | pwm_no | ||
) |
unsigned int rpiPWM::setDutyCycleCount | ( | const unsigned int & | cnts, |
int | pwm_no | ||
) |
unsigned int rpiPWM::setDutyCycleForce | ( | const double & | duty, |
const int & | m, | ||
int | pwm_no | ||
) |
unsigned int rpiPWM::setFrequency | ( | const double & | hz | ) |
unsigned int rpiPWM::setMode | ( | const int & | m | ) |
const int rpiPWM::BCM2708_PERI_BASE = 0x3F000000 [static, private] |
const int rpiPWM::BLOCK_SIZE = 4096 [static, private] |
volatile unsigned* rpiPWM::clk [private] |
const int rpiPWM::CLOCK_BASE = (BCM2708_PERI_BASE + 0x101000) [static, private] |
unsigned int rpiPWM::counts [private] |
int rpiPWM::direction0 [private] |
int rpiPWM::direction1 [private] |
int rpiPWM::dirLast0 [private] |
int rpiPWM::dirLast1 [private] |
unsigned int rpiPWM::divisor [private] |
double rpiPWM::dutyCycle [private] |
const int rpiPWM::ERRCOUNT = 2 [static] |
const int rpiPWM::ERRDUTY = 3 [static] |
const int rpiPWM::ERRFREQ = 1 [static] |
const int rpiPWM::ERRMODE = 4 [static] |
double rpiPWM::frequency [private] |
volatile unsigned * rpiPWM::gpio [private] |
const int rpiPWM::GPIO_BASE = (BCM2708_PERI_BASE + 0x200000) [static, private] |
int rpiPWM::mode [private] |
const int rpiPWM::MSMODE = 2 [static] |
volatile unsigned * rpiPWM::pwm [private] |
const int rpiPWM::PWM_BASE = (BCM2708_PERI_BASE + 0x20C000) [static, private] |
const int rpiPWM::PWM_CTL = 0 [static, private] |
const int rpiPWM::PWM_DAT1 = 5 [static, private] |
const int rpiPWM::PWM_DAT2 = 9 [static, private] |
const int rpiPWM::PWM_RNG1 = 4 [static, private] |
const int rpiPWM::PWM_RNG2 = 8 [static, private] |
const int rpiPWM::PWMCLK_CNTL = 40 [static, private] |
const int rpiPWM::PWMCLK_DIV = 41 [static, private] |
const int rpiPWM::PWMMODE = 1 [static] |