An Event-Driven Closed-Loop System for Real-Time FES Control