mems and SPI related code