Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buzzer code half written ? #8211

Closed
karabas opened this issue Nov 2, 2017 · 11 comments

Comments

Projects
None yet
7 participants
@karabas
Copy link

commented Nov 2, 2017

What is with buzzer.cpp status?
I tried to compile with SPEAKER enabled, then look into code
It seems that it was half rewritten
CRITICAL_SECTION_START;
::tone(BEEPER_PIN, state.tone.frequency, state.tone.duration);
CRITICAL_SECTION_END;


Compiling .pioenvs\LPC1768\src\src\module\probe.o
Compiling .pioenvs\LPC1768\src\src\module\scara.o
Marlin\src\libs\buzzer.cpp: In static member function 'static void Buzzer::tick()':
Marlin\src\libs\buzzer.cpp:63:11: error: '::tone' has not been declared
::tone(BEEPER_PIN, state.tone.frequency, state.tone.duration);
^~
*** [.pioenvs\LPC1768\src\src\libs\buzzer.o] Error 1
@tcm0116

This comment has been minimized.

Copy link
Contributor

commented Nov 5, 2017

The tone function from Arduino hasn't been implemented in the LPC1768 HAL, which is why it doesn't compile. I briefly looked into it, and there's a reference implementation available, but I don't have a speaker to test with.

@thinkyhead @p3p we should probably add some sanity checks to error out on Marlin features that are not yet supported in the LPC1768 HAL.

@thinkyhead

This comment has been minimized.

Copy link
Member

commented Feb 9, 2018

The buzzer is one thing that should definitely be added to the HAL, if not present.

I leave it to the devs who are more focused on the 32-bit side to apply needed patches for unimplemented features. I'll get more on the 32-bit team once I have the issue queue down to a manageable number… under 100. Currently have it whittled down to around 500.

@vivian-ng

This comment has been minimized.

Copy link

commented Oct 10, 2018

Hi, what is the status of this issue? Is it a matter of writing a tone() implementation for LPC1768? If so, there seems to be a similar library available, maybe can use #ifdef statements to wrap references to tone() and use this library function for LPC1768.
os.mbed.com: Piezo Buzzer
The page has links to an example HelloWorld and the library source code.

@thinkyhead

This comment has been minimized.

Copy link
Member

commented Oct 10, 2018

I implemented tone() for the DUE HAL. It shouldn't be very hard to port it over to the LPC1768 HAL.

@gloomyandy

This comment has been minimized.

Copy link
Contributor

commented Oct 10, 2018

Out of interest what LPC1768/display setup has a speaker?

@vivian-ng

This comment has been minimized.

Copy link

commented Oct 10, 2018

I am using a MKS Sbase with a Reprap full graphics smart controller (aka LCD12864).

@AnHardt

This comment has been minimized.

Copy link
Contributor

commented Oct 10, 2018

Reprap full graphics smart controller

Where on the sound device usually has not to be pulsed, because it has its own resonator. Just set the input high and it will make a fixed frequency tone. By our definition it has a 'buzzer', not a 'speaker'.

@gloomyandy

This comment has been minimized.

Copy link
Contributor

commented Oct 10, 2018

Yep that's the same combination I have. No need for any fancy speaker code just leave SPEAKER undefined and it will buzz away happily.

@thinkyhead

This comment has been minimized.

Copy link
Member

commented Oct 10, 2018

Can you play variable frequency tones without SPEAKER on that device?

@gloomyandy

This comment has been minimized.

Copy link
Contributor

commented Oct 10, 2018

I think it is just a simple buzzer that plays a single tone when you enable it. It's the same display and sounder used on lots of systems I don't think they normally use it as anything other than a buzzer. I suppose you might be able to modulate it in some way, but not sure it would be worth it.

@p3p

This comment has been minimized.

Copy link
Member

commented Oct 20, 2018

@karabas The feature is now implemented in the lpc176x framework.

@thinkyhead thinkyhead closed this Oct 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.