Skip to content

Commit faa2267

Browse files
committed
DMCP Version 3.13
1 parent 3e0da33 commit faa2267

15 files changed

+388
-361
lines changed

LICENSE

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
11
/*
22

3-
Copyright (c) 2018 SwissMicros GmbH
3+
BSD 3-Clause License
44

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.
87

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:
1110

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.
1613

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.
2017

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.
3221

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.
3332

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).
3535

3636
1. Info is released to assist customers using, exploring and extending the product
3737
2. Do NOT contact the manufacturer with questions, seeking support, etc. regarding
3838
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
4141

4242
*/

README

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
GNU ARM toolchain can be downloaded from
55
https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads.
6-
We are currently using Version 7-2017-q4-major Linux 64-bit.
6+
We are currently using Version 7-2018-q2-update Linux 64-bit.
77

88
Make is usually available in some base development package, but you
99
can install it directly, e.g. for debian like systems
@@ -20,7 +20,7 @@ Some usually available aux utilities (could require separate installation):
2020
== Build
2121

2222
Add ARM toolchain bin/ directory to PATH.
23-
(e.g. ~/arm/gcc-arm-none-eabi-7-2017-q4-major/bin)
23+
(e.g. ~/arm/gcc-arm-none-eabi-7-2018-q2-update/bin)
2424

2525
Run make to build the program.
2626

dmcp/dmcp.h

Lines changed: 67 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
/*
22
3-
Copyright (c) 2018 SwissMicros GmbH
3+
BSD 3-Clause License
44
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.
87
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:
1110
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.
1613
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.
2017
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.
3221
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.
3332
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).
3535
3636
1. Info is released to assist customers using, exploring and extending the product
3737
2. Do NOT contact the manufacturer with questions, seeking support, etc. regarding
3838
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
4141
4242
*/
4343
#ifndef __SYS_DMCP_H__
@@ -123,6 +123,8 @@ void lcd_fillLines(int ln, uint8_t val, int cnt);
123123
void lcd_set_buf_cleared(int val);
124124
int lcd_get_buf_cleared();
125125

126+
uint8_t reverse_byte(uint8_t x);
127+
126128

127129
// ----------------------------------
128130

@@ -149,12 +151,12 @@ typedef struct {
149151
typedef struct {
150152
line_font_t const * f; // Current font
151153
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
154156
int8_t ya; // Lines to fill above the font
155157
int8_t yb; // Lines to fill below the font
156158
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
158160

159161
uint8_t fixed; // Draw in fixed width
160162
uint8_t inv; // Draw inverted
@@ -176,19 +178,26 @@ int lcd_fontWidth(disp_stat_t * ds);
176178

177179
// Font display functions
178180
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);
179183

180184
// Width calculation functions
181185
int lcd_textWidth(disp_stat_t * ds, const char* text);
182186
int lcd_charWidth(disp_stat_t * ds, int c);
183187

184188
// 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.
185191
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);
186195

187-
// Just advance ds->x don't print anythig
196+
// Just advance ds->x don't print anything
188197
void lcd_writeTextWidth(disp_stat_t * ds, const char* text);
189198

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
192201
int lcd_textForWidth(disp_stat_t * ds, const char* text, int expected_width, int * plen);
193202

194203

@@ -343,11 +352,11 @@ typedef struct {
343352

344353
// ----------------------------------
345354

346-
#define PLATFORM_VERSION "3.8"
355+
#define PLATFORM_VERSION "3.13"
347356

348357
// System interface version
349358
#define PLATFORM_IFC_CNR 3
350-
#define PLATFORM_IFC_VER 8
359+
#define PLATFORM_IFC_VER 10
351360

352361
// STATIC_ASSERT ...
353362
#define ASSERT_CONCAT_(a, b) a##b
@@ -381,6 +390,7 @@ int get_vbat();
381390
// Freq in mHz
382391
void start_buzzer_freq(uint32_t freq);
383392
void stop_buzzer();
393+
void set_buzzer(int pin1val, int pin2val);
384394

385395
void beep_volume_up();
386396
void beep_volume_down();
@@ -428,8 +438,7 @@ int usb_powered();
428438

429439
char * aux_buf_ptr();
430440
void * write_buf_ptr();
431-
432-
441+
int write_buf_size();
433442

434443
// Program info structure
435444
#define PROG_INFO_MAGIC 0xd377C0DE
@@ -449,6 +458,12 @@ typedef struct {
449458
} __packed prog_info_t;
450459

451460

461+
// Keyboard
462+
int read_key(int *k1, int *k2);
463+
464+
// Timer
465+
uint32_t get_tim1_timer();
466+
452467

453468
// ----------------------------------
454469

@@ -540,6 +555,8 @@ extern const smenu_t MID_BASE_SETUP; // System setup menu
540555
#define MI_PGM_LOAD 221
541556

542557
#define MI_RUN_DMCP 222
558+
559+
#define MI_OFF_MODE 223
543560
// --------------------------------
544561

545562

@@ -708,25 +725,6 @@ int file_selection_screen(const char * title, const char * base_dir, const char
708725
#define STAT_HW (STAT_HW_BEEP | STAT_HW_USB | STAT_HW_IR)
709726

710727

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-
730728
// Screenshots
731729
#define SCR_DIR "/SCREENS"
732730

@@ -793,6 +791,9 @@ void set_fat_label(const char * label);
793791

794792
int file_exists(const char * fn);
795793

794+
// Returns -1 if file doesn't exist
795+
int file_size(const char * fn);
796+
796797
int sys_disk_ok();
797798
int sys_disk_write_enable(int val);
798799
void sys_disk_check_valid();
@@ -831,6 +832,9 @@ void sys_reset();
831832
// Key
832833
int sys_last_key();
833834

835+
// Aux file
836+
void make_date_filename(char * str, const char * dir, const char * ext);
837+
834838

835839
// ----------------------------------
836840

@@ -839,10 +843,17 @@ void run_help_file(const char * help_file);
839843

840844
// ----------------------------------
841845

846+
842847
// Off images
843848
void draw_power_off_image(int allow_errors);
844849
void reset_off_image_cycle();
845850

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+
846857
// ----------------------------------
847858

848859

0 commit comments

Comments
 (0)