Integrated fabrication of polysilicon mechanisms