how do I change one single bit?

HyperUniverse
Posts: 33
Joined: Fri Oct 29, 2021 11:20 pm

how do I change one single bit?

Postby HyperUniverse » Fri Dec 03, 2021 1:21 pm

How do I change one bit inside a uint8_t?

For example I used to do this:

Code: Select all

unsigned char something ;

something.F5 = 0 ;
But I can't get it to work in esp-idf.

Can anybody show me how to do it, please?

Thanks.

mgsecord62
Posts: 20
Joined: Thu Nov 02, 2017 12:40 am

Re: how do I change one single bit?

Postby mgsecord62 » Fri Dec 03, 2021 6:51 pm

In the past I have used the the bitwise OR, AND or XOR operators (standard C language). You can also create a structure. More details can be found at https://www.codesdope.com/blog/article/ ... -bit-in-c/.

RalphD
Posts: 103
Joined: Thu Nov 25, 2021 9:02 pm

Re: how do I change one single bit?

Postby RalphD » Sat Dec 04, 2021 9:54 am

http://kali.azc.uam.mx/clc/03_docencia/ ... %2B%2B.pdf

page 13 'bitwise operators

that should help, good luck

Who is online

Users browsing this forum: No registered users and 427 guests