|
TTK4155 Lab Node 1
Term project in the NTNU course TTK4155 Embedded and Industrial Computer Systems Design
|
Data Structures | |
| struct | oled_font |
| Represents a font for OLED displays. More... | |
| struct | io_avr_device |
| Represents an SPI-connected AVR-I/O board. More... | |
| struct | io_oled_device |
| Represents an OLED display device controlled via SPI. More... | |
| struct | io_joystick_device |
| Represents a joystick input device. More... | |
| struct | io_joystick_position |
| Represents the position of a joystick relative to center. More... | |
Enumerations | |
| enum | io_joystick_direction { LEFT , RIGHT , UP , DOWN , NEUTRAL } |
| Predefined joystick directions. More... | |
Functions | |
| struct | __attribute__ ((packed)) io_avr_buttons |
| Represents button states for I/O boards (from I/O board manual). | |
| int | io_joystick_init (struct io_joystick_device *dev) |
| Initialise and calibrate a joystick. | |
| int | io_joystick_read_position (struct io_joystick_device *dev, struct io_joystick_position *buffer) |
| Read the position of a joystick as a percentage from 0 in each axis. | |
| int | io_joystick_read_direction (struct io_joystick_device *dev, enum io_joystick_direction *direction) |
| Fetches the direction of a joystick. | |
| int | io_joystick_calibrate (struct io_joystick_device *dev) |
| Calibrate a joystick. Requires the joystick to be in its neutral position. | |
| int | io_avr_init (struct io_avr_device *dev) |
| int | io_avr_buttons_read (struct io_avr_device *dev, struct io_avr_buttons *btn) |
| int | io_avr_led_set (struct io_avr_device *dev, unsigned char led, unsigned char brightness) |
| int | io_oled_init (struct io_oled_device *dev) |
| Initialise OLED. | |
| int | io_oled_reset (struct io_oled_device *dev) |
| Sends command to OLED. | |
| int | io_oled_home (struct io_oled_device *dev) |
| Loads homescreen to OLED. | |
| int | io_oled_goto_line (struct io_oled_device *dev, int line) |
| Go to specific line in OLED. | |
| int | io_oled_goto_column (struct io_oled_device *dev, int column) |
| Go to specific column in OLED. | |
| int | io_oled_clear_line (struct io_oled_device *dev, int line) |
| Clear specific line in OLED. | |
| volatile int | io_oled_writedata (struct io_oled_device *dev, int data) |
| Writes data to OLED at current position. | |
| int | io_oled_pos (struct io_oled_device *dev, int row, int column) |
| Set specific position in OLED. | |
| int | io_oled_print (struct io_oled_device *dev, char *text) |
| Write string to OLED. | |
| int | io_oled_set_brightness (struct io_oled_device *dev, uint8_t brightness) |
| Set OLED brightness. | |
| int | io_oled_reset_brightness (struct io_oled_device *dev) |
| Reset OLED brightness. | |
| int | io_oled_print_arrow (struct io_oled_device *dev, uint8_t row, uint8_t col) |
| Prints an arrow at a specified postion. | |
| uint8_t | io_oled_write_glyph (struct io_oled_device *dev, const struct oled_font *font, char character_id) |
| Prints a single glyph in a specifiec font. | |
| int | io_oled_print_with_font (struct io_oled_device *dev, const struct oled_font *font, char *text) |
| Prints an arrow at a specified postion. | |
| int | io_oled_test (struct io_oled_device *dev) |
| Prints a known image to the OLED to confirm that it can print and navigate the screen. | |
| int | io_oled_blink (struct io_oled_device *dev, uint8_t blinks) |
| Alternates screen between black and white. | |
| int | io_oled_write_data (struct io_oled_device *dev, uint8_t data) |
| int | io_oled_write_command (struct io_oled_device *dev, uint8_t command) |
| int | io_oled_clear_all (struct io_oled_device *dev) |
| Clears all lines on the OLED (fills entire display with black). | |
Variables | |
| static const struct oled_font | OLED_FONT_8x8 = {font8, 8, 8, 1} |
| Predefined 8x8 font for OLED. | |
| static const struct oled_font | OLED_FONT_5x7 = {font5, 5, 7, 1} |
| Predefined 5x7 font for OLED. | |
| static const struct oled_font | OLED_FONT_4x6 = {font4, 4, 6, 1} |
| Predefined 4x6 font for OLED. | |
#include <io.h>
Predefined joystick directions.
| Enumerator | |
|---|---|
| LEFT | Joystick pushed left |
| RIGHT | Joystick pushed right |
| UP | Joystick pushed up |
| DOWN | Joystick pushed down |
| NEUTRAL | Joystick in neutral position |
| struct __attribute__ | ( | (packed) | ) |
#include <io.h>
Represents button states for I/O boards (from I/O board manual).
Buttons are packed as bits inside unions for convenient access.
< All right-side buttons as byte
< All left-side buttons as byte
< Navigation buttons as byte
< Bottom navigation button
< Right navigation button
< Down navigation button
< Left navigation button
< Up navigation button
Definition at line 34 of file io.h.
| int io_avr_buttons_read | ( | struct io_avr_device * | dev, |
| struct io_avr_buttons * | btn ) |
#include <io.h>
Definition at line 115 of file io.c.
Referenced by main(), and tx_joy_btn().
| int io_avr_init | ( | struct io_avr_device * | dev | ) |
| int io_avr_led_set | ( | struct io_avr_device * | dev, |
| unsigned char | led, | ||
| unsigned char | brightness ) |
| int io_joystick_calibrate | ( | struct io_joystick_device * | dev | ) |
#include <io.h>
Calibrate a joystick. Requires the joystick to be in its neutral position.
| [in] | dev | The joystick to calibrate. |
| int io_joystick_init | ( | struct io_joystick_device * | dev | ) |
#include <io.h>
Initialise and calibrate a joystick.
| [in] | dev | The joystick to be initlaised. |
| int io_joystick_read_direction | ( | struct io_joystick_device * | dev, |
| enum io_joystick_direction * | direction ) |
#include <io.h>
Fetches the direction of a joystick.
| [in] | dev | The joystick to read. |
| [in] | direction | A buffer for storing the read direction. |
Definition at line 66 of file io.c.
| int io_joystick_read_position | ( | struct io_joystick_device * | dev, |
| struct io_joystick_position * | buffer ) |
#include <io.h>
Read the position of a joystick as a percentage from 0 in each axis.
| [in] | dev | The joystick to read. |
| [in] | buffer | A buffer for storing the position value. |
Definition at line 38 of file io.c.
Referenced by io_joystick_read_direction(), and tx_joy_btn().
| int io_oled_blink | ( | struct io_oled_device * | dev, |
| uint8_t | blinks ) |
#include <io.h>
Alternates screen between black and white.
| [in] | dev | the OLED device that should be blinked |
| [in] | blinks | number of blinks newline |
Definition at line 450 of file io.c.
| int io_oled_clear_all | ( | struct io_oled_device * | dev | ) |
#include <io.h>
Clears all lines on the OLED (fills entire display with black).
| [in] | dev | Pointer to the OLED device struct |
Definition at line 292 of file io.c.
Referenced by brightness_display(), calibrate_joystick_display(), game_over_display(), high_scores_display(), play_game_display(), settings_display(), and welcome_display().
| int io_oled_clear_line | ( | struct io_oled_device * | dev, |
| int | line ) |
#include <io.h>
Clear specific line in OLED.
| [in] | dev | The OLED who's line is to be cleared |
| [in] | line | the line that to be cleared |
Definition at line 275 of file io.c.
Referenced by io_oled_clear_all(), settings_display(), and welcome_display().
| int io_oled_goto_column | ( | struct io_oled_device * | dev, |
| int | column ) |
#include <io.h>
Go to specific column in OLED.
| [in] | dev | The OLED who's column is to be set |
| [in] | column | the column which should be set |
Definition at line 265 of file io.c.
Referenced by io_oled_blink(), io_oled_clear_line(), io_oled_home(), io_oled_init(), io_oled_pos(), and io_oled_test().
| int io_oled_goto_line | ( | struct io_oled_device * | dev, |
| int | line ) |
#include <io.h>
Go to specific line in OLED.
| [in] | dev | The OLED who's line is to be set |
| [in] | line | the line to be set |
Definition at line 255 of file io.c.
Referenced by io_oled_blink(), io_oled_clear_line(), io_oled_home(), io_oled_init(), io_oled_pos(), and io_oled_test().
| int io_oled_home | ( | struct io_oled_device * | dev | ) |
#include <io.h>
Loads homescreen to OLED.
| [in] | dev | The OLED to be set |
Definition at line 247 of file io.c.
Referenced by brightness_display(), calibrate_joystick_display(), game_over_display(), high_scores_display(), io_oled_blink(), io_oled_test(), play_game_display(), settings_display(), and welcome_display().
| int io_oled_init | ( | struct io_oled_device * | dev | ) |
#include <io.h>
Initialise OLED.
| [in] | dev | The OLED to be initlaised. |
Definition at line 161 of file io.c.
Referenced by menu_init().
| int io_oled_pos | ( | struct io_oled_device * | dev, |
| int | row, | ||
| int | column ) |
#include <io.h>
Set specific position in OLED.
| [in] | dev | The OLED who's position is to be set |
| [in] | row | The row of the position to be set |
| [in] | collumn | the collumn of the position the be set |
Definition at line 306 of file io.c.
Referenced by draw_cursor(), game_over_display(), io_oled_print_arrow(), settings_display(), and welcome_display().
| int io_oled_print | ( | struct io_oled_device * | dev, |
| char * | text ) |
#include <io.h>
Write string to OLED.
| [in] | dev | The OLED who should print the line |
| [in] | text | the string that should be written to the OLED |
| int io_oled_print_arrow | ( | struct io_oled_device * | dev, |
| uint8_t | row, | ||
| uint8_t | col ) |
#include <io.h>
Prints an arrow at a specified postion.
| [in] | dev | The OLED who's britness should be set |
| [in] | row | select row where the arrow should be placed |
| [in] | column | select column where the arrow should be placed |
Definition at line 330 of file io.c.
| int io_oled_print_with_font | ( | struct io_oled_device * | dev, |
| const struct oled_font * | font, | ||
| char * | text ) |
#include <io.h>
Prints an arrow at a specified postion.
| [in] | dev | the OLED device that should be written to |
| [in] | font | the specified font, see font.h |
| [in] | text | the string that should be printed to the OLED, has to end in newline |
Definition at line 377 of file io.c.
Referenced by brightness_display(), calibrate_joystick_display(), draw_cursor(), game_over_display(), high_scores_display(), io_oled_test(), play_game_display(), settings_display(), and welcome_display().
| int io_oled_reset | ( | struct io_oled_device * | dev | ) |
#include <io.h>
Sends command to OLED.
| [in] | dev | The commanded OLED. |
| [in] | command | the hex command (see p27. SSD1309 datasheet) |
Sends data to OLED
| [in] | dev | The OLED that should receive the data. |
| [in] | data | the data that the OLED should recive |
Resets OLED to blank page
| [in] | dev | The OLED to be reset. |
Definition at line 230 of file io.c.
| int io_oled_reset_brightness | ( | struct io_oled_device * | dev | ) |
#include <io.h>
Reset OLED brightness.
| [in] | dev | The OLED who's britness should be set |
| int io_oled_set_brightness | ( | struct io_oled_device * | dev, |
| uint8_t | brightness ) |
#include <io.h>
Set OLED brightness.
| [in] | dev | The OLED who's britness should be set |
| [in] | brightness | the brightness level to be set |
| int io_oled_test | ( | struct io_oled_device * | dev | ) |
#include <io.h>
Prints a known image to the OLED to confirm that it can print and navigate the screen.
| [in] | dev | the OLED device that should be tested newline |
Definition at line 391 of file io.c.
| int io_oled_write_command | ( | struct io_oled_device * | dev, |
| uint8_t | command ) |
#include <io.h>
| int io_oled_write_data | ( | struct io_oled_device * | dev, |
| uint8_t | data ) |
| uint8_t io_oled_write_glyph | ( | struct io_oled_device * | dev, |
| const struct oled_font * | font, | ||
| char | character_id ) |
#include <io.h>
Prints a single glyph in a specifiec font.
| [in] | dev | the OLED that should be written to |
| [in] | font | the specified font, see font.h |
| [in] | character_id | the character that should be written |
Definition at line 343 of file io.c.
Referenced by io_oled_print_with_font().
| volatile int io_oled_writedata | ( | struct io_oled_device * | dev, |
| int | data ) |
#include <io.h>
Writes data to OLED at current position.
| [in] | dev | The OLED where the data should be sent |
| [in] | data | The data to be sendt to the OLED |
#include <io.h>
Predefined 4x6 font for OLED.
Definition at line 34 of file io.h.
Referenced by __attribute__(), and io_oled_test().
#include <io.h>
Predefined 5x7 font for OLED.
Definition at line 32 of file io.h.
Referenced by io_oled_test().