TTK4155 Lab Node 1
Term project in the NTNU course TTK4155 Embedded and Industrial Computer Systems Design
Loading...
Searching...
No Matches
io.h File Reference

Driver for joystick, buttons, and OLED. More...

#include "fonts.h"
#include "spi.h"
#include <stdint.h>

Go to the source code of this file.

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.

Detailed Description

Driver for joystick, buttons, and OLED.

Definition in file io.h.