A simple single digit seven segment display

To get you started, think of the segment led displays as a dot matrix display. Your display routines are simply transmitting the buffer data to the segment pins / digit pins. Your user application can load up whatever segment information they want into the buffer and it will be displayed there.

Let's say that you are dealing with a 8-digit 7-segment display, common cathod (aka max7219 clone).

You need to figure out a flexible way to define the segment pins

#define SEG_A  2 //led's segment A connected to pin 2
#define SEG_B  5 //led's segment B connected to pin 5
...
#define SEG_DP 10 //led's segment DP connected to pin 10

//macros to turn on / off a pin, common cathod
#define SEG_ON(pin)  pinWrite(pin, HIGH)
#define SEG_OFF(pin) pinWrite(pin, LOW)

Similarly, you can define the digital pins

#define DIG0  11  //digit0 on pin 11
..
#define DIG7  13  //digit7 on pin 13

//macros to turn on / off a digit pin, common cathod
#define DIG_ON(pin)  pinWrite(pin, LOW)
#define DIG_OFF(pin) pinWrite(pin, HIGH)

Now, those routines are for common cathode displays. But by changing them quickly, you can reuse the same macro names in a common anode display, or to use a npn switch / pnp switch. The rest of your code remains unchanged.

Using pin names helps repurpose the code in different project, or to facilitate layout / wiring.