We study the energy consumption of the communication links in a wireless networked control system, where sensors and actuators exchange information using a wireless channel. Our purpose is to minimize the energy consumption, assuming that the sensors and actuators may be battery-powered devices, without affecting the control system stability, which may be impacted by communication errors. As a consequence, the stability of the control system can be related to the switching time between stable and unstable subsystems. By resorting to a communication-control co-design approach, we obtain a closed-form expression for the optimal outage probability related to the system stability, which is then employed as a constraint to adapt the transmit power and the bit rate in order to minimize the energy consumption. Our results show a decreased energy consumption when compared to the traditional optimization approach in wireless communications, which is to treat communication and control systems independently, fixing the outage probability according to a reliability constraint, not necessarily linked to the stability.