CSc 4110/6110 Embedded Systems
Lab Experiment #3
Instructor: Dr. Michael Weeks
Using the iPAQ as a drawing pad
This assignment must be done individually. You are not allowed to share
your code with others. As in the previous labs,
clearly define and document your code. If you use code from an example,
you must indicate what that code is.
Let the user draw in multiple colors on the iPAQ's screen with the stylus, and save
the work.
The current color should be shown at the bottom of the screen. Assume
that the keypad is minimized when your program is in use. Input will
come from the stylus or one of the buttons on the iPAQ.
You can choose an appropriate name for the filename.
Requirements:
- Your program must remember what has already been drawn, i.e. in
the previous run as well as for any expose events.
- Allow at least 8 different colors. You choose the colors, and be
creative.
- One color should be the same as the background, and work as
an eraser.
- Drawing should be continuous from where the stylus touches the
pad until it is lifted. Use the button-release event to know when
the mouse button is no longer pressed. In other words, let the mouse
move the pointer around, but draw only when the button is pressed.
- The up and down keys (on the front of the iPAQ) should cycle
through the possible colors.
- The right-most button on the iPAQ should save the current drawing.
Display a message telling the user the drawing was saved,
and under what filename.
- The second right-most button on the iPAQ should clear the current drawing.
- The left-most button on the iPAQ should save the current drawing
and quit. Display a message telling the user
"Drawing saved under filename. Goodbye."
- When running the program again, it should read and display the
previous drawing.
The drawings do not need to be saved in a portable format like JPEG.
But your program should be able to read and display the previous image.
Colors on the iPAQ are in the format of red (5 bits), green (6 bits), and
blue (5 bits).
Questions
- How do events and interrupts compare?
Research this, describe it, and be sure to cite
sources in your answer. (This should be at least 2 pages.)
- What ways did you use to allocate and free memory? What other
ways are there?
- How much memory does your program use? How much RAM is available
on the iPAQ? How much memory does your program request when it
runs? How large could the screen be before you would run into
problems?
- Explain how you chose to save your data to a file.