O2- and CO-rich Atmospheres for Potentially Habitable Environments on TRAPPIST-1 Planets