diff options
Diffstat (limited to 'c/resistor-color/src')
-rw-r--r-- | c/resistor-color/src/resistor_color.c | 13 | ||||
-rw-r--r-- | c/resistor-color/src/resistor_color.h | 12 |
2 files changed, 25 insertions, 0 deletions
diff --git a/c/resistor-color/src/resistor_color.c b/c/resistor-color/src/resistor_color.c new file mode 100644 index 0000000..ee85f6e --- /dev/null +++ b/c/resistor-color/src/resistor_color.c @@ -0,0 +1,13 @@ +#include "resistor_color.h" + +static resistor_band_t bands[] = { + BLACK, BROWN, RED, ORANGE, YELLOW, GREEN, BLUE, VIOLET, GREY, WHITE +}; + +int color_code(resistor_band_t color) { + return color; +} + +const resistor_band_t* colors(void) { + return bands; +} diff --git a/c/resistor-color/src/resistor_color.h b/c/resistor-color/src/resistor_color.h new file mode 100644 index 0000000..216bdd0 --- /dev/null +++ b/c/resistor-color/src/resistor_color.h @@ -0,0 +1,12 @@ +#ifndef RESISTOR_COLOR_H +#define RESISTOR_COLOR_H + +typedef enum { + BLACK, BROWN, RED, ORANGE, YELLOW, GREEN, BLUE, VIOLET, GREY, WHITE +} resistor_band_t; + +int color_code(resistor_band_t); + +const resistor_band_t* colors(void); + +#endif |