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 
21 
29 #include <stdio.h>
30 #include <unistd.h>
31 #include "bcm2835.h"
32 #include "Utilities.h"
33 #include "SPI.h"
34 #include "TFT.h"
35 #include "GFX.h"
36 
37 #include "Barometer2.h"
38 #include "Altimeter1.h"
39 
40 #define BACKGROUND WHITE
41 #define FOREGROUND BLUE
42 #define DELAY 2000
43 
44 int main(void)
45 {
46  SPI_Initialize(); //Initialize SPI peripheral
49 
50  Image_t b = {Barometer2,100,100};
51 
52  while(1)
53  {
55  TFT_ShowPic(Altimeter1,64,64,15,30);
56  delay_ms(DELAY);
58  TFT_DisplayImage(&b,10,10);
59  delay_ms(DELAY);
60  }
61 
62  SPI_Close();
63 
64  return 0;
65 }
void TFT_Background(int color)
This function paints the display background a specific color.
Definition: TFT.c:324
SPI library header.
GFX library header.
#define DELAY
Definition: main.c:42
void TFT_ShowPic(unsigned int picture[], unsigned char width, unsigned char height, unsigned int x, unsigned int y)
This function paints an image with a specific heigh and width on the display at a specific coordinate...
Definition: TFT.c:342
#define WHITE
Definition: TFT.h:114
void SPI_Initialize(void)
Initializes the SPI peripheral.
Definition: SPI.c:35
unsigned int Barometer2[]
Definition: Barometer2.h:30
void TFT_DisplayImage(Image_t *image, unsigned char x, unsigned char y)
This function displays an image of type Image_t on screen.
Definition: TFT.c:363
void SPI_Close(void)
Close SPI bus, should not be called if another SPI device is being used.
Definition: SPI.c:95
TFT Driver.
int main(int argc, char **argv)
Definition: main.c:34
Utilities library header.
unsigned int Altimeter1[]
Definition: Altimeter1.h:31
void delay_ms(unsigned int ms)
Delay in ms.
Definition: Utilities.c:39
Image type. Contains image array with height and width dimensions.
Definition: TFT.h:156
void TFT_Initialize(void)
This function intializes the display controller and prepares it for any subsequent operations...
Definition: TFT.c:24