-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f85535e
Showing
11 changed files
with
3,198 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/.gitlab-ci.yml | ||
/Coursework_F28HS_2022.pdf |
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# simple Makefile to build and test the MasterMind implementation | ||
|
||
prg=master-mind | ||
fnc = masterFunc | ||
lib=lcdBinary | ||
matches=mm-matchesC | ||
tester=testm | ||
|
||
CC=gcc | ||
AS=as | ||
OPTS=-W | ||
|
||
all: $(prg) cw2 $(tester) | ||
|
||
cw2: $(prg) | ||
@if [ ! -L cw2 ] ; then ln -s $(prg) cw2 ; fi | ||
|
||
$(prg): $(prg).o $(lib).o $(matches).o | ||
$(CC) -o $@ $^ | ||
|
||
$(tester): $(tester).o $(fnc).o $(lib).o $(matches).o | ||
$(CC) -o $@ $^ | ||
|
||
%.o: %.c | ||
$(CC) $(OPTS) -c -o $@ $< | ||
|
||
|
||
|
||
# run the program with debug option to show secret sequence | ||
run: | ||
sudo ./$(prg) -d | ||
|
||
# do unit testing on the matching function | ||
unit: cw2 | ||
sh ./test.sh | ||
|
||
# testing the C vs the Assembler version of the matching fct | ||
test: $(tester) | ||
./$(tester) | ||
|
||
clean: | ||
-rm $(prg) $(tester) cw2 *.o | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Mastermind Game |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* ***************************************************************************** */ | ||
/* You can use this file to define the low-level hardware control fcts for */ | ||
/* LED, button and LCD devices. */ | ||
/* Note that these need to be implemented in Assembler. */ | ||
/* You can use inline Assembler code, or use a stand-alone Assembler file. */ | ||
/* Alternatively, you can implement all fcts directly in master-mind.c, */ | ||
/* using inline Assembler code there. */ | ||
/* The Makefile assumes you define the functions here. */ | ||
/* ***************************************************************************** */ | ||
|
||
|
||
#ifndef TRUE | ||
# define TRUE (1==1) | ||
# define FALSE (1==2) | ||
#endif | ||
|
||
#define PAGE_SIZE (4*1024) | ||
#define BLOCK_SIZE (4*1024) | ||
|
||
#define INPUT 0 | ||
#define OUTPUT 1 | ||
|
||
#define LOW 0 | ||
#define HIGH 1 | ||
|
||
|
||
// APP constants --------------------------------- | ||
|
||
// Wiring (see call to lcdInit in main, using BCM numbering) | ||
// NB: this needs to match the wiring as defined in master-mind.c | ||
|
||
#define STRB_PIN 24 | ||
#define RS_PIN 25 | ||
#define DATA0_PIN 23 | ||
#define DATA1_PIN 10 | ||
#define DATA2_PIN 27 | ||
#define DATA3_PIN 22 | ||
|
||
// ----------------------------------------------------------------------------- | ||
// includes | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <stdint.h> | ||
#include <sys/types.h> | ||
#include <time.h> | ||
|
||
// ----------------------------------------------------------------------------- | ||
// prototypes | ||
|
||
int failure (int fatal, const char *message, ...); | ||
|
||
// ----------------------------------------------------------------------------- | ||
// Functions to implement here (or directly in master-mind.c) | ||
|
||
/* this version needs gpio as argument, because it is in a separate file */ | ||
void digitalWrite (uint32_t *gpio, int pin, int value); | ||
|
||
// adapted from setPinMode | ||
void pinMode(uint32_t *gpio, int pin, int mode /*, int fSel, int shift */); | ||
|
||
void writeLED(uint32_t *gpio, int led, int value); | ||
|
||
int readButton(uint32_t *gpio, int button); | ||
|
||
void waitForButton(uint32_t *gpio, int button); |
Oops, something went wrong.