1
1
/*
2
2
3
- Copyright (c) 2018 SwissMicros GmbH
3
+ BSD 3-Clause License
4
4
5
- Redistribution and use in source and binary forms, with or without
6
- modification, are permitted provided that the following conditions
7
- are met:
5
+ Copyright (c) 2015-2019, SwissMicros
6
+ All rights reserved.
8
7
9
- 1. Redistributions of source code must retain the above copyright
10
- notice, this list of conditions and the following disclaimer.
8
+ Redistribution and use in source and binary forms, with or without
9
+ modification, are permitted provided that the following conditions are met:
11
10
12
- 2. Redistributions in binary form must reproduce the above copyright
13
- notice, this list of conditions and the following disclaimer in
14
- the documentation and/or other materials provided with the
15
- distribution.
11
+ * Redistributions of source code must retain the above copyright notice, this
12
+ list of conditions and the following disclaimer.
16
13
17
- 3. Neither the name of the copyright holder nor the names of its
18
- contributors may be used to endorse or promote products derived
19
- from this software without specific prior written permission .
14
+ * Redistributions in binary form must reproduce the above copyright notice,
15
+ this list of conditions and the following disclaimer in the documentation
16
+ and/or other materials provided with the distribution .
20
17
21
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
25
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
27
- OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
29
- IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
- POSSIBILITY OF SUCH DAMAGE.
18
+ * Neither the name of the copyright holder nor the names of its
19
+ contributors may be used to endorse or promote products derived from
20
+ this software without specific prior written permission.
32
21
22
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
32
34
- The SDK and related material is released as “NOMAS” (NOt MAnufacturer Supported).
33
+
34
+ The software and related material is released as “NOMAS” (NOt MAnufacturer Supported).
35
35
36
36
1. Info is released to assist customers using, exploring and extending the product
37
37
2. Do NOT contact the manufacturer with questions, seeking support, etc. regarding
38
38
NOMAS material as no support is implied or committed-to by the Manufacturer
39
- 3. The Manufacturer may reply and/or update materials if and when needed solely at
40
- their discretion
39
+ 3. The Manufacturer may reply and/or update materials if and when needed solely
40
+ at their discretion
41
41
42
42
*/
43
43
#ifndef __SYS_DMCP_H__
@@ -123,6 +123,8 @@ void lcd_fillLines(int ln, uint8_t val, int cnt);
123
123
void lcd_set_buf_cleared (int val );
124
124
int lcd_get_buf_cleared ();
125
125
126
+ uint8_t reverse_byte (uint8_t x );
127
+
126
128
127
129
// ----------------------------------
128
130
@@ -149,12 +151,12 @@ typedef struct {
149
151
typedef struct {
150
152
line_font_t const * f ; // Current font
151
153
int16_t x , y ; // Current x,y position
152
- int16_t ln_offs ; // Line offeset (when displaying by line numbers)
153
- int16_t y_top_grd ; // Don'w overwrite anything above this line
154
+ int16_t ln_offs ; // Line offset (when displaying by line numbers)
155
+ int16_t y_top_grd ; // Don't overwrite anything above this line
154
156
int8_t ya ; // Lines to fill above the font
155
157
int8_t yb ; // Lines to fill below the font
156
158
int8_t xspc ; // Space between chars
157
- int8_t xoffs ; // X offst for first char on line
159
+ int8_t xoffs ; // X offset for first char on line
158
160
159
161
uint8_t fixed ; // Draw in fixed width
160
162
uint8_t inv ; // Draw inverted
@@ -176,19 +178,26 @@ int lcd_fontWidth(disp_stat_t * ds);
176
178
177
179
// Font display functions
178
180
void lcd_writeText (disp_stat_t * ds , const char * text );
181
+ // Note that 'text' has to be in RAM
182
+ void lcd_textToBox (disp_stat_t * ds , int x , int width , char * text , int from_right , int align_right );
179
183
180
184
// Width calculation functions
181
185
int lcd_textWidth (disp_stat_t * ds , const char * text );
182
186
int lcd_charWidth (disp_stat_t * ds , int c );
183
187
184
188
// Get just text which fits in expected_width
189
+ // Returns index of char which breaks the space limit
190
+ // Optional plen variable can be supplied to get text width up to index limit.
185
191
int lcd_textToWidth (disp_stat_t * ds , const char * text , int expected_width , int * plen );
192
+ // ... alternative version to upper function which takes text from the end
193
+ // returns -1 if whole text fits into 'expected_width'
194
+ int lcd_textToWidthR (disp_stat_t * ds , const char * text , int expected_width , int * plen );
186
195
187
- // Just advance ds->x don't print anythig
196
+ // Just advance ds->x don't print anything
188
197
void lcd_writeTextWidth (disp_stat_t * ds , const char * text );
189
198
190
- // Get text which fits in expected width without breaking words
191
- // - word could be broken in middle only when is placed single long word on line
199
+ // Get text which fits in expected width * without breaking words*
200
+ // - word could be broken in the middle only when is placed single long word on line
192
201
int lcd_textForWidth (disp_stat_t * ds , const char * text , int expected_width , int * plen );
193
202
194
203
@@ -343,11 +352,11 @@ typedef struct {
343
352
344
353
// ----------------------------------
345
354
346
- #define PLATFORM_VERSION "3.8 "
355
+ #define PLATFORM_VERSION "3.13 "
347
356
348
357
// System interface version
349
358
#define PLATFORM_IFC_CNR 3
350
- #define PLATFORM_IFC_VER 8
359
+ #define PLATFORM_IFC_VER 10
351
360
352
361
// STATIC_ASSERT ...
353
362
#define ASSERT_CONCAT_ (a , b ) a##b
@@ -381,6 +390,7 @@ int get_vbat();
381
390
// Freq in mHz
382
391
void start_buzzer_freq (uint32_t freq );
383
392
void stop_buzzer ();
393
+ void set_buzzer (int pin1val , int pin2val );
384
394
385
395
void beep_volume_up ();
386
396
void beep_volume_down ();
@@ -428,8 +438,7 @@ int usb_powered();
428
438
429
439
char * aux_buf_ptr ();
430
440
void * write_buf_ptr ();
431
-
432
-
441
+ int write_buf_size ();
433
442
434
443
// Program info structure
435
444
#define PROG_INFO_MAGIC 0xd377C0DE
@@ -449,6 +458,12 @@ typedef struct {
449
458
} __packed prog_info_t ;
450
459
451
460
461
+ // Keyboard
462
+ int read_key (int * k1 , int * k2 );
463
+
464
+ // Timer
465
+ uint32_t get_tim1_timer ();
466
+
452
467
453
468
// ----------------------------------
454
469
@@ -540,6 +555,8 @@ extern const smenu_t MID_BASE_SETUP; // System setup menu
540
555
#define MI_PGM_LOAD 221
541
556
542
557
#define MI_RUN_DMCP 222
558
+
559
+ #define MI_OFF_MODE 223
543
560
// --------------------------------
544
561
545
562
@@ -708,25 +725,6 @@ int file_selection_screen(const char * title, const char * base_dir, const char
708
725
#define STAT_HW (STAT_HW_BEEP | STAT_HW_USB | STAT_HW_IR)
709
726
710
727
711
- // == File Item list
712
-
713
- #define pgm_fn_len 31
714
-
715
- typedef struct {
716
- char fn [pgm_fn_len + 1 ]; // Part of filename that fits on screen
717
- char f8 [16 ]; // 8.3 filename
718
- } file_item_t ;
719
-
720
- // Enumerates files in directory
721
- // Parameter fis is filled with file names - fis could be NULL to just get the number of files
722
- // Returns >=0 number of the files in directory
723
- // <0 fail
724
- int read_file_items (const char * dir_name , const char * filt , file_item_t * fis );
725
-
726
- void sort_file_items (file_item_t * fis , int fcnt );
727
-
728
-
729
-
730
728
// Screenshots
731
729
#define SCR_DIR "/SCREENS"
732
730
@@ -793,6 +791,9 @@ void set_fat_label(const char * label);
793
791
794
792
int file_exists (const char * fn );
795
793
794
+ // Returns -1 if file doesn't exist
795
+ int file_size (const char * fn );
796
+
796
797
int sys_disk_ok ();
797
798
int sys_disk_write_enable (int val );
798
799
void sys_disk_check_valid ();
@@ -831,6 +832,9 @@ void sys_reset();
831
832
// Key
832
833
int sys_last_key ();
833
834
835
+ // Aux file
836
+ void make_date_filename (char * str , const char * dir , const char * ext );
837
+
834
838
835
839
// ----------------------------------
836
840
@@ -839,10 +843,17 @@ void run_help_file(const char * help_file);
839
843
840
844
// ----------------------------------
841
845
846
+
842
847
// Off images
843
848
void draw_power_off_image (int allow_errors );
844
849
void reset_off_image_cycle ();
845
850
851
+ #define BG_COL_PAPER 0xf4f2dc
852
+ #define BG_COL_LCD 0xdff5cc
853
+
854
+ int update_bmp_file_header (FIL * fp , int width , int height , uint32_t bg_color );
855
+
856
+
846
857
// ----------------------------------
847
858
848
859
0 commit comments