-
Notifications
You must be signed in to change notification settings - Fork 0
/
morse.h
110 lines (92 loc) · 3.13 KB
/
morse.h
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
/*
* Copyright (C) u-blox Melbourn Ltd
* u-blox Melbourn Ltd, Melbourn, UK
*
* All rights reserved.
*
* This source file is the sole property of u-blox Melbourn Ltd.
* Reproduction or utilisation of this source in whole or part is
* forbidden without the written consent of u-blox Melbourn Ltd.
*/
#ifndef _MORSE_H_
#define _MORSE_H_
// ----------------------------------------------------------------
// COMPILE-TIME CONSTANTS
// ----------------------------------------------------------------
/** The short Morse pulse, used for rapid flashes at the beginning
* and end of a Morse sequence (in milliseconds).
*/
#define MORSE_VERY_SHORT_PULSE 35 // Don't set this any smaller as this is the smallest
// value where individual flashes are visible on a mobile
// phone video
/** Morse dot duration in milliseconds.
*/
#define MORSE_DOT 100
/** Morse dash duration in milliseconds.
*/
#define MORSE_DASH 500
/** The gap between each dot or dash in milliseconds.
*/
#define MORSE_GAP 250
/** The gap between Morse letters in milliseconds.
*/
#define MORSE_LETTER_GAP 1250
/** The gap between Morse words in milliseconds.
*/
#define MORSE_WORD_GAP 1500
/** The gap at the start and end of a Morse sequence
* in milliseconds.
* Note: must be at least as large as the letter gap.
*/
#define MORSE_START_END_GAP 1500
// ----------------------------------------------------------------
// FUNCTIONS
// ----------------------------------------------------------------
/** Initialise Morse.
*
* @param pMorseLedBar pointer to an LED to flash, where high
* is off and low is on.
*/
void initMorse(DigitalOut *pMorseLedBar);
/** printf(), Morse style.
*
* @param pFormat the printf() formatter.
* @param ... the printf() variable argument list.
*/
void printfMorse(const char *pFormat, ...);
/** printf() Morse but will run in its own task, returning
* immediately.
*
* @param pFormat the printf() formatter.
* @param ... the printf() variable argument list.
*/
void tPrintfMorse(const char *pFormat, ...);
/** Determine if Morse is currently active.
*
* @return true if Morse is active, otherwise false.
*/
bool morseIsActive();
# ifdef ENABLE_ASSERTS_IN_MORSE
/** printf() Morse an Mbed error vfprintf().
* Note: requires you to edit mbed_error_vfprintf()
* in mbed-os/platform/mbed_board.c so that it is WEAK and
* hence can be overridden here.
*
* @param pFormat the printf() formatter.
* @param args the printf() arguments.
*/
void mbed_error_vfprintf(const char *pFormat, va_list args);
/** printf() Morse an Mbed assert.
* Note: requires you to edit mbed_assert_internal()
* in mbed-os/platform/mbed_assert.c so that it is WEAK and
* hence can be overridden here.
*
* @param expr a pointer to the assert Boolean expression.
* @param file a pointer to the name of the file where the
* assert occurred.
* @param line the line number where the assert occurred.
*/
void mbed_assert_internal(const char *expr, const char *file, int line);
# endif
#endif
// End Of File