Lets say I have a device which is nearly complete, and I only have a couple of unused IO pins left on my microcontroller. I want the device to have some configurable booleans which the user will probably only set once. I don't have a GUI or anything which could host a menu system. For example, if I were making a speedometer, perhaps I want the user to be able to select between miles-per-hour and kilometers-per-hour. They will probably set this once and never again, so it doesn't have to be very user friendly.
These are the options I can think of:
- Jumper switches on traces. This would seem to require one io pin per option, so I can only handle a couple of options.
- Dip-switch unit connected read via a parallel to serial multiplexer. I just about have the io pins to do this. (are there any shift registers which can feasibly be controlled with only 2 pins...maybe I2C as long as it's available in a DIP package?)
- Some sort of external configuration dongle which could write to the EEPROM of the microcontroller, or flash a customised sketch to it. Expensive and complicated.
- A single button with some elaborate timing scheme to allow options to be programmed into it, like morse code! Difficult to use.
- Somehow encode 10 switches into a single analog voltage to be read by the microcontroller assuming a 10 bit adc. This seems hacky and might not behave itself.
Are there any other clever options?
Just to clarify, right now I have enough spare pins for the configurable options I know about. I'm just thinking about this because it would be nice to build in a little extra capacity for anything else that crops up later.