summaryrefslogtreecommitdiff
path: root/firmware/t6963c_specific.h
blob: 5d8d18c10cd33240ace9176fd901df95003ac42f (plain) (blame)
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
66
67
/**
 * C library for interfacing a T6963C display with a PIC microcontroller
 * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>

 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 *******************************************************************************
 *
 * File:   t6963c_specific.h
 * Author: Camil Staps
 *
 * Example of what you could put in a t6963c_specific.h.
 */

#ifndef T6963C_SPECIFIC_H
#define	T6963C_SPECIFIC_H

#include <xc.h>

#define t6963c_rst(x)    LATFbits.LATF3   = (x) // RESET line
#define t6963c_cd(x)     LATBbits.LATB7   = (x) // C/D line
#define t6963c_ce(x)     LATBbits.LATB6   = (x) // CE line
#define t6963c_rd(x)     LATFbits.LATF5   = (x) // RD line
#define t6963c_wr(x)     LATFbits.LATF4   = (x) // WR line
#define t6963c_t_rst(x)  TRISFbits.TRISF3 = (x) // TRIS bit of RESET pin
#define t6963c_t_cd(x)   TRISBbits.TRISB7 = (x) // TRIS bit of C/D pin
#define t6963c_t_ce(x)   TRISBbits.TRISB6 = (x) // TRIS bit of CE pin
#define t6963c_t_rd(x)   TRISFbits.TRISF5 = (x) // TRIS bit of RD pin
#define t6963c_t_wr(x)   TRISFbits.TRISF4 = (x) // TRIS bit of WR pin
#define t6963c_data(x)   LATB  = (LATB  & 0x00ff) | (x << 8) // Data port
#define t6963c_t_data(x) TRISB = (TRISB & 0x00ff) | (x << 8) // TRIS register of data port

#define t6963c_rows 16           // Number of rows of the LCD
#define t6963c_columns 40        // Number of columns of the LCD

#ifdef __cplusplus
extern "C" {
#endif

#define t6963c_nspertick 64

/**
 * Define the project-specific timer functions here
 * @see t6963c.h
 */
inline void t6963c_initTimer(void);
inline void t6963c_startTimer(void);
inline unsigned short t6963c_getTimeNs(void);
inline void t6963c_stopTimer(void);

#ifdef __cplusplus
}
#endif

#endif /* T6963C_SPECIFIC_H */