Is it possible to code a DPDT switch?

You know, this thing I have used in many projects that are similar to this:

I use it for raspberry pi solar projects I've done. Awesome little thing! No programming needed. You just use a DC-DC converter on your panel, set it slightly higher than the battery voltage, and the board will select whichever is highest.