GithubHelp home page GithubHelp logo

Comments (7)

sensorium avatar sensorium commented on August 23, 2024

Thanks, I'll look into it.

from mozzi.

loopmasta avatar loopmasta commented on August 23, 2024

Hi sensorium, thanks for taking a look at it. Did you find a workaround for the teensy2? I am still trying to get it to work but with no success so far.

from mozzi.

sensorium avatar sensorium commented on August 23, 2024

Hi loopmasta,

could you please test this for me? Replace the "Teensy 2 hack" code at the
end of mozzi_analog.h with this below..
It compiles here, but I'm not sure if it will work with the "extern" word
at the start of the array declaration. If it doesn't work, try replacing
"extern" with "static".
Cheers.
Let me know the results.
Thanks,
Tim
//////////////////////////

// hack for Teensy 2 (ATmega32U4), which has "adc_mapping" instead of
"analog_pin_to_channel_PGM"
#if defined(AVR_ATmega32U4) && defined(CORE_TEENSY)
//pasted from hardware/arduino/variants/leonardo/pins_arduino.h, doesn't
work as of mozzi 0.01.2a
// AVR_ATmega32U4 has an unusual mapping of pins to channels
//extern const uint8_t PROGMEM analog_pin_to_channel_PGM[];
//#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM

  • (P) ) )

// look at
Arduino.app/Contents/Resources/Java/hardware/teensy/cores/teensy/pins_teensy.c

  • analogRead
    // adc_mapping is already declared in pins_teensy.c, but it's static there
    extern const uint8_t PROGMEM adc_mapping[] = {
    // 0, 1, 4, 5, 6, 7, 13, 12, 11, 10, 9, 8
    0, 1, 4, 5, 6, 7, 13, 12, 11, 10, 9, 8, 10, 11, 12, 13, 7, 6, 5, 4, 1,
    0, 8
    };
    #define analogPinToChannel(P) ( pgm_read_byte( adc_mapping + (P) ) )
    #endif

///////////////////////

On 16 June 2013 19:07, loopmasta [email protected] wrote:

Hi sensorium, thanks for taking a look at it. Did you find a workaround
for the teensy2? I am still trying to get it to work but with no success so
far.


Reply to this email directly or view it on GitHubhttps://github.com//issues/10#issuecomment-19509803
.

from mozzi.

loopmasta avatar loopmasta commented on August 23, 2024

Hi sensorium,

your code addition for the teensy2 works perfect.
Thank you very much for your help.

loopmasta

from mozzi.

autotel avatar autotel commented on August 23, 2024

Hello! Three years from this post. I am also having trouble to get mozzi working on a teensy 2.0. The error is lengthier; and far from my understanding:
`In file included from [...]\Arduino\libraries\Mozzi-1.0.2\examples\01.Basics\Sinewave\Sinewave.ino:17:0:
[...]\Arduino\libraries\Mozzi-1.0.2/MozziGuts.h:151:2: warning: #warning "AUDIO_MODE is set to STANDARD_PLUS in mozzi_config.h. If things sound wrong, check if STANDARD_PLUS is the correct AUDIO_MODE for your sketch." [-Wcpp]
#warning "AUDIO_MODE is set to STANDARD_PLUS in mozzi_config.h. If things sound wrong, check if STANDARD_PLUS is the correct AUDIO_MODE for your sketch."
^
In file included from [...]\Arduino\libraries\Mozzi-1.0.2\MozziGuts.cpp:19:0:
[...]\Arduino\libraries\Mozzi-1.0.2\MozziGuts.h:151:2: warning: #warning "AUDIO_MODE is set to STANDARD_PLUS in mozzi_config.h. If things sound wrong, check if STANDARD_PLUS is the correct AUDIO_MODE for your sketch." [-Wcpp]
#warning "AUDIO_MODE is set to STANDARD_PLUS in mozzi_config.h. If things sound wrong, check if STANDARD_PLUS is the correct AUDIO_MODE for your sketch."
^
In file included from [...]\Arduino\libraries\Mozzi-1.0.2\MozziGuts.cpp:29:0:
[...]\Arduino\libraries\Mozzi-1.0.2\utility/TimerOne.h: In function 'void startMozzi(int)':

[...]\Arduino\libraries\Mozzi-1.0.2\utility/TimerOne.h:90:22: warning: 'cycles' may be used uninitialized in this function [-Wmaybe-uninitialized]
pwmPeriod = cycles;
^
[...]\Arduino\libraries\Mozzi-1.0.2\utility/TimerOne.h:73:17: note: 'cycles' was declared here
unsigned long cycles;
^
[...]\Arduino\libraries\Mozzi-1.0.2\mozzi_utils.cpp: In function 'long int trailingZeros(long unsigned int)':
[...]\Arduino\libraries\Mozzi-1.0.2\mozzi_utils.cpp:12:24: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
return (*(uint32_t *)&f >> 23) - 0x7f;
^
[...]\Arduino\libraries\Mozzi-1.0.2\utility\FrequencyTimer2.cpp:84:65: error: no 'void FrequencyTimer2::setPeriodMicroSeconds(long unsigned int)' member function declared in class 'FrequencyTimer2'
void FrequencyTimer2::setPeriodMicroSeconds(unsigned long period) {
^
[...]\Arduino\libraries\Mozzi-1.0.2\utility\FrequencyTimer2.cpp:90:62: error: no 'void FrequencyTimer2::setPeriodCPUCycles(long unsigned int)' member function declared in class 'FrequencyTimer2'
void FrequencyTimer2::setPeriodCPUCycles(unsigned long period){
^
exit status 1
Error compiling.
`

from mozzi.

tfry-git avatar tfry-git commented on August 23, 2024

Well this report is rather old by now. @autotel are you still with us? Do you still see this error, in this, or a more recent release of Mozzi?

If so, I guess that it is a problem with a clash with a separately installed "FrequencyTimer2" library. Could you test, whether the following helps:
In Arduino\libraries\Mozzi-1.0.2\utility\FrequencyTimer2.cpp , near the top, replace #include <FrequencyTimer2.h> with #include "FrequencyTimer2.h" (i.e. quotes instead of angle brackets).

Thanks!

from mozzi.

loopmasta avatar loopmasta commented on August 23, 2024

Fix worked and the issue is far too old by now. :-)

from mozzi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.