Free-electron maser based on the Smith–Purcell effect