From 50c67ecec4895f65ba684e4b46b4b70980a5be6a Mon Sep 17 00:00:00 2001 From: Petteri Aimonen Date: Sun, 4 Jan 2015 11:36:42 +0200 Subject: Add int_size option for generator. This allows overriding the integer field types to e.g. uint8_t for saving RAM. Update issue 139 Status: FixedInGit --- generator/proto/nanopb.proto | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'generator/proto') diff --git a/generator/proto/nanopb.proto b/generator/proto/nanopb.proto index 0716be4b..1bde5967 100644 --- a/generator/proto/nanopb.proto +++ b/generator/proto/nanopb.proto @@ -18,6 +18,14 @@ enum FieldType { FT_IGNORE = 3; // Ignore the field completely. } +enum IntSize { + IS_DEFAULT = 0; // Default, 32/64bit based on type in .proto + IS_8 = 1; + IS_16 = 2; + IS_32 = 3; + IS_64 = 4; +} + // This is the inner options message, which basically defines options for // a field. When it is used in message or file scope, it applies to all // fields. @@ -28,6 +36,10 @@ message NanoPBOptions { // Allocated number of entries in arrays ('repeated' fields) optional int32 max_count = 2; + // Size of integer fields. Can save some memory if you don't need + // full 32 bits for the value. + optional IntSize int_size = 7 [default = IS_DEFAULT]; + // Force type of field (callback or static allocation) optional FieldType type = 3 [default = FT_DEFAULT]; -- cgit 1.2.3-korg