Created
March 9, 2019 02:04
-
-
Save martinandrovich/8de7fabb1edd2e25e35a4d3569013317 to your computer and use it in GitHub Desktop.
Demo of SPI module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// init SPI instance @ 8MHz ( | |
// bps = SYSCLK / (CPSDVSR * (1 + SCR)) | |
SPI* spi_test = spi.new(2); | |
// send value '110' to PWM1 | |
spi.send(spi_test, PWM1, 110); | |
// send value '110' to PWM1 and validate | |
if(!spi.send(spi_test, PWM1, 110)) | |
{ | |
puts("Error!"); | |
} | |
// request data from ENC1 | |
uint16_t enc1_dat; | |
enc1_dat = spi.request(spi_test, ENC1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment