Skip to content

Commit

Permalink
put shared types in 'types.h' (#40)
Browse files Browse the repository at this point in the history
* put shared types in 'types.h'
  • Loading branch information
gitdode authored Sep 17, 2023
1 parent 70dc774 commit 790016f
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 9 deletions.
4 changes: 1 addition & 3 deletions thermidity-avr/bitmaps.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#define BITMAPS_H

#include <stdint.h>
#include "types.h"

#define BAT_0PCT 0
#define BAT_13PCT 1
Expand All @@ -20,9 +21,6 @@
#define BAT_88PCT 7
#define BAT_100PCT 8

typedef uint8_t width_t;
typedef uint8_t height_t;

/**
* A bitmap with its width and height, and data.
*/
Expand Down
4 changes: 1 addition & 3 deletions thermidity-avr/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
#ifndef DISPLAY_H
#define DISPLAY_H

#include "types.h"
#include "bitmaps.h"
#include "font.h"

typedef uint8_t row_t;
typedef uint8_t col_t;

/**
* Copies image data from SRAM to display.
*/
Expand Down
6 changes: 3 additions & 3 deletions thermidity-avr/font.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#ifndef FONT_H
#define FONT_H

typedef uint8_t code_t;
#include "types.h"

/**
* A glyph with its pseudo UTF-8 code point, width and bitmap.
Expand All @@ -17,7 +17,7 @@ typedef struct {
/** Pseudo UTF-8 code point of the glyph. */
const code_t code;
/** Width of the glyph. */
const uint8_t width;
const width_t width;
/** Bitmap of the glyph. */
const __flash uint8_t *bitmap;
} Glyph;
Expand All @@ -32,7 +32,7 @@ typedef struct {
/** Number of glyphs of this font. */
const uint8_t length;
/** Height of (the glyphs of) this font. */
const uint8_t height;
const height_t height;
} Font;

/**
Expand Down
3 changes: 3 additions & 0 deletions thermidity-avr/nbproject/configurations.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<in>spi.c</in>
<in>sram.c</in>
<in>thermidity.c</in>
<in>types.h</in>
<in>unifont.c</in>
<in>usart.c</in>
<in>utils.c</in>
Expand Down Expand Up @@ -108,6 +109,8 @@
tool="0"
flavor2="3">
</item>
<item path="types.h" ex="false" tool="3" flavor2="0">
</item>
</conf>
</confs>
</configurationDescriptor>
23 changes: 23 additions & 0 deletions thermidity-avr/types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* File: types.h
* Author: [email protected]
*
* Created on 17. September 2023, 20:33
*/

#ifndef TYPES_H
#define TYPES_H

/* Width and height of bitmaps and glyphs */
typedef uint8_t width_t;
typedef uint8_t height_t;

/* Number of rows and columns of the display */
typedef uint8_t row_t;
typedef uint8_t col_t;

/* Font code (like UTF-8 code point) */
typedef uint8_t code_t;

#endif /* TYPES_H */

0 comments on commit 790016f

Please sign in to comment.