Skip to content

Commit 4befe9b

Browse files
committed
Make header compatible with C++
Signed-off-by: Christophe de Dinechin <[email protected]>
1 parent 0d05eb9 commit 4befe9b

File tree

1 file changed

+44
-26
lines changed

1 file changed

+44
-26
lines changed

dmcp/dmcp.h

+44-26
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3131
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3232
3333
34-
The software and related material is released as “NOMAS” (NOt MAnufacturer Supported).
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
@@ -45,6 +45,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4545

4646
#include <stdint.h>
4747

48+
#ifdef __cplusplus
49+
extern "C" {
50+
#endif // __cplusplus
51+
4852
typedef unsigned int uint;
4953

5054
#include "ff_ifc.h"
@@ -134,8 +138,8 @@ typedef struct {
134138
uint8_t char_cnt;
135139
uint8_t scale_x;
136140
uint8_t scale_y;
137-
uint8_t const * data;
138-
uint16_t const * offs;
141+
const uint8_t *data;
142+
const uint16_t *offs;
139143
} line_font_t;
140144

141145

@@ -144,21 +148,22 @@ typedef struct {
144148

145149
// Font display state
146150
typedef struct {
147-
line_font_t const * f; // Current font
148-
int16_t x, y; // Current x,y position
149-
int16_t ln_offs; // Line offset (when displaying by line numbers)
150-
int16_t y_top_grd; // Don't overwrite anything above this line
151-
int8_t ya; // Lines to fill above the font
152-
int8_t yb; // Lines to fill below the font
153-
int8_t xspc; // Space between chars
154-
int8_t xoffs; // X offset for first char on line
155-
156-
uint8_t fixed; // Draw in fixed width
157-
uint8_t inv; // Draw inverted
158-
uint8_t bgfill; // Fill background while drawing
159-
uint8_t lnfill; // Fill whole lines before writing line
160-
uint8_t newln; // New line after writing line
161-
const uint8_t *post_offs; // X-advance character width minus this value (if not-null)
151+
const line_font_t *f; // Current font
152+
int16_t x, y; // Current x,y position
153+
int16_t ln_offs; // Line offset (when displaying by line numbers)
154+
int16_t y_top_grd; // Don't overwrite anything above this line
155+
int8_t ya; // Lines to fill above the font
156+
int8_t yb; // Lines to fill below the font
157+
int8_t xspc; // Space between chars
158+
int8_t xoffs; // X offset for first char on line
159+
160+
uint8_t fixed; // Draw in fixed width
161+
uint8_t inv; // Draw inverted
162+
uint8_t bgfill; // Fill background while drawing
163+
uint8_t lnfill; // Fill whole lines before writing line
164+
uint8_t newln; // New line after writing line
165+
const uint8_t
166+
*post_offs; // X-advance character width minus this value (if not-null)
162167
} disp_stat_t;
163168

164169
void lcd_writeNl(disp_stat_t * ds);
@@ -192,7 +197,7 @@ int lcd_textToWidthR(disp_stat_t * ds, const char* text, int expected_width, int
192197
void lcd_writeTextWidth(disp_stat_t * ds, const char* text);
193198

194199
// Get text which fits in expected width *without breaking words*
195-
// - word could be broken in the middle only when is placed single long word on line
200+
// - word could be broken in the middle only when is placed single long word on line
196201
int lcd_textForWidth(disp_stat_t * ds, const char* text, int expected_width, int * plen);
197202

198203

@@ -462,7 +467,7 @@ int read_key(int *k1, int *k2);
462467

463468

464469
/////////////////////////////////
465-
// Low level diagnostics
470+
// Low level diagnostics
466471
/////////////////////////////////
467472

468473
void suspended_bg_key_read();
@@ -515,7 +520,7 @@ int qspi_user_size();
515520
// ----------------------------------
516521

517522

518-
// Printer
523+
// Printer
519524
#define PRINT_GRA_LN 1
520525
#define PRINT_TXT_LN 0
521526

@@ -653,7 +658,7 @@ int handle_menu(const smenu_t * menu_id, int action, int cur_line);
653658
// === Menu formatting support
654659
const char * rb_str(int val);
655660
const char * sel_str(int val);
656-
char * opt_str(char * s, char const *txt, int val);
661+
char *opt_str(char *s, const char *txt, int val);
657662
char * date_str(char * s, const char * txt);
658663
char * time_str(char * s, const char * txt);
659664

@@ -815,7 +820,7 @@ int run_menu_item_sys(uint8_t line_id);
815820
#define VAL_ST(x) VAL(x,calc_state)
816821
#define CLR_ST(x) CLR(x,calc_state)
817822
#define SET_ST(x) SET(x,calc_state)
818-
#define SETMSK_ST(x,m) SETMSK(x,m,calc_state)
823+
#define SETMSK_ST(x,m) SETMSK(x,m,calc_state)
819824
#define SETBY_ST(c,x) SETBY(c,x,calc_state)
820825

821826

@@ -901,8 +906,17 @@ int is_menu_auto_off();
901906
int sys_auto_off_cnt();
902907

903908
// Time/date
904-
void print_dmy_date(char * s, int const sz, dt_t *dt, const char * append, int shortmon, char sep_arg);
905-
void print_clk24_time(char * t, int const sz, tm_t *tm, int disp_sec, int disp_dow);
909+
void print_dmy_date(char *s,
910+
const int sz,
911+
dt_t *dt,
912+
const char *append,
913+
int shortmon,
914+
char sep_arg);
915+
void print_clk24_time(char *t,
916+
const int sz,
917+
tm_t *tm,
918+
int disp_sec,
919+
int disp_dow);
906920

907921

908922
// Check and create dir
@@ -933,7 +947,7 @@ int sys_timer_active(int timer_ix);
933947
int sys_timer_timeout(int timer_ix);
934948

935949
// Millisecond delay
936-
void sys_delay(uint32_t ms_delay);
950+
void sys_delay(uint32_t ms_delay);
937951

938952
// Current systick count
939953
uint32_t sys_tick_count();
@@ -1011,4 +1025,8 @@ int update_bmp_file_header(FIL* fp, int width, int height, uint32_t bg_color);
10111025

10121026
#include "lft_ifc.h"
10131027

1028+
#ifdef __cplusplus
1029+
}
1030+
#endif // __cplusplus
1031+
10141032
#endif

0 commit comments

Comments
 (0)