Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8355371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:50:30+00:00 2026-06-09T09:50:30+00:00

I have a large amount of constant data that I need to store in

  • 0

I have a large amount of constant data that I need to store in a header file. Due to the nature of the data (how its nested), I decided to use a structure that is initialized by the preprocessor.

I am trying to initialize these structs like so:

typedef struct s_PWM {
  uint8_t muxmode;
  char *name;
  char *path;
} PWM;

typedef struct s_PIN {
  char *name;
  uint8_t gpio;
  char *mux;
  uint8_t eeprom;
  PWM *pwm;
} PIN;

This would allow me to do something like

PIN p1 = P8_19;

to, in a sense, assemble a struct with the proper attributes.

Basically, you can send a pin into a function

pinMode(P8_19, OUTPUT)

This is the line in question

#define P8_19 ((PIN){"EHRPWM2A", 22, "gpmc_ad8", 14, (PWM*){4, "EHRPWM2A", "ehrpwm.2:0"}})

This is the warning

src/gpio.c:50:2: warning: excess elements in scalar initializer
src/gpio.c:50:2: warning: (near initialization for '(anonymous)')
src/gpio.c:50:2: warning: excess elements in scalar initializer
src/gpio.c:50:2: warning: (near initialization for '(anonymous)')

Does anyone have any ideas why this is happening? Am I incorrectly nesting the PWM* struct into the PIN struct?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T09:50:31+00:00Added an answer on June 9, 2026 at 9:50 am

    Short answer: Yes.

    Instead of having a pointer you should use the structure directly:

    typedef struct s_PIN {
      char *name;
      uint8_t gpio;
      char *mux;
      uint8_t eeprom;
      PWM pwm;  /* Notice: not a pointer */
    } PIN;
    

    Also, you don’t need to do the casting:

    #define P8_19 {"EHRPWM2A", 22, "gpmc_ad8", 14, {4, "EHRPWM2A", "ehrpwm.2:0"}}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large amount of log data that I need to get some
I have a large amount of data I need to store, and be able
I have a rather large amount of data (100 MB or so), that I
I have a WCF service that can return large amount of data depending on
I have a highly formatted file with large amount of data which I used
I have a windows service that receives a large amount of data that needs
I have a large amount of data stored in an XML file, 173 MB
I have a large amount of text data that I want to display in
I have a large amount of spatial data I need analyze and put into
I have a large amount of input data that I want to compress to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.