Yudong Xiao
/
pokemon
This is test version of Pokemongo game. ELEC 2645 final project.
pokeball/ShiftReg.cpp
- Committer:
- shalwego
- Date:
- 2021-04-15
- Revision:
- 0:819c2d6a69ac
File content as of revision 0:819c2d6a69ac:
#include "ShiftReg.h" ShiftReg::ShiftReg() { clkout = new DigitalOut(p7); dataout = new DigitalOut(p5); latchout = new DigitalOut(p30); } ShiftReg::~ShiftReg() { delete clkout; delete dataout; delete latchout; } void ShiftReg::write(int data) { *latchout = 0; for (int i = 7; i >= 0; i--) { *clkout = 0; *dataout = (data & (1 << i)) != 0; *clkout = 1; } *latchout = 1; }