-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgadgets.h
More file actions
164 lines (129 loc) · 5.39 KB
/
gadgets.h
File metadata and controls
164 lines (129 loc) · 5.39 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/*****************************************************************************
* | File : gadgets.h
* | Author : Graeme Vetterlein
* | Function : e-Paper Display system status
* | Info :
*----------------
* | This version: V0.1
* | Date : 2024-0620
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#ifndef _GADGETS_H_
#define _GADGETS_H_
#include <unistd.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
// TBD #include "DEV_Config.h"
#include "module.h"
/* Colours on the eInk display works a tad oddly,
Both WHITE and RED are defined to be "ON" (0xFF)
While BLACK is defined to be "off (0x00)
There are 2 images (red_image and black_image) ...to get BLACK , BOTH must be OFF
to get RED , only the red_image (pixel) must be on
to get WHITE , only the black_image (pixel) must be on
To add the confusion, while RED is just "the colour Red", "BLACK" means the backround colour of the display
which is actually a light grey (so almost white) so "BLACK" means a "light grey" while "WHITE" means diaplsy as black
I hope that's clear.
In Eink_colour, I'll use the terms differently:
*/
enum Eink_colour
{
is_no_colour = 0 ,
is_black_on_grey, // Black Letters on a grey backgound (ie Normal)
is_red_on_grey, // Red Letters on a grey backgound (ie Alert)
is_black_on_red, // INVERTED Color ... a red background
is_red_on_black, // INVERTED Color ... a black background
};
/* how to show remaining free space */
enum df_units
{
df_none = 0 ,
df_meg,
df_geg,
df_tera,
df_best,
df_pcent,
};
enum age_units
{
age_none = 0 ,
age_best,
age_seconds,
age_minutes,
age_hours,
age_days,
};
/* Notwithstanding the name, these can be used for temperature or frequency */
enum temp_type
{
temp_none = 0,
temp_cpu,
temp_gpu,
temp_arm,
temp_core,
temp_sdram_c, /* these last 3 can't be measured(yet) so can't be used. */
temp_sdram_i,
temp_sdram_p,
};
enum zzzzz
{
yyyyy,
};
/* Quote, "any method with more than 6 args, means you've missed one" :-) ... sadly we need each of these */
extern void ga_define(int display,
char * part_name,
char * local_name,
int no_columns,
int no_rows,
int no_rst,
int no_dc,
int no_cs,
int no_busy,
int no_pwr,
int no_mosi,
int no_sclk);
extern enum Eink_colour ga_set_colour(int display, enum Eink_colour colour);
extern void ga_init_display (int display);
extern void ga_init_module (int display);
extern void ga_init_image (int display, enum Eink_colour colour, UWORD rotate);
extern void ga_release_image (int display);
extern void ga_release_module(int display);
extern void ga_render (int display);
extern void ga_clear (int display);
extern int ga_text (int display, UWORD xstart, UWORD ystart, int fsize, char text[], enum Eink_colour colour);
extern int ga_hostname (int display, UWORD Xstart, UWORD Ystart, int fsize);
extern int ga_timestamp (int display, UWORD xstart, UWORD ystart, int fsize);
extern int ga_uptime (int display, UWORD xstart, UWORD ystart, int fsize);
extern int ga_meter (int display, UWORD xstart, UWORD ystart, int fsize, int value, enum Eink_colour colour);
extern int ga_df (int display, UWORD ystart, int fsize, char *device, char * label, enum df_units units, int cutoff);
extern int ga_age (int display, UWORD xstart, UWORD ystart, int fsize, char *filename, char * label, enum age_units units, int cutoff);
extern int ga_file (int display, UWORD xstart, UWORD ystart, int fsize, char *filename, int lines);
extern int ga_sleep (int display, unsigned int seconds);
extern void ga_identify();
extern int ga_linux_temp(int display, UWORD xstart, UWORD ystart, int fsize, char *pathname, int limit);
extern int ga_vcore_temp(int display, UWORD xstart, UWORD ystart, int fsize, enum temp_type type, int limit);
extern int ga_freq (int display, UWORD xstart, UWORD ystart, int fsize, enum temp_type type, int limit);
extern int ga_throttle (int display, UWORD xstart, UWORD ystart, int fsize);
extern int ga_fan (int display, UWORD xstart, UWORD ystart, int fsize, char *pathname, int limit);
extern void ga_xxxxx();
#endif