Generalized Ashtekar variables for Palatini f(R) models