beep length

28 views
Skip to first unread message

Anthony Toft

unread,
Jan 5, 2014, 9:54:29 PM1/5/14
to openc...@googlegroups.com

Hey folks, I am developing a module to enable “interval” training. Which is essentially a timer that counts down your period of maximum effort, followed by a timer to countdown your period of recovery.

 

I have pretty much everything working how I’d like, except for playing some notes between the periods. I’d like a series of short beeps followed by a longer beep at the switch point (kind of like “bip, bip, bip, beeeep”). I have the “bip” parts done by using

 

note shortbeep[] = {0x2588, 0x000F};

 

but when I try to make a longer note nothing seems to happen. From buzzer.h it appears that the least significant 10 bits are the duration in ms, so I have tried

 

note longbeep[] = {0x25FF, 0x000F};

 

however, this makes no sound L

 

Does anyone have any ideas as to what I may have to do to get a longer beep?

Anthony Toft

unread,
Jan 6, 2014, 9:00:36 PM1/6/14
to openc...@googlegroups.com

Looking at the code (instead of the documentation) it appears that LSB and MSB are backwards.

 

So my two beeps are

 

static note shortbeep[] = {0x7088, 0x000F};

static note longbeep[] = {0xFA08, 0x000F};

 

however…

 

        switch(current)

        {

        case 3:

        case 2:

        case 1:

                //beep

                buzzer_play(shortbeep);

                break;

        case 0:

                buzzer_play(longbeep);

                break;

         }

 

Makes 4 beeps the same, instead of the expected 3 short beeps and one long beep.

 

Any ideas?

--
You received this message because you are subscribed to the Google Groups "OpenChronos" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openchronos...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Aljaž 'g5pw' Srebrnič

unread,
Jan 18, 2014, 5:05:48 AM1/18/14
to openc...@googlegroups.com, Anthony Toft
Hey, sorry for the late response.
I’m the author of the note code. The documentation is indeed wrong, sorry! I’ll push a fix. 10 most significant bits are note duration, then two bits octave and last four are pitch. Maximum duration is thus 1024 milliseconds, but you can make a longer note by combining two notes one after another with the same pitch and octave.

It is however possible that there is a bug in the code, as I didn’t personally test the code as the buzzer on both of my chronos watches is not working!
-- 
Aljaž Srebrnič a.k.a g5pw
My public key:  http://bit.ly/g5pw_pubkey
Reply all
Reply to author
Forward
0 new messages