Fold Color 2.6 helpers into proto.h

One extra header for a single type code did not match how the rest of the protocol layer is laid out.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
sosnek
2026-08-31 00:44:27 -04:00
co-authored by Cursor
parent 3b8ad97c34
commit 3ebae10ada
3 changed files with 35 additions and 44 deletions
-42
View File
@@ -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 <stdint.h>
#include <stdbool.h>
#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);
}
+34 -1
View File
@@ -12,13 +12,46 @@
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#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. */
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../protocol/tagtinker_color26.h"
#include "../protocol/tagtinker_proto.h"
#include <stdio.h>
#include <stdlib.h>