-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlcdBinary.c
65 lines (47 loc) · 2.09 KB
/
lcdBinary.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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);