PWM update

This commit is contained in:
Tristan Krause 2019-06-07 10:47:34 +02:00
parent 72c34b6ba4
commit 198feef12f
3 changed files with 7 additions and 8 deletions

View file

@ -3,12 +3,14 @@
#include <b15f/b15f.h>
#include <b15f/plottyfile.h>
const char PLOT_FILE[] = "plot.bin";
/*
* Erzeugt ein PWM Signal an PB4 mit 100KHz.
* Beste Frequenz: 31300
*/
int main()
{
B15F& drv = B15F::getInstance();
std::cout << "TOP: " << (int) drv.pwmSetFrequency(100000) << std::endl;
drv.pwmSetValue(40);
std::cout << "TOP: " << (int) drv.pwmSetFrequency(31300) << std::endl;
drv.pwmSetValue(127);
}

View file

@ -1,10 +1,6 @@
#include <iostream>
#include <cmath>
#include <b15f/b15f.h>
#include <b15f/plottyfile.h>
const char PLOT_FILE[] = "plot.bin";
/*
* Dieses Beispiel erzeugt einen 300ms langen Impuls an PB0.
*

View file

@ -202,6 +202,7 @@ public:
/**
* Setzt die Register so, dass näherungsweise die gewünschte Frequenz erzeugt wird.
* Ist freq == 0 wird PWM deaktiviert.
* Standardfrequenz: 31300 (empfohlen, da dann TOP == 255)
* \param freq PWM Frequenz
* \return Top Wert des PWM Value für die gesetzte Frequenz
* \throws DriverException