The first important contribution of this paper is to introduce for the first time a duality-based interpretation of piecewise affine (PWA) systems. This enables PWA controller synthesis to be formulated as a convex optimization problem. PWA L2-gain analysis and synthesis is also extended to PWA systems whose output is also a PWA function of the state (as opposed to a piecewise-linear function). In addition, a convex optimization program is proposed to compute a PWA differential inclusion for nonlinear systems for which the nonlinearity is a function of one variable. A numerical example illustrates the usefulness of the new approach.