Created
March 3, 2015 05:37
-
-
Save edunham/51fc98d1c6d29cc8a6f8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. You will need to familiarize yourself with the C functions used to | |
communicate with the I2C device. Look at the following functions in the Linux | |
source file i2c-dev.h and describe what each one does. | |
a. i2c_smbus_read_byte(int file) | |
returns 1 byte of the file, or -1 if it couldn't access it | |
b. i2c_smbus_write_byte(int file, __u8 value) | |
writes the given value to the given file | |
c. i2c_smbus_write_byte_data(int file, __u8 value, __u8 command) | |
sets data byte to given value, and accesses the smbus using the given command | |
2. For the second part of the lab, you will need to use the QT framework to | |
implement a "painting" program using the Wii Nunchuk. Read the Qt | |
documentation provided on the class website for the QPainter, QPen and QPoint | |
classes. Define the following functions: | |
a. For QPainter: | |
void QPainter::setPen ( const QPen & pen ) | |
Sets the painter's pen to be the given pen. | |
The pen defines how to draw lines and outlines, and it also defines the text color. | |
void QPainter::drawLine ( const QLineF & line ) | |
Draws a line defined by line. example: | |
QLineF line(10.0, 80.0, 90.0, 20.0); | |
QPainter(this); | |
painter.drawLine(line); | |
b. For QPen: | |
void QPen::setColor ( const QColor & color ) | |
Sets the color of this pen's brush to the given color. | |
c. For QPoint: | |
void QPoint::setX ( int x ) | |
Sets the x coordinate of this point to the given x coordinate. | |
void QPoint::setY ( int y ) | |
Sets the y coordinate of this point to the given y coordinate. | |
3. Read the AIMB 213 User Manual with focus on the GPIO Port pins and the JFP | |
1 & JFP 2 Port pins and the Wii Nunchuk guide from the class website. Define | |
the following terms: | |
GPIO -- General Purpose Input/Output | |
pins that you can set to either input or output depending on what you | |
want them to do | |
SMBus -- System Management Bus | |
simple, two-wire bus derived from I^2 C, often used for communicating | |
with a device's power or battery | |
I2C -- Inter-Integrated Circuit | |
two-wire interface for slow communication between a motherboard and | |
its peripherals. the serial protocol can handle multiple masters, and | |
slave addresses have to be licensed from the NXP corporation for a fee. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment