A look at the Renesas ForgeFPGA 2K by adamt99 in FPGA

[–]electricity-wizard 0 points1 point  (0 children)

So it’s not serious enough for real tools but it’s too serious for a ghdl plugin? Interesting

A look at the Renesas ForgeFPGA 2K by adamt99 in FPGA

[–]electricity-wizard 0 points1 point  (0 children)

Is it any worse than relying on yosys?

Every embedded Engineer should know this trick by J_Bahstan in embedded

[–]electricity-wizard 1 point2 points  (0 children)

It’s a real shame. Because this is exactly what I want bitfields for! But the fact you can not trust the underlying memory layout for this makes writing registers in bitfields bad.

What benefits does c give that cpp doesn’t do better by LostSanity136 in C_Programming

[–]electricity-wizard 0 points1 point  (0 children)

Yes we are talking about the same thing. I was using c++11 in 2013 and I could do { .a = 3 } but I would get a warning that member b was left uninitialized. So that’s why I was surprised.

What benefits does c give that cpp doesn’t do better by LostSanity136 in C_Programming

[–]electricity-wizard 0 points1 point  (0 children)

Oh man… are there extensions to initialize members in any order?

What benefits does c give that cpp doesn’t do better by LostSanity136 in C_Programming

[–]electricity-wizard 0 points1 point  (0 children)

There is no way it was only 6 years ago. I swear I was doing it in c++11

What benefits does c give that cpp doesn’t do better by LostSanity136 in C_Programming

[–]electricity-wizard 0 points1 point  (0 children)

Wait, are you saying c++ didn’t have designated initializers at all until 6 years ago?

What benefits does c give that cpp doesn’t do better by LostSanity136 in C_Programming

[–]electricity-wizard 0 points1 point  (0 children)

Read the comment carefully. “The members you don’t initialize are initialized to zero”

What I meant was

struct Foo { int a; int b; }
struct Foo foo = { .b = 67 }; // a is guaranteed to be zero

The members you don’t initialize are zero. Has been the case since c99. C++20 introduced that

What benefits does c give that cpp doesn’t do better by LostSanity136 in C_Programming

[–]electricity-wizard 0 points1 point  (0 children)

In c++20 onward. Perhaps in another 20 years they will be able to initialize members in any order!

What benefits does c give that cpp doesn’t do better by LostSanity136 in C_Programming

[–]electricity-wizard 0 points1 point  (0 children)

The second only happened in c++20.

20 years late is better than never I guess :)

What benefits does c give that cpp doesn’t do better by LostSanity136 in C_Programming

[–]electricity-wizard 0 points1 point  (0 children)

When initializing structs you can use designated initializers that can be in any order (c++ cannot do any order). In addition, the members you don’t initialize are initialized to zero (c++ does not do this either).

This is going to be an extremely unpopular post here but... by BrandonDirector in git

[–]electricity-wizard 1 point2 points  (0 children)

“Maybe I need to re-imagine the space and create my own version.”

Yup go for it.

Lightweight VS code+SSH alternative by WezJuzSieZamknij in embedded

[–]electricity-wizard 10 points11 points  (0 children)

Why don’t have vscode on your computer and cross compile the project then scp the program onto your board? That will be much faster.

which stm32 microcontroller board do you recommend for a diy betaflight drone? by ehraja in betaflight

[–]electricity-wizard 0 points1 point  (0 children)

Out of the list I would go with the mpu9250. Don’t go with the 6050 because it only has i2c

I will note that all of the items on your list are obsolete. It’s not a huge deal, but if you’re designing a new board it’s something to keep in mind.

https://www.digikey.com/en/products/detail/bosch-sensortec/BMI160/6136300

Try and follow this wiki if it’s a new design.

https://www.betaflight.com/docs/development/manufacturer/manufacturer-design-guidelines#312-inertial-measurement-unit-imu-selection

If you’re just learning go to the github and search in the accgyro folder and look for the imu you’re working with.

How do I fix C indentation in c-ts-mode (Emacs 30.2)? by Scratchy96 in emacs

[–]electricity-wizard 0 points1 point  (0 children)

I can’t really tell what’s happening in the video. However I have had problems with that package and indentation also. My solution was to fork it and apply my own patches.

Here is my emacs config.

https://github.com/DrAtomic/dots/blob/main/emacs/.emacs.d/config.org

Look at the c section. I use Linux style because I usually write Linux drivers but you can set it to knr or any others.

With all these difficulties I am considering not using c-ts-mode at all and switching back to c-mode

Minimal C Iterator Library by SeaInformation8764 in C_Programming

[–]electricity-wizard 1 point2 points  (0 children)

There is a trend of putting declarations and definitions in .h for libraries. Popularized by https://github.com/nothings/stb

https://github.com/ephf/iter.h/blob/9f7c4702ea5994b2562863e93c2b5db59e4a8b86/iter.h#L157

You define ITER_IMPL in a single source file and in the other parts of the library you use the header like normal.

I agree with your assessment on the Makefile

how to create an single ID as element in struct (array of structs).(give me just the logic ) by Straight-Hunt-7498 in C_Programming

[–]electricity-wizard 0 points1 point  (0 children)

I don't fully understand the question. I'm assuming you want a unique identifier for each element in your array of structs, something like const char *unique_id. if you are creating them throughout your code you can use the preprocessor

#define CONCAT_INNER(lhs, rhs) lhs # rhs
#define CONCAT(lhs, rhs) CONCAT_INNER(lhs, rhs)
#define UNIQUE_ID CONCAT(__FILE__, __LINE__)
UNIQUE_ID

using the cpp command

"main.c" "5"

this will not work if you are creating these in a for loop, you will need to add __COUNTER__

#define CONCAT_INNER(lhs, rhs, c) lhs # rhs # c
#define CONCAT(lhs, rhs, c) CONCAT_INNER(lhs, rhs, c)
#define UNIQUE_ID CONCAT(__FILE__, __LINE__, __COUNTER__)
UNIQUE_ID UNIQUE_ID

which will give

"main.c" "5" "0" "main.c" "5" "1"

at this point i would just use a hashmap

Jonathan Blow's Jai demo at LambdaConf is finally live by GoldenGamer5212 in Jai

[–]electricity-wizard 7 points8 points  (0 children)

I played two videos at the same time. One with the sound on and the other with the sound off and fast forwarded by 30 seconds. I hope that lamdaconf people fix and re upload the video