In this paper, we suppose that a planar piecewise Hamiltonian system, with a straight line of separation, has a piecewise generalized homoclinic loop passing through a Saddle-Fold point, and assume that there exists a family of piecewise smooth periodic orbits near the loop. By studying the asymptotic expansion of the first order Melnikov function corresponding to the period annulus, we obtain the formulas of the first six coefficients in the expansion, based on which, we provide a lower bound for the maximal number of limit cycles bifurcated from the period annulus. As applications, two concrete systems are considered. Especially, the first one reveals that a quadratic piecewise Hamiltonian system can have five limit cycles near a generalized homoclinic loop under a quadratic piecewise smooth perturbation. Compared with the smooth case [Horozov & Iliev, 1994; Han et al., 1999], three more limit cycles are found.