diff --git a/protocol/tagtinker_color26.h b/protocol/tagtinker_color26.h deleted file mode 100644 index 8552440..0000000 --- a/protocol/tagtinker_color26.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SmartTAG Color 2.6 (type 1626) geometry and page policy. - * Glass is landscape 296x152. The image header is 152x296 (short x long). - */ - -#pragma once - -#include -#include - -#define TAGTINKER_TYPE_SMARTAG_COLOR_26 1626 -#define TAGTINKER_COLOR26_WIRE_W 152U -#define TAGTINKER_COLOR26_WIRE_H 296U -#define TAGTINKER_COLOR26_GLASS_W 296U -#define TAGTINKER_COLOR26_GLASS_H 152U - -static inline bool tagtinker_type_needs_wh_swap(uint16_t type_code) { - return type_code == TAGTINKER_TYPE_SMARTAG_COLOR_26; -} - -static inline bool tagtinker_type_uses_ui_page(uint16_t type_code) { - return tagtinker_type_needs_wh_swap(type_code); -} - -/* Store-used Color 2.6 tags keep the barcode on page 1. Page 2 is the image - * slot. Unspecified pages (0 or 1) map there. Explicit 2-7 are left alone. */ -static inline uint8_t tagtinker_color26_resolve_page(uint8_t page) { - if(page <= 1U) return 2U; - if(page > 7U) return 7U; - return page; -} - -/* proto (px, py) on the 152x296 wire canvas -> glass (bx, by) 296x152. */ -static inline void tagtinker_color26_proto_to_glass( - uint16_t proto_w, - uint16_t px, - uint16_t py, - uint16_t* bx, - uint16_t* by) { - *bx = py; - *by = (uint16_t)(proto_w - 1U - px); -} diff --git a/protocol/tagtinker_proto.h b/protocol/tagtinker_proto.h index db96527..1861cb7 100644 --- a/protocol/tagtinker_proto.h +++ b/protocol/tagtinker_proto.h @@ -12,13 +12,46 @@ #include #include #include -#include "tagtinker_color26.h" #define TAGTINKER_PROTO_DM 0x85 #define TAGTINKER_PROTO_SEG 0x84 #define TAGTINKER_MAX_FRAME_SIZE 96 #define TAGTINKER_IMAGE_DATA_BYTES_PER_FRAME 20U +/* Color 2.6 glass is landscape 296x152. Image header is 152x296 (short x long). */ +#define TAGTINKER_TYPE_SMARTAG_COLOR_26 1626 +#define TAGTINKER_COLOR26_WIRE_W 152U +#define TAGTINKER_COLOR26_WIRE_H 296U +#define TAGTINKER_COLOR26_GLASS_W 296U +#define TAGTINKER_COLOR26_GLASS_H 152U + +static inline bool tagtinker_type_needs_wh_swap(uint16_t type_code) { + return type_code == TAGTINKER_TYPE_SMARTAG_COLOR_26; +} + +static inline bool tagtinker_type_uses_ui_page(uint16_t type_code) { + return tagtinker_type_needs_wh_swap(type_code); +} + +/* Store-used Color 2.6 tags keep the barcode on page 1. Page 2 is the image + * slot. Unspecified pages (0 or 1) map there. Explicit 2-7 are left alone. */ +static inline uint8_t tagtinker_color26_resolve_page(uint8_t page) { + if(page <= 1U) return 2U; + if(page > 7U) return 7U; + return page; +} + +/* Wire (px, py) on 152x296 -> glass (bx, by) 296x152. */ +static inline void tagtinker_color26_proto_to_glass( + uint16_t proto_w, + uint16_t px, + uint16_t py, + uint16_t* bx, + uint16_t* by) { + *bx = py; + *by = (uint16_t)(proto_w - 1U - px); +} + typedef struct TagTinkerApp TagTinkerApp; /* CRC used by the ESL wire format. */ diff --git a/tests/test_color26.c b/tests/test_color26.c index 168b302..52fe119 100644 --- a/tests/test_color26.c +++ b/tests/test_color26.c @@ -1,4 +1,4 @@ -#include "../protocol/tagtinker_color26.h" +#include "../protocol/tagtinker_proto.h" #include #include