analogWriteFrequency and Teensy 3.1

Status
Not open for further replies.
I am successfully using analogWriteFrequency on pins 3 and 5 to have separate frequency outputs. I know if you call the function with the same value more than once it does some wonky things. So in my code I have to make sure what I write to the frequency output (for each timer) is different than the last write. I am doing my stuff in a real time fashion where I change the frequency constantly. I have not tried to use analogWriteFrequency (timer 2) for pins 25/32 yet.

To help us help you, post the minimum code that causes the issue. Otherwise people really don't have a good feel for what is going on with your code.
 
Oh, opps, looks like analogWriteFrequency was never updated to support those pins.

Here's an updated copy. Copy it to hardware/teensy/cores/teensy3. Please let me know if this works for you?
 

Attachments

  • pins_teensy.c
    23.5 KB · Views: 339
Oh, opps, looks like analogWriteFrequency was never updated to support those pins.

Here's an updated copy. Copy it to hardware/teensy/cores/teensy3. Please let me know if this works for you?

Thanks, it only worked in teensyduino 1.20rc2, awesome.

/////////////////////
Got a compile error when I went to test, this is w/ teensyduino 1.19 though.

C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3\pins_teensy.c:119:33: warning: 'enum IRQ_NUMBER_t' declared inside parameter list [enabled by default]
C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3\pins_teensy.c:119:33: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3\pins_teensy.c:119:46: error: parameter 1 ('irq') has incomplete type
C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3\pins_teensy.c: In function 'attachInterruptVector':
C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3\pins_teensy.c:121:2: error: '_VectorsRam' undeclared (first use in this function)
C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3\pins_teensy.c:121:2: note: each undeclared identifier is reported only once for each function it appears in
 
Last edited:
Status
Not open for further replies.
Back
Top