reflow code and adding spi communication