Synchrony in networks of coupled non-smooth dynamical systems: Extending the master stability function