Barry Bannan has signed a three-year deal with Crystal Palace after Aston Villa accepted an undisclosed offer.