Code: Select all
typdef enum Foo_t { bar, baz, quux };
Foo_t foo;
void set_foo(Foo_t arg) {
foo = arg;
}
Code: Select all
enum Foo_enum {...};
typedef Foo_t Foo_enum;
and nothing seems to work. Is there something fundamental I'm missing?
Moderators: adafruit_support_bill, adafruit
Code: Select all
typdef enum Foo_t { bar, baz, quux };
Foo_t foo;
void set_foo(Foo_t arg) {
foo = arg;
}
Code: Select all
enum Foo_enum {...};
typedef Foo_t Foo_enum;
Code: Select all
typedef enum {
bar, baz, quux
} Foo_t;
Code: Select all
typedef enum {
bar, baz, quux
} Foo_t;
Foo_t foo;
void set_foo(Foo_t arg) {
foo = arg;
}
void setup() {
set_foo( quux );
}
void loop() {
}
int main () {
setup();
while ( 1 ) {
loop();
}
}
Code: Select all
// FILENAME: sketch.h
typedef enum {
bar, baz, quux
} Foo_t;
Code: Select all
// FILENAME: sketch.c
#include "sketch.h"
Foo_t foo;
void set_foo(Foo_t arg) {
foo = arg;
}
void setup() {
set_foo( quux );
}
void loop() {
}