Sensorian  1.0
C API Reference Guide Library
main.c
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (C) 2015 Sensorian
3  * *
4  * This file is part of Sensorian. *
5  * *
6  * Sensorian is free software: you can redistribute it and/or modify it *
7  * under the terms of the GNU Lesser General Public License as published *
8  * by the Free Software Foundation, either version 3 of the License, or *
9  * (at your option) any later version. *
10  * *
11  * Sensorian is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU Lesser General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Lesser General Public *
17  * License along with Sensorian. *
18  * If not, see <http://www.gnu.org/licenses/>. *
19  ****************************************************************************/
20 
28 #include <stdio.h>
29 #include <unistd.h>
30 #include "bcm2835.h"
31 #include "Utilities.h"
32 #include "SPI.h"
33 #include "TFT.h"
34 #include "GFX.h"
35 
36 extern const unsigned char font[] ;
37 
38 #define BACKGROUND WHITE
39 #define FOREGROUND BLUE
40 #define DELAY 1200
41 
42 int main(void)
43 {
44 
45  SPI_Initialize(); //Initialize SPI peripheral
47 
48  char str1[] = "Ascii text";
49 
50  while(1)
51  {
54  delay_ms(DELAY);
55 
58  delay_ms(DELAY);
59 
60 
62  TFT_PrintInteger(40, 50, RED, BACKGROUND,12436, 1);
63  delay_ms(DELAY);
64  }
65 
66  SPI_Close();
67 
68  return 0;
69 }
Utilities library header.
void TFT_Background(int color)
This function paints the display background a specific color.
Definition: TFT.c:324
const unsigned char font[]
#define BACKGROUND
Definition: main.c:38
#define WHITE
Definition: TFT.h:114
GFX library header.
#define RED
Definition: TFT.h:111
void SPI_Initialize(void)
Initializes the SPI peripheral.
Definition: SPI.c:35
void TFT_PrintString(char x, char y, int color, int background, char *message, char size)
Orint a colored string at coordinates x,y with a specific font size.
Definition: TFT.c:440
void SPI_Close(void)
Close SPI bus, should not be called if another SPI device is being used.
Definition: SPI.c:95
int main(int argc, char **argv)
Definition: main.c:34
SPI library header.
void delay_ms(unsigned int ms)
Delay in ms.
Definition: Utilities.c:39
void TFT_PrintInteger(char x, char y, int color, int background, int integer, char size)
Prints an integer at coordinates x,y with a specific color on a specific background. The integer font size is deterined bu var size.
Definition: TFT.c:465
#define DELAY
Definition: main.c:40
void TFT_Initialize(void)
This function intializes the display controller and prepares it for any subsequent operations...
Definition: TFT.c:24
#define FOREGROUND
Definition: main.c:39
TFT Driver.