NW   NE
 

Sharp Zaurus Developer Information

Corrections and Comments: Spencer Huang
 
SW   SE
NW   NE
 
Howtos

Upgrading The ROM

Connectivity
Wireless 802.11b

Linux Connectivity
Generic (USB)
Debian (USB)
Red Hat (USB)
Suse (USB)
Mandrake (USB)
Generic (PPP USB)
Generic (PPP Serial)

Windows Connectivity
Win2K (Serial)
Win98se (Serial)
WinMe Over (Serial)
WinNTSP6 (Serial)
WinXP Over (Serial)

Developing
Compiler Setup
Compiling the Kernel
Special Considerations
Checklist
System Layout
Application Help Files
IPKG Howto
Buzzer Howto
Led Howto
IrDa Howto
Audio Howto
Fullscreen Howto
Resume Event
Keys
Turning off the screen

Syncing
Linux
Win2K
Wireless

Other
Wireless Comparison
The Z Boot Process
Ipv6 Setup
Servers Setup
SD And CF FAQ
Setting Up A Feed
Converting TTF fonts
Building a ROM
MPEG Encoding

Downloads
ZaurusZone Feed
Links
 
SW   SE
NW   NE
  Howto utilize the buzzer on the Zaurus

1) Intro

The Sharp Zaurus doesn't have a built in speaker, but it does have a a "buzzer" type audio device. This audio device can make rudimentary sound as defined in "sharp_char.h"

2) Basics

If you wish to use the buzzer in your application you need to do at least the following three things:

Include sharp_char.h into your application to use the defines.  The header is installed in : /opt/Embedix/tools/arm-linux/include/asm/ so you may want to manually copy the file locally or create a sym-link to the file into the local directory.

#include <sharp_char.h>

Open /dev/sharp_buz. Use normal error checking here.

int fd= open("/dev/sharp_buz", O_WRONLY);

Make an ioctl cal on /dev/sharp_buz replacing SHARP_BUZ_TOUCHSOUND with your desired sound from sharp_char.h

ioctl(fd, SHARP_BUZZER_MAKESOUND, SHARP_BUZ_TOUCHSOUND);

There's only 3 sounds that have any actual data to send through the buzzer device. (Until they add them to the device driver). The warning sound and alarm sound are the same.

#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
#define SHARP_BUZ_KEYSOUND 2 /* key sound */
#define SHARP_PDA_WARNSOUND 4 /* warning occurred */
#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */

3) Example

Download example source and binary in a tar.gz file here.

This test program will open the driver and cycles through all the buzzer sounds. (Make sure to compile it for arm so you can run it on the Zaurus)

Create the makefile with:
# tmake -o Makefile buz.pro

Then build the binary:
# make

Once it is done compiling copy the binary (buz) to the Zaurus and run from command line to hear the results.

---- buz.c -----
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/types.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <unistd.h>

#include <sharp_char.h>

int main(){
  int stat, fd;
  int i;

  fd= open("/dev/sharp_buz", O_WRONLY);
  if(fd == -1){
    perror("/dev/sharp_buz");
    return(1);
  }

  for(i=1;i<=14;i++){
    printf("Sound: %d\n", i);
    stat= ioctl(fd, SHARP_BUZZER_MAKESOUND, i);
    if(stat == -1){
      perror("ioctl");
    }
    tcdrain (fd);
  }

  close(fd);
  return(0);
}

--- buz.pro ----
TEMPLATE = app
#CONFIG = qt warn_on debug
CONFIG = qt warn_on release
SOURCES = buz.c
TARGET = buz

 
SW   SE

    This page was last updated: Wednesday, 09-Apr-2003 04:57:10 PDT