Equilibrium and stability of tensegrity structures: A convex analysis approach