Browse code

Rework font code, add new fonts, also proportional, rework watch usage - "SET" button now enters settings mode

Nils Faerber authored on 04/05/2013 19:23:25
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,123 +0,0 @@
1
-//==============================================================================
2
-//  Copyright 2011 Meta Watch Ltd. - http://www.MetaWatch.org/
3
-// 
4
-//  Licensed under the Meta Watch License, Version 1.0 (the "License");
5
-//  you may not use this file except in compliance with the License.
6
-//  You may obtain a copy of the License at
7
-//  
8
-//      http://www.MetaWatch.org/licenses/license-1.0.html
9
-//
10
-//  Unless required by applicable law or agreed to in writing, software
11
-//  distributed under the License is distributed on an "AS IS" BASIS,
12
-//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-//  See the License for the specific language governing permissions and
14
-//  limitations under the License.
15
-//==============================================================================
16
-
17
-/******************************************************************************/
18
-/*! \file Fonts.h
19
-*
20
-* Fonts functions common to OLED and LCD version
21
-*
22
-* LCD is ROW based, OLED is column based
23
-*/
24
-/******************************************************************************/
25
-
26
-#include "oswald.h"
27
-
28
-#ifndef FONTS_H
29
-#define FONTS_H
30
-
31
-/*! There are three fonts defined for the MetaWatch LCD 
32
- * they are 5, 7 and 16 pixels tall with variable width
33
- */
34
-typedef enum 
35
-{
36
-  MetaWatch5,
37
-  MetaWatch7,
38
-  MetaWatch16,
39
-  MetaWatchTime,
40
-  MetaWatch5Oled,
41
-  MetaWatch7Oled,
42
-  MetaWatch16Oled,
43
-  MetaWatchIconOled,
44
-  MetaWatchMonospaced10
45
-} etFontType;
46
-
47
-/*! Use to size the bitmap used in the Display Task for printing characters FOR 
48
- * THE LCD VERSION
49
- */
50
-#define MAX_FONT_ROWS ( 19 )
51
-
52
-/*! The maximum number of columns any font (or icon) requires.  This is 
53
- * used to define the size of the bitmap passed into font functions FOR THE
54
- * OLED version
55
- */
56
-#define MAX_FONT_COLUMNS ( 30 )
57
-
58
-#define TOTAL_TIME_CHARACTERS      ( 12 )
59
-#define TIME_CHARACTER_COLON_INDEX ( 10 )
60
-#define TIME_CHARACTER_SPACE_INDEX ( 11 )
61
-
62
-/*! Convert a character into an index into the font table
63
- *
64
- * \param CharIn is the input character
65
- * \return Index into the table
66
- */
67
-unsigned char MapCharacterToIndex(unsigned char CharIn);
68
-
69
-/*! Convert a digit (0-9) into an index into the font table
70
- *
71
- * \param Digit is a number
72
- * \return Index into the table
73
- */
74
-unsigned char MapDigitToIndex(unsigned char Digit);
75
-
76
-/*! Get the bitmap for the specified character
77
- *
78
- * \param Character is the desired character
79
- * \param pBitmap pointer to an array of integers that holds the bitmap
80
- *
81
- * \note pBitmap must point to an object large enough to hold the largest bitmap
82
- * 
83
- * \note For the LCD bitmaps the font height is the same as number of rows. 
84
- * If the width is less than 8 then each row is a byte.
85
- * If the width is less than 16 but > 8 then each row is a word.
86
- * The function works with ints so that it is generic for both types
87
- *
88
- */
89
-void GetCharacterBitmap(unsigned char Character, u16t *pBitmap);
90
-
91
-/*! Get the width for a specified character *
92
- *
93
- * \param Character is the desired character
94
- * \return Width of character in columns
95
- */
96
-unsigned char GetCharacterWidth(unsigned char Character);
97
-
98
-/*! Set the font type used for future Get operations *
99
- *
100
- * \param Type of font
101
- */
102
-void SetFont(etFontType Type);
103
-
104
-/*! Set the font spacing for the current font*
105
- *
106
- * \param Spacing is the number of columns between characters
107
- *
108
- * \note The characters do not have any 'natural' spacing between them
109
- */
110
-void SetFontSpacing(unsigned char Spacing);
111
-
112
-/*! 
113
- * \return The font spacing in columns 
114
- */
115
-unsigned char GetFontSpacing(void);
116
-
117
-
118
-/*! 
119
- * \return The font height in rows 
120
- */
121
-unsigned char GetCharacterHeight(void);
122
-
123
-#endif /*FONTS_H*/
Browse code

Add fixes for it to work properly on microcontroller

Nils Faerber authored on 19/03/2013 19:22:58
Showing 1 changed files
... ...
@@ -23,6 +23,8 @@
23 23
 */
24 24
 /******************************************************************************/
25 25
 
26
+#include "oswald.h"
27
+
26 28
 #ifndef FONTS_H
27 29
 #define FONTS_H
28 30
 
... ...
@@ -38,8 +40,8 @@ typedef enum
38 40
   MetaWatch5Oled,
39 41
   MetaWatch7Oled,
40 42
   MetaWatch16Oled,
41
-  MetaWatchIconOled
42
-  
43
+  MetaWatchIconOled,
44
+  MetaWatchMonospaced10
43 45
 } etFontType;
44 46
 
45 47
 /*! Use to size the bitmap used in the Display Task for printing characters FOR 
... ...
@@ -84,7 +86,7 @@ unsigned char MapDigitToIndex(unsigned char Digit);
84 86
  * The function works with ints so that it is generic for both types
85 87
  *
86 88
  */
87
-void GetCharacterBitmap(unsigned char Character,unsigned int * pBitmap);
89
+void GetCharacterBitmap(unsigned char Character, u16t *pBitmap);
88 90
 
89 91
 /*! Get the width for a specified character *
90 92
  *
Browse code

Add MetaWatch Fonts package, LcdDisplay and start demo

Nils Faerber authored on 31/07/2012 21:42:03
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,121 @@
1
+//==============================================================================
2
+//  Copyright 2011 Meta Watch Ltd. - http://www.MetaWatch.org/
3
+// 
4
+//  Licensed under the Meta Watch License, Version 1.0 (the "License");
5
+//  you may not use this file except in compliance with the License.
6
+//  You may obtain a copy of the License at
7
+//  
8
+//      http://www.MetaWatch.org/licenses/license-1.0.html
9
+//
10
+//  Unless required by applicable law or agreed to in writing, software
11
+//  distributed under the License is distributed on an "AS IS" BASIS,
12
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+//  See the License for the specific language governing permissions and
14
+//  limitations under the License.
15
+//==============================================================================
16
+
17
+/******************************************************************************/
18
+/*! \file Fonts.h
19
+*
20
+* Fonts functions common to OLED and LCD version
21
+*
22
+* LCD is ROW based, OLED is column based
23
+*/
24
+/******************************************************************************/
25
+
26
+#ifndef FONTS_H
27
+#define FONTS_H
28
+
29
+/*! There are three fonts defined for the MetaWatch LCD 
30
+ * they are 5, 7 and 16 pixels tall with variable width
31
+ */
32
+typedef enum 
33
+{
34
+  MetaWatch5,
35
+  MetaWatch7,
36
+  MetaWatch16,
37
+  MetaWatchTime,
38
+  MetaWatch5Oled,
39
+  MetaWatch7Oled,
40
+  MetaWatch16Oled,
41
+  MetaWatchIconOled
42
+  
43
+} etFontType;
44
+
45
+/*! Use to size the bitmap used in the Display Task for printing characters FOR 
46
+ * THE LCD VERSION
47
+ */
48
+#define MAX_FONT_ROWS ( 19 )
49
+
50
+/*! The maximum number of columns any font (or icon) requires.  This is 
51
+ * used to define the size of the bitmap passed into font functions FOR THE
52
+ * OLED version
53
+ */
54
+#define MAX_FONT_COLUMNS ( 30 )
55
+
56
+#define TOTAL_TIME_CHARACTERS      ( 12 )
57
+#define TIME_CHARACTER_COLON_INDEX ( 10 )
58
+#define TIME_CHARACTER_SPACE_INDEX ( 11 )
59
+
60
+/*! Convert a character into an index into the font table
61
+ *
62
+ * \param CharIn is the input character
63
+ * \return Index into the table
64
+ */
65
+unsigned char MapCharacterToIndex(unsigned char CharIn);
66
+
67
+/*! Convert a digit (0-9) into an index into the font table
68
+ *
69
+ * \param Digit is a number
70
+ * \return Index into the table
71
+ */
72
+unsigned char MapDigitToIndex(unsigned char Digit);
73
+
74
+/*! Get the bitmap for the specified character
75
+ *
76
+ * \param Character is the desired character
77
+ * \param pBitmap pointer to an array of integers that holds the bitmap
78
+ *
79
+ * \note pBitmap must point to an object large enough to hold the largest bitmap
80
+ * 
81
+ * \note For the LCD bitmaps the font height is the same as number of rows. 
82
+ * If the width is less than 8 then each row is a byte.
83
+ * If the width is less than 16 but > 8 then each row is a word.
84
+ * The function works with ints so that it is generic for both types
85
+ *
86
+ */
87
+void GetCharacterBitmap(unsigned char Character,unsigned int * pBitmap);
88
+
89
+/*! Get the width for a specified character *
90
+ *
91
+ * \param Character is the desired character
92
+ * \return Width of character in columns
93
+ */
94
+unsigned char GetCharacterWidth(unsigned char Character);
95
+
96
+/*! Set the font type used for future Get operations *
97
+ *
98
+ * \param Type of font
99
+ */
100
+void SetFont(etFontType Type);
101
+
102
+/*! Set the font spacing for the current font*
103
+ *
104
+ * \param Spacing is the number of columns between characters
105
+ *
106
+ * \note The characters do not have any 'natural' spacing between them
107
+ */
108
+void SetFontSpacing(unsigned char Spacing);
109
+
110
+/*! 
111
+ * \return The font spacing in columns 
112
+ */
113
+unsigned char GetFontSpacing(void);
114
+
115
+
116
+/*! 
117
+ * \return The font height in rows 
118
+ */
119
+unsigned char GetCharacterHeight(void);
120
+
121
+#endif /*FONTS_H*/