Skip to content

Instantly share code, notes, and snippets.

@martinandrovich
Created March 9, 2019 02:04
Show Gist options
  • Select an option

  • Save martinandrovich/8de7fabb1edd2e25e35a4d3569013317 to your computer and use it in GitHub Desktop.

Select an option

Save martinandrovich/8de7fabb1edd2e25e35a4d3569013317 to your computer and use it in GitHub Desktop.

Revisions

  1. martinandrovich created this gist Mar 9, 2019.
    16 changes: 16 additions & 0 deletions spi_test.c
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    // 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);