The Neural Engine: A Reprogrammable Low Power Platform for Closed-Loop Optogenetics