+/*
+ * FUNCTION: sseg_digitbuild
+ *
+ * This function return the hex value of the graphic digit
+ * from a list of segments (ex. ACDP).
+ *
+ * param source The string of segments
+ */
+INLINE uint8_t sseg_digitbuild(const char *gstring, size_t start, size_t stop)
+{
+ /* the default "space" char returned if no "legal" segments recognized */
+ uint8_t graphdigit = SEGMENT_EMPTY;
+ size_t x;
+
+ /* Main cicle */
+ for (x=start;x<=stop;x++)
+ {
+ switch (gstring[x])
+ {
+ case 'A':
+ case 'a':
+ SET_SEGMENT(graphdigit, SEGMENT_A);
+ break;
+ case 'B':
+ case 'b':
+ SET_SEGMENT(graphdigit, SEGMENT_B);
+ break;
+ case 'C':
+ case 'c':
+ SET_SEGMENT(graphdigit, SEGMENT_C);
+ break;
+ case 'D':
+ case 'd':
+ SET_SEGMENT(graphdigit, SEGMENT_D);
+ break;
+ case 'E':
+ case 'e':
+ SET_SEGMENT(graphdigit, SEGMENT_E);
+ break;
+ case 'F':
+ case 'f':
+ SET_SEGMENT(graphdigit, SEGMENT_F);
+ break;
+ case 'G':
+ case 'g':
+ SET_SEGMENT(graphdigit, SEGMENT_G);
+ break;
+ case 'P':
+ case 'p':
+ SET_SEGMENT(graphdigit, SEGMENT_P);
+ break;
+ }
+ }
+ return graphdigit;
+}
+