Question: ( 2 5 points ) display.c : handles all display to the LED array. It will need a global variable with type pi _ framebuffer

(25 points) display.c : handles all display to the LED array. It will need a global variable with type pi_framebuffer_t*.(in 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 open_display(void): 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 close_display(void): 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 display_letter(char 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 '3' for one of them.
void clear_display(void) : clears the display
(25 points) input.c: will handle all interactions with the joystick. It will need a global variable of type pi_joystick_t*. Should have at least the following functions:
void open_input(void): allocates a joystick device and prepares to accept input.
void close_input(void): deallocates the joystick device and set the pointer to NULL. Should do nothing if the joystick hasn't been allocated.
void check_input(void (*callback)(unsigned 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!
(5 points) scroll.h : prototypes for all the above functions for use in main.c below.
(25 points) main.c : contains the following functions:
void handler(unsigned 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 main(void): arranges to set up a display and joystick by calling functions from above. Will call check_input and display_letter repeatedly until the program should exit. The arguments to both will depend on what has happened with the joystick.
(20 points) a Makefile with (at least) the following targets
Rules to compile .c files into .o files (input.o, 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!