Question: ( 2 5 points ) display.c : handles all display to the LED array. It will need a global variable with type pi _ framebuffer
points display.c : handles all display to the LED array. It will need a global variable with type piframebuffertin C "global" variables are scoped only to the file in which they are defined unless other actions are taken Should have at least the following functions:
void opendisplayvoid: allocate the Pi Framebuffer device and store in a "global" variable for later use. This function should only need to be called one time when the program runs.
void closedisplayvoid: deallocate the Pi Framebuffer device if it exists and set the storage variable to NULL. Be sure this does the right thing if called before openDisplay
void displayletterchar letter, int xOffset, int yOffset : draws the provided letter on the LED array oriented so that "down" is towards the joystick, but shifted to the right by xOffset and down by yOffset. Note: the only letters you need to be able to draw are the capital initials of all partners in your group you should be able to use what you figured out for the "monogramming" assignment If any successive pair of letters would be the same, substitute a for one of them.
void cleardisplayvoid : clears the display
points input.c: will handle all interactions with the joystick. It will need a global variable of type pijoystickt Should have at least the following functions:
void openinputvoid: allocates a joystick device and prepares to accept input.
void closeinputvoid: deallocates the joystick device and set the pointer to NULL. Should do nothing if the joystick hasn't been allocated.
void checkinputvoid callbackunsigned int code int delay: checks whether the joystick has recorded any inputs using pollJoystick from the sense library
That first parameter declaration looks really weird: it means "the parameter is named callback, and the value will be a function needing an unsigned int parameter and having no return value". Note that the argument should be the actual function, not a function call! You'll use the function handler described below under main.c
The second parameter delay is a time to wait in milliseconds actually about in "double milliseconds" on my Pi You can use this as one way to modify the speed of the scrolling, but see "A Note About Velocities" below!
points scroll.h : prototypes for all the above functions for use in main.c below.
points main.c : contains the following functions:
void handlerunsigned int code: the callback function for the joystick. When the joystick is manipulated, this function will be called with a code indicating what kind of manipulation occurred. It will need to adjust various global variables to adjust the behavior of the program.
int mainvoid: arranges to set up a display and joystick by calling functions from above. Will call checkinput and displayletter repeatedly until the program should exit. The arguments to both will depend on what has happened with the joystick.
points a Makefile with at least the following targets
Rules to compile c files into o files inputo display.o and main.o
A scroll target that will combine input.o display.o and main.o into an executable called "scroll".
An all target that will depend on "scroll".
A clean target that will remove the executable scroll and all o files
A run target that will run the program, compiling it first if necessary so it should depend on scroll
Any extra targets you find helpful. For example, you may wish to include some rules for handling git tasks. Consider the benefits of having a target called commit which will commit and push the repository!
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
