-
Notifications
You must be signed in to change notification settings - Fork 0
/
display.c
executable file
·51 lines (39 loc) · 1.3 KB
/
display.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
/*
* display.c
*
* Created on: 28/05/2018
* Author: tjl54
*/
#include <stdint.h>
#include <stdbool.h>
#include "stdio.h"
#include "stdlib.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_ints.h"
#include "driverlib/gpio.h"
#include "driverlib/debug.h"
#include "driverlib/pin_map.h"
#include "utils/ustdlib.h"
#include "OrbitOLED/OrbitOLEDInterface.h"
#include "display.h"
void initDisplay(void)
{
// intialise the Orbit OLED display
OLEDInitialise();
}
//*************************************************************************
// Displays altitude as percentage and yaw in degrees
//*************************************************************************
void displayFlightData(int16_t altitude, uint16_t main_duty, uint16_t tail_duty, int16_t yaw_actual)
{
char string[17]; // Display fits 16 characters wide.
usnprintf(string, sizeof(string), "Altitude: %4d%%", altitude);
OLEDStringDraw(string, 0, 0);
usnprintf(string, sizeof(string), "YAW %4d deg", yaw_actual);
OLEDStringDraw(string, 0, 1);
usnprintf(string, sizeof(string), "Main DC: %d%%", main_duty);
OLEDStringDraw(string, 0, 2);
usnprintf(string, sizeof(string), "Tail DC: %d%%", tail_duty);
OLEDStringDraw(string, 0, 3);
}