From 16a0afe08d63161615ed21dd2189a39a3682ca99 Mon Sep 17 00:00:00 2001 From: Vinzenz Schroeter Date: Wed, 16 Oct 2024 18:29:36 +0200 Subject: [PATCH] add constants for brightness in C api --- .../examples/lang_c/include/servicepoint.h | 15 +++++++++++++++ .../servicepoint_binding_c/src/brightness_grid.rs | 8 ++++++++ .../ServicePoint/BindGen/ServicePoint.g.cs | 3 +++ 3 files changed, 26 insertions(+) diff --git a/crates/servicepoint_binding_c/examples/lang_c/include/servicepoint.h b/crates/servicepoint_binding_c/examples/lang_c/include/servicepoint.h index 617cdeb..118c36b 100644 --- a/crates/servicepoint_binding_c/examples/lang_c/include/servicepoint.h +++ b/crates/servicepoint_binding_c/examples/lang_c/include/servicepoint.h @@ -8,6 +8,21 @@ #include #include +/** + * Count of possible brightness values + */ +#define SP_BRIGHTNESS_LEVELS 12 + +/** + * see [Brightness::MAX] + */ +#define SP_BRIGHTNESS_MAX 11 + +/** + * see [Brightness::MIN] + */ +#define SP_BRIGHTNESS_MIN 0 + /** * pixel count on whole screen */ diff --git a/crates/servicepoint_binding_c/src/brightness_grid.rs b/crates/servicepoint_binding_c/src/brightness_grid.rs index 4a527fe..3c94b57 100644 --- a/crates/servicepoint_binding_c/src/brightness_grid.rs +++ b/crates/servicepoint_binding_c/src/brightness_grid.rs @@ -4,9 +4,17 @@ use crate::SPByteSlice; use servicepoint::{Brightness, DataRef, Grid, PrimitiveGrid}; +use std::convert::Into; use std::intrinsics::transmute; use std::ptr::NonNull; +/// see [Brightness::MIN] +pub const SP_BRIGHTNESS_MIN: u8 = 0; +/// see [Brightness::MAX] +pub const SP_BRIGHTNESS_MAX: u8 = 11; +/// Count of possible brightness values +pub const SP_BRIGHTNESS_LEVELS: u8 = 12; + /// A grid containing brightness values. /// /// # Examples diff --git a/crates/servicepoint_binding_cs/ServicePoint/BindGen/ServicePoint.g.cs b/crates/servicepoint_binding_cs/ServicePoint/BindGen/ServicePoint.g.cs index 210d54e..2b5f14e 100644 --- a/crates/servicepoint_binding_cs/ServicePoint/BindGen/ServicePoint.g.cs +++ b/crates/servicepoint_binding_cs/ServicePoint/BindGen/ServicePoint.g.cs @@ -17,6 +17,9 @@ namespace ServicePoint.BindGen public const nuint SP_TILE_SIZE = 8; public const nuint SP_TILE_WIDTH = 56; public const nuint SP_TILE_HEIGHT = 20; + public const byte SP_BRIGHTNESS_MIN = 0; + public const byte SP_BRIGHTNESS_MAX = 11; + public const byte SP_BRIGHTNESS_LEVELS = 12; ///