Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
github-classroom[bot] authored Nov 11, 2024
0 parents commit 6f37339
Show file tree
Hide file tree
Showing 26 changed files with 1,863 additions and 0 deletions.
29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2021, Eric Freudenthal
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
all:
(cd timerLib; make install)
(cd lcdLib; make install)
(cd wakedemo; make)
# (cd circledemo; make)

doc:
rm -rf doxygen_docs
doxygen Doxyfile
clean:
(cd timerLib; make clean)
(cd lcdLib; make clean)
# (cd circledemo; make clean)
(cd wakedemo; make clean)
rm -rf lib h
rm -rf doxygen_docs/*
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# arch1-project3-lcd
29 changes: 29 additions & 0 deletions lcdLib/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
all: libLcd.a lcddemo.elf

CPU = msp430g2553
CFLAGS = -mmcu=${CPU} -Os -I../h
LDFLAGS = -L/opt/ti/msp430_gcc/include -L../lib
#switch the compiler (for the internal make rules)
CC = msp430-elf-gcc
AS = msp430-elf-as
AR = msp430-elf-ar

libLcd.a: font-11x16.o font-5x7.o font-8x12.o lcdutils.o lcddraw.o
$(AR) crs $@ $^

lcddraw.o: lcddraw.c lcddraw.h lcdutils.h
lcdutils.o: lcdutils.c lcdutils.h

install: libLcd.a
mkdir -p ../h ../lib
mv $^ ../lib
cp *.h ../h

clean:
rm -f libLcd.a *.o *.elf

lcddemo.elf: lcddemo.o libLcd.a
$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -lTimer

load: lcddemo.elf
msp430loader.sh $^
57 changes: 57 additions & 0 deletions lcdLib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# lcdLib from Project 3: LCD Game
## Introduction

lcdLib provides primitives for a pixel, rectangle, clearing the screen and a 5x7 font. Handles all the lower-level "messy stuff".


Two types are defined (used as shortcut to typing "unsigned [type]"):

- u_char : unsigned char

- u_int : unsigned int

## Files

- lcdutils.h, lcdutils.c: these provide the lowest level interface to
the lcd such as

- lcd_init: initialization of the lcd
- defining screenWidth and screeenHeight
- colors (at end of lcdutils.h (represented as 16 bit BGR values: 5 bits of blue, 6 bits
of green, and 5 bits of red)
- lcd_setArea, lcd_writeColor: methods for selecting rectangular
regions and setting the colors of the pixels they contain.


- lcddraw.h: simple drawing facilities that utilize lcdutils

- lcddraw.c:
- drawPixel(): sets the color of a pixel
- fillRect(): fill a rectangle with a color
- drawChar5x7, drawString5x7: draws characters/strings at
particular locations

- font5x7.c, font11x16.c font8x12.c: tables of bitmapped fonts

## Demo code

lcddemo.c is a program that displays a string and a rectangle. A
"load" make production loads it into the launchpad board.

## Suggested exercises

In order to explore shape rendering, students are encouraged to create additinal "demo" programs that:

- draw a diagonal line (for example, where row = col or row = screenWidth-col)

- draw a filled or outline of a right triangle

- draw the other fonts hidden in the source files

## Installing the LCD lib (for other programs)

$ make install

## See Also

lcdLib requires timerLib (in directory ../timerLib). Be sure to "make install" it first!
Loading

0 comments on commit 6f37339

Please sign in to comment.