keybrd library is an open source library for creating custom-keyboard firmware.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

PortMCP23S17.cpp 546B

123456789101112
  1. #include "PortMCP23S17.h"
  2. /* push() writes data to registerAddr.
  3. */
  4. void PortMCP23S17::push(const uint8_t command, const uint8_t registerAddr, const uint8_t data)
  5. {
  6. digitalWrite(SS, LOW); //enable Slave Select
  7. SPI.transfer(command); //write command todo also read command?
  8. SPI.transfer(registerAddr); //register address to write data to
  9. SPI.transfer(data); //write the data
  10. digitalWrite(SS, HIGH); //disable Slave Select
  11. }