IEEE 802.15.4 subsystem
Sign in or create your account | Project List | Help
IEEE 802.15.4 subsystem Git Source Tree
Root/
| Source at commit 49e7c83796bc04941e9dbcec69bc0751563ff4d4 created 6 years 9 months ago. By Werner Almesberger, atusb/: use ""VDD" symbol from kicad-libs | |
|---|---|
| 1 | /* |
| 2 | * atrf-rssi/letter.c - Draw 7 segment style letters |
| 3 | * |
| 4 | * Written 2011 by Werner Almesberger |
| 5 | * Copyright 2011 Werner Almesberger |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | */ |
| 12 | |
| 13 | |
| 14 | #include <stdint.h> |
| 15 | |
| 16 | #include "SDL.h" |
| 17 | #include "SDL_gfxPrimitives.h" |
| 18 | |
| 19 | #include "letter.h" |
| 20 | |
| 21 | |
| 22 | static void hlines_3(SDL_Surface *s, int x0, int x1, int y0, int ym, int y1, |
| 23 | uint32_t fg) |
| 24 | { |
| 25 | hlineColor(s, x0, x1, y0, fg); |
| 26 | hlineColor(s, x0, x1, ym, fg); |
| 27 | hlineColor(s, x0, x1, y1, fg); |
| 28 | } |
| 29 | |
| 30 | |
| 31 | void letter(SDL_Surface *s, char c, int x0, int x1, int y0, int ym, int y1, |
| 32 | uint32_t fg) |
| 33 | { |
| 34 | switch (c) { |
| 35 | case 'E': |
| 36 | hlines_3(s, x0, x1, y0, ym, y1, fg); |
| 37 | vlineColor(s, x0, y0, y1, fg); |
| 38 | break; |
| 39 | case 'U': |
| 40 | vlineColor(s, x0, ym, y1, fg); |
| 41 | /* fall through */ |
| 42 | case 'J': |
| 43 | hlineColor(s, x0, x1, y0, fg); |
| 44 | vlineColor(s, x1, y0, y1, fg); |
| 45 | vlineColor(s, x0, y0, ym, fg); |
| 46 | break; |
| 47 | case 'P': |
| 48 | hlineColor(s, x0, x1, y1, fg); |
| 49 | hlineColor(s, x0, x1, ym, fg); |
| 50 | vlineColor(s, x1, ym, y1, fg); |
| 51 | vlineColor(s, x0, y0, y1, fg); |
| 52 | break; |
| 53 | case 'S': |
| 54 | hlines_3(s, x0, x1, y0, ym, y1, fg); |
| 55 | vlineColor(s, x0, ym, y1, fg); |
| 56 | vlineColor(s, x1, y0, ym, fg); |
| 57 | break; |
| 58 | hlineColor(s, x0, x1, y0, fg); |
| 59 | vlineColor(s, x0, y0, y1, fg); |
| 60 | default: |
| 61 | abort(); |
| 62 | } |
| 63 | } |
| 64 | |
