FPGA and Nios II code for the openPET detector board