Questions tagged [uint8t]

uint8_t (C language - Type). uint8_t stores an 8-bit unsigned number, from 0 to 255. It is equal to unsigned char.

272 questions
1
vote
3 answers

Breaking down an uint64_t to an array of uint8_t - C

I would like to convert a 64 bit unsigned int into an array of uint8_t in C.
kimbanu27
  • 27
  • 2
1
vote
1 answer

Flutter convert Hex to Uint8list

I want to create an app sending commands to a colormeter via bluetooth. The colormeter simply wants two Byte as its command, one being the real command and one being its checksum, which is just the next higher hex number, the documentation I have…
Vincent Guttmann
  • 285
  • 6
  • 21
1
vote
1 answer

Programmatically populate a uint8_t array

I have a uint8_t array which should look like this . uint8_t code[1000] = {0x66, 0xba, 0xf8, 0x03} Now I cant hard code values in that array instead , I need to insert them one by one from char buffer[300]. The content of char buffer[300] is a…
sapy
  • 8,952
  • 7
  • 49
  • 60
1
vote
1 answer

Mapping from a size to the corresponding uintN_t type

Given a constexpr size N, is there some way to map it at compile-time to the corresponding uintN_t type, without writing my own exhaustive mapping, such as: template struct size_to_type {}; template<> struct size_to_type<8> { using type…
BeeOnRope
  • 60,350
  • 16
  • 207
  • 386
1
vote
1 answer

Implicit conversion from uint8_t to int gone wrong, when explicit one gone well

I've got a program, which gets numbers n(quantity of blocks) and r(volume), and after it gets n sizes in format firstsize secondsize thirdsize (e.g. 1 1 1) so the overall simplest input is: 1 1 1 1 1 which in theory should return 1. But it…
1
vote
0 answers

How to handle a uint8_t array[8] in C++

I wasn't able to find a correct explanation on how to solve my problem. I have a uint8_t array and I'm able to define it if I use this notation: uint8_t array[] = {0x58, 0x01, 0x11, 0x00, 0x00, 0x00, 0x10, 0x7A}; However, if I use this other…
Marcus Barnet
  • 2,083
  • 6
  • 28
  • 36
1
vote
1 answer

How to convert an Vector of strings to an Vector of uint8_t

Short Version: I have a String: 0x4D;0x90;0x69 I want an array static const uint8_t array[] = { 0x4D, 0x90, 0x69 } How to do? ​ Longer Version: I have an String (buffer) with like this: 0x4D​0x90​0x69 between those hex "numbers" are Zero Width…
Florian sp1rit
  • 575
  • 1
  • 7
  • 20
1
vote
2 answers

Casting from string to uint8 and vice versa

I am making a GUI for images edition and I need to display and handle RGB values from the user. Hence I use uint8_t to store those values and stringstream to get/set the value from/to a string. My problem is that uint8_t is considered as a char so…
CdS
  • 13
  • 4
1
vote
1 answer

Trouble receiving radiopacaket from Lora radio

I am not able to receive the sent radio packet from the Lora rf95 transceiver. I have tried declaring the received array as a char, uint8_t along with using len as size, however the size is 7 so i thought what I did was ok. It didn't recieve…
1
vote
1 answer

Passing received data to a buffer after reaching count

I used to work on java i'm new to C. I'm facing some issues. Here i'm continuosly receiving data from a source. After reaching the count 3 i need to passthe whole data from count 1 to 3 to another function. void check_msg_id( uint8_t *recvdata) { …
Ravikiran
  • 45
  • 11
1
vote
2 answers

Encoding and decoding uint8_t using TinyCbor C Library

I am implementing C++ 11 based application and I am using TinyCbor C library for Encoding and Decoding application specific data as below: #include "cbor.h" #include using namespace std; int main() { struct MyTest { …
User7723337
  • 11,857
  • 27
  • 101
  • 182
1
vote
3 answers

c char array to uint8_t array

I have a basic question regarding a c problem I'm having. My input char array would be something like: 'DABC95C1' and I want to make an uint8_t array out of it 0xDA 0xBC 0x95 0xC1 I have easily access to each char but I dont know how I can form…
vicR
  • 789
  • 4
  • 23
  • 52
1
vote
1 answer

Parse python int to Mysql unsigned TINYINT

I'm trying to store an int value which has a range of 0-220 into a TINYINT MySQL column. hr_max = 220 self.cur.execute("INSERT INTO variables(member, hr_max) VALUES(%s,%s)", (member, hr_max)) self.con.commit() But every time I write…
EinSoldiatGott
  • 63
  • 1
  • 11
1
vote
3 answers

Allocate a type to a uint8_t value

In my project I read the unique ID from an RFID tag, the result is in the form uint8_t TagRead[4]. The result is compared with a number of predefined tag ID values to establish which tag has been read. For example: uint8_t RED1[4] = { 0x73, 0xD5,…
mgh75
  • 77
  • 3
  • 11
1
vote
1 answer

PIL Image.fromarray complains for 6 channel tiff data

I have a tiff image of shape (6,500,500) and I read it as numpy array >>>type(image) >>> image.shape (6, 500, 500) I transpose it to make (500,500,6) image = image.transpose((1, 2, 0)) >>> image.shape (500, 500, 6) Then…
hi15
  • 2,113
  • 6
  • 28
  • 51