Bidirectional Brain-Machine Interfaces For Modulating Stimulation And Neural Plasticity