Skip to content

Commit 314cecd

Browse files
authored
Merge pull request #48 from zinongli/add_yurikamome
2 parents 41e7306 + b0c18ee commit 314cecd

File tree

11 files changed

+61
-10
lines changed

11 files changed

+61
-10
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ This is a list of metro cards and transit systems that need support or have part
7979
| **Opal** | 🇦🇺 Sydney (and surrounds), NSW, Australia | Mifare DESFire |
8080
| **Opus** | 🇨🇦 Montreal, QC, Canada | Calypso |
8181
| **Rav-Kav** | 🇮🇱 Israel | Calypso |
82-
| **SmartRider** | :australia: Western Australia, Australia | Mifare Classic |
82+
| **SmartRider** | 🇦🇺 Western Australia, Australia | Mifare Classic |
83+
| **Suica** | 🇯🇵 Japan | Felica |
8384
| **Troika** | 🇷🇺 Moscow, Russia | Mifare Classic |
8485

8586

@@ -98,6 +99,7 @@ This is a list of metro cards and transit systems that need support or have part
9899
- **Myki Parser**: [@gornekich](https://github.com/gornekich)
99100
- **Opal Parser**: [@gornekich](https://github.com/gornekich)
100101
- **ITSO Parser**: [@gsp8181](https://github.com/gsp8181), [@hedger](https://github.com/hedger), [@gornekich](https://github.com/gornekich)
102+
- **Suica Parser & UI**: [@zinongli](https://github.com/zinongli)
101103
- **Info Slaves**: [@equipter](https://github.com/equipter), [TheDingo8MyBaby](https://github.com/TheDingo8MyBaby)
102104

103105
---

api/metroflip/metroflip_api.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ extern const Icon I_Suica_VendingThankYou;
230230
extern const Icon I_Suica_YenKanji;
231231
extern const Icon I_Suica_YenSign;
232232
extern const Icon I_Suica_YurakuchoY;
233+
extern const Icon I_Suica_YurikamomeLogo;
234+
extern const Icon I_Suica_YurikamomeU;
233235
extern const Icon I_Suica_CardIcon;
234236
extern const Icon I_Suica_ShopIcon;
235237
extern const Icon I_Suica_VendingIcon;

api/metroflip/metroflip_api_table_i.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ static constexpr auto metroflip_api_table = sort(create_array_t<sym_entry>(
158158
API_VARIABLE(I_Suica_YenKanji, Icon),
159159
API_VARIABLE(I_Suica_YenSign, Icon),
160160
API_VARIABLE(I_Suica_YurakuchoY, Icon),
161+
API_VARIABLE(I_Suica_YurikamomeLogo, Icon),
162+
API_VARIABLE(I_Suica_YurikamomeU, Icon),
161163
API_VARIABLE(I_Suica_CardIcon, Icon),
162164
API_VARIABLE(I_Suica_ShopIcon, Icon),
163165
API_VARIABLE(I_Suica_VendingIcon, Icon),

api/suica/suica_assets.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "suica_structs_i.h"
66

77

8-
#define SUICA_RAILWAY_NUM 24 // Don't count Unknown
8+
#define SUICA_RAILWAY_NUM 25 // Don't count Unknown
99

1010
#define SUICA_RAILWAY_UNKNOWN_NAME "Unknown"
1111
// Railway
@@ -21,6 +21,7 @@ static const Railway RailwaysList[] = {
2121

2222
// Tokyo Waterfront Area Rapid Transit TWR
2323
{0x82, {0, 0}, "Rinkai", 8, SuicaTWR, "R", &I_Suica_RinkaiR},
24+
{0x82, {0, 0}, "Yurikamome", 16, SuicaYurikamome, "U", &I_Suica_YurikamomeU},
2425

2526
// Tokyo Monorail
2627
{0xFA, {0, 0}, "Tokyo Monorail", 11, SuicaTokyoMonorail, "MO", 0},

api/suica/suica_drawings.h

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
#include <lib/nfc/protocols/felica/felica.h>
99
#include <lib/nfc/protocols/felica/felica_poller.h>
10-
#include <lib/nfc/protocols/felica/felica_poller_i.h>
11-
#include <lib/nfc/helpers/felica_crc.h>
1210
#include <lib/bit_lib/bit_lib.h>
1311

1412
#define SUICA_STATION_LIST_PATH APP_ASSETS_PATH("suica/line_")
@@ -62,6 +60,9 @@ static void suica_draw_train_page_1(
6260
case SuicaTWR:
6361
canvas_draw_icon(canvas, 0, 12, &I_Suica_TWRLogo);
6462
break;
63+
case SuicaYurikamome:
64+
canvas_draw_icon(canvas, 0, 12, &I_Suica_YurikamomeLogo);
65+
break;
6566
case SuicaTokyoMonorail:
6667
canvas_draw_icon(canvas, 0, 11, &I_Suica_TokyoMonorailLogo);
6768
break;
@@ -102,6 +103,9 @@ static void suica_draw_train_page_1(
102103
case SuicaTWR:
103104
canvas_draw_icon(canvas, 0, 40, &I_Suica_TWRLogo);
104105
break;
106+
case SuicaYurikamome:
107+
canvas_draw_icon(canvas, 0, 40, &I_Suica_YurikamomeLogo);
108+
break;
105109
case SuicaTokyoMonorail:
106110
canvas_draw_icon(canvas, 0, 39, &I_Suica_TokyoMonorailLogo);
107111
break;
@@ -253,6 +257,17 @@ static void
253257
canvas_draw_str(canvas, 13, 53, furi_string_get_cstr(buffer));
254258
canvas_set_color(canvas, ColorBlack);
255259
break;
260+
case SuicaYurikamome:
261+
canvas_draw_circle(canvas, 24, 38, 24);
262+
canvas_draw_disc(canvas, 24, 38, 21);
263+
264+
canvas_set_color(canvas, ColorWhite);
265+
canvas_draw_icon(canvas, 20, 22, history.entry_line.logo_icon);
266+
canvas_set_font(canvas, FontBigNumbers);
267+
furi_string_printf(buffer, "%02d", history.entry_station.station_number);
268+
canvas_draw_str(canvas, 14, 53, furi_string_get_cstr(buffer));
269+
canvas_set_color(canvas, ColorBlack);
270+
break;
256271
case SuicaRailwayTypeMax:
257272
canvas_draw_circle(canvas, 24, 38, 24);
258273
canvas_draw_circle(canvas, 24, 38, 19);
@@ -351,6 +366,17 @@ static void
351366
canvas_draw_str(canvas, 92, 53, furi_string_get_cstr(buffer));
352367
canvas_set_color(canvas, ColorBlack);
353368
break;
369+
case SuicaYurikamome:
370+
canvas_draw_circle(canvas, 103, 38, 24);
371+
canvas_draw_disc(canvas, 103, 38, 21);
372+
373+
canvas_set_color(canvas, ColorWhite);
374+
canvas_draw_icon(canvas, 99, 22, history.exit_line.logo_icon);
375+
canvas_set_font(canvas, FontBigNumbers);
376+
furi_string_printf(buffer, "%02d", history.exit_station.station_number);
377+
canvas_draw_str(canvas, 93, 53, furi_string_get_cstr(buffer));
378+
canvas_set_color(canvas, ColorBlack);
379+
break;
354380
case SuicaRailwayTypeMax:
355381
canvas_draw_circle(canvas, 103, 38, 24);
356382
canvas_draw_circle(canvas, 103, 38, 19);
@@ -944,7 +970,7 @@ static void suica_history_draw_callback(Canvas* canvas, void* model) {
944970
furi_string_free(buffer);
945971
}
946972

947-
static void suica_view_history_timer_callback(void* context) {
973+
static void suica_view_history_timer_callback(void* context) {
948974
Metroflip* app = (Metroflip*)context;
949975
view_dispatcher_send_custom_event(app->view_dispatcher, 0);
950976
}

api/suica/suica_structs_i.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ typedef enum {
99
SuicaJR,
1010
SuicaMobile,
1111
SuicaTWR,
12+
SuicaYurikamome,
1213
SuicaTokyoMonorail,
1314
SuicaRailwayTypeMax,
1415
} SuicaRailwayCompany;

example_file/suica_example.nfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Travel 00: C8 46 00 00 31 55 85 63 0E B8 00 00 00 00 07 00
77
Travel 01: C7 46 00 00 31 55 67 4B EE A9 8C 00 00 00 06 00
88
Travel 02: 16 01 00 05 31 54 01 18 FA 01 1B 00 00 00 05 00
99
Travel 03: 16 01 00 05 31 53 E3 55 1D 08 1B 00 00 00 04 00
10-
Travel 04: 16 01 00 05 31 47 82 04 E4 25 1B 00 00 00 03 00
10+
Travel 04: 16 01 00 05 31 47 82 04 82 49 1B 00 00 00 03 00
1111
Travel 05: 1D 01 00 02 31 46 D5 14 EF 0D 62 01 00 00 02 00
1212
Travel 06: 12 07 00 00 31 45 02 FD 00 00 E8 03 00 00 01 00
1313
Travel 07: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

files/suica/line_0x82.txt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,21 @@
55
0x82,0x06,Rinkai,Tennozu Isle,5,0
66
0x82,0x07,Rinkai,Shinagawa Seaside,6,0
77
0x82,0x08,Rinkai,Oimachi,7,0
8-
0x82,0x0A,Rinkai,Osaki,8,0
8+
0x82,0x0A,Rinkai,Osaki,8,0
9+
10+
0x82,0x41,Yurikamome,Shimbashi,1,0
11+
0x82,0x42,Yurikamome,Shiodome,2,0
12+
0x82,0x44,Yurikamome,Takeshiba,3,0
13+
0x82,0x45,Yurikamome,Hinode,4,0
14+
0x82,0x46,Yurikamome,Shibaura-futo,5,0
15+
0x82,0x48,Yurikamome,Odaiba-kaihinkoen,6,0
16+
0x82,0x49,Yurikamome,Daiba,7,0
17+
0x82,0x4a,Yurikamome,TYO Int'l Cruise Terminal,8,0
18+
0x82,0x4b,Yurikamome,Telecom Center,9,0
19+
0x82,0x4c,Yurikamome,Aomi,10,0
20+
0x82,0x4e,Yurikamome,Tokyo Big Sight,11,0
21+
0x82,0x4f,Yurikamome,Ariake,12,0
22+
0x82,0x50,Yurikamome,Ariake-Tennis-no-mori,13,0
23+
0x82,0x52,Yurikamome,Shijo-mae,14,0
24+
0x82,0x54,Yurikamome,Shin-toyosu,15,0
25+
0x82,0x56,Yurikamome,Toyosu,16,0
702 Bytes
Loading

images/suica/Suica_YurikamomeU.png

620 Bytes
Loading

0 commit comments

Comments
 (0)