This a Library that can be used to make ping pong the Nokia Lcd 5110.

Committer:
el14jpps
Date:
Thu May 05 11:55:56 2016 +0000
Revision:
1:4893a8f7147f
Parent:
0:ef8d5a4464a3
My ELEC2645 Project Jefferson Sanchez 200883251

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el14jpps 0:ef8d5a4464a3 1
el14jpps 0:ef8d5a4464a3 2 /**
el14jpps 0:ef8d5a4464a3 3 @file Paddle.h
el14jpps 0:ef8d5a4464a3 4 @brief Header file containing functions.
el14jpps 0:ef8d5a4464a3 5 */
el14jpps 0:ef8d5a4464a3 6 /**Identifications for the paddle library.
el14jpps 0:ef8d5a4464a3 7 */
el14jpps 0:ef8d5a4464a3 8 #ifndef PADDLE_H
el14jpps 0:ef8d5a4464a3 9 #define PADDLE_H
el14jpps 0:ef8d5a4464a3 10
el14jpps 0:ef8d5a4464a3 11 #include "mbed.h"
el14jpps 0:ef8d5a4464a3 12 #include "N5110.h"
el14jpps 0:ef8d5a4464a3 13
el14jpps 0:ef8d5a4464a3 14 /**
el14jpps 0:ef8d5a4464a3 15 @brief This library has been made to allow the paddle to update, check its position .etc This will make the coding later on in the main file a bit easier to manipulate.
el14jpps 0:ef8d5a4464a3 16 @brief Revision 1.0
el14jpps 0:ef8d5a4464a3 17 @author Jefferson Sanchez
el14jpps 0:ef8d5a4464a3 18 @date April 2016
el14jpps 0:ef8d5a4464a3 19 **/
el14jpps 0:ef8d5a4464a3 20
el14jpps 0:ef8d5a4464a3 21 // the class is used to store a type of variable in this case the variable is the “paddle"
el14jpps 0:ef8d5a4464a3 22 class Paddle
el14jpps 0:ef8d5a4464a3 23 {
el14jpps 0:ef8d5a4464a3 24 int x1, x2, y1, y2;// the integers are x and y
el14jpps 0:ef8d5a4464a3 25 public:
el14jpps 0:ef8d5a4464a3 26 /** The following show the connections to the K64F
el14jpps 0:ef8d5a4464a3 27 *
el14jpps 0:ef8d5a4464a3 28 * @param pin connected to PTB3 in a Digital Input
el14jpps 0:ef8d5a4464a3 29 * @param Pin Connected to PTB2 in a Digital Input
el14jpps 0:ef8d5a4464a3 30 * @param Pin connected to +5v and GND to be able to obtain a interger value.
el14jpps 0:ef8d5a4464a3 31 *
el14jpps 0:ef8d5a4464a3 32 */
el14jpps 0:ef8d5a4464a3 33 Paddle(int x_1, int x_2, int y_1, int y_2) : x1(x_1), x2(x_2), y1(y_1), y2(y_2) {}
el14jpps 0:ef8d5a4464a3 34 /** Checks to see what pixels are on in the X coordinate for player 1 and returns a value for X1.
el14jpps 0:ef8d5a4464a3 35 */
el14jpps 0:ef8d5a4464a3 36 int lookforX1();
el14jpps 0:ef8d5a4464a3 37 /** Allows to check to see what pixels are on in the X coordinate for player 2 and returns a value for X2.
el14jpps 0:ef8d5a4464a3 38 */
el14jpps 0:ef8d5a4464a3 39 int lookforX2();
el14jpps 0:ef8d5a4464a3 40 /** Checks to see what pixels are on in the Y coordinate for player 1 and returns a value for Y1 .
el14jpps 0:ef8d5a4464a3 41 */
el14jpps 0:ef8d5a4464a3 42 int lookforY1();
el14jpps 0:ef8d5a4464a3 43 /** Check to see what pixels are on in the Y coordinate for player 2 and returns a value for Y2.
el14jpps 0:ef8d5a4464a3 44 */
el14jpps 0:ef8d5a4464a3 45 int lookforY2();
el14jpps 0:ef8d5a4464a3 46 /** Once the coordinates have been obtained it will display them on the lcd.
el14jpps 0:ef8d5a4464a3 47 * for(int i = y1; i <= y2; i++)
el14jpps 0:ef8d5a4464a3 48 * {
el14jpps 0:ef8d5a4464a3 49 * display.setPixel(x1, i);
el14jpps 0:ef8d5a4464a3 50 * display.setPixel(x2, i);
el14jpps 0:ef8d5a4464a3 51 * }
el14jpps 0:ef8d5a4464a3 52
el14jpps 0:ef8d5a4464a3 53 display.refresh();
el14jpps 0:ef8d5a4464a3 54 }
el14jpps 0:ef8d5a4464a3 55 */
el14jpps 0:ef8d5a4464a3 56 void YPaddle(N5110 &display);
el14jpps 0:ef8d5a4464a3 57 /** Once the coordinates have been obtained it will update the display when the paddle moves.
el14jpps 0:ef8d5a4464a3 58 */
el14jpps 0:ef8d5a4464a3 59 void Moving_Paddle(N5110 &display);
el14jpps 0:ef8d5a4464a3 60 /** This function allow me to refresh the position of Player 1 */
el14jpps 0:ef8d5a4464a3 61 void Refresh_pos(AnalogIn &p1);
el14jpps 0:ef8d5a4464a3 62
el14jpps 0:ef8d5a4464a3 63 };
el14jpps 0:ef8d5a4464a3 64
el14jpps 0:ef8d5a4464a3 65 #endif