The foundation for a basic chat application using hardware interrupts and GPIO communication on DE1-SoC boards.
IMG_6214.mov
This code implements a chatbox application for communication between two DE1-SoCs using interrupts and GPIO registers. Here's a breakdown of its main components:
- Global Definitions and Pointers: Defines register addresses for GPIO, PS2, LED, pixel buffer, and character buffer. Also initializes pointers to these memory locations.
- Structures: Defines two structures: Message for holding user messages and MessageNode for creating a linked list of messages.
- Global Variables: Defines various global variables including buffers, cursor position, message counters, and flags.
- Interrupt Handlers: Implements interrupt handlers for PS2 and GPIO interrupts. PS2 ISR decodes PS2 scan codes into ASCII characters, while GPIO ISR reads data from GPIO and stores it in a buffer.
- Drawing Functions: Implements functions for plotting pixels, drawing lines, drawing cursor, and writing characters to VGA display.
- Initialization and Setup: Initializes the display and sets up the initial cursor position. It also prompts the user to enter their name.
- Message Handling Functions: Includes functions for inserting messages into a linked list, printing messages on the display, and testing message insertion and display.
- Connection Establishment: Detects connection between the two DE1-SoCs using GPIO interrupts.
- Main Function: Initializes GPIO and PS2, enables interrupts, sets up the initial cursor position, prompts the user to enter their name, and detects connection between devices.