Skip to content

Commit

Permalink
Use correct frequency for baudrates on Teensy 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulStoffregen committed Jun 11, 2014
1 parent b4fd8b1 commit c32fb7a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion AltSoftSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,18 @@
#include "pins_arduino.h"
#endif

#if defined(__arm__) && defined(CORE_TEENSY)
#define ALTSS_BASE_FREQ F_BUS
#else
#define ALTSS_BASE_FREQ F_CPU
#endif

class AltSoftSerial : public Stream
{
public:
AltSoftSerial() { }
~AltSoftSerial() { end(); }
static void begin(uint32_t baud) { init((F_CPU + baud / 2) / baud); }
static void begin(uint32_t baud) { init((ALTSS_BASE_FREQ + baud / 2) / baud); }
static void end();
int peek();
int read();
Expand Down

0 comments on commit c32fb7a

Please sign in to comment.