AMT22 Encoder Code HSPI & begin Error

I'm trying to get this Code to work but the IDE is erroring me that HSPI is not declared in the scope any suggestions on what it should be declared as? It also is Erroring the begin(_pinCLCK, _pinMISO, _pinMOSI, _pinSS); line but it should be pulling from the AMT22.h library those values.

#include "AMT22.h"

#include <stdlib.h>

#include <SPI.h>

SPIClass * AMT22::encoder = NULL; // this must be here -> see https://stackoverflow.com/questions/39336029/arduino-accessing-static-variable-in-the-classs-static-method

AMT22::AMT22(const byte CLCK,
  const byte MISO,
    const byte MOSI,
      const byte SS) {
  _pinCLCK = CLCK;
  _pinMISO = MISO;
  _pinMOSI = MOSI;
  _pinSS = SS;
}

void AMT22::Begin() {
  if (AMT22::encoder == NULL) {
    AMT22::encoder = new SPIClass(HSPI);
    AMT22::encoder -> setClockDivider(SPI_CLOCK_DIV32);
    AMT22::encoder -> begin(_pinCLCK, _pinMISO, _pinMOSI, _pinSS); // SCLK, MISO, MOSI, SS
  }

This is from the AMT22.h Library

private:
  AMT22::Position getPositionSingle();
  AMT22::Position getPositionMulti();
  void setCSLine(uint8_t releaseLine);
  uint8_t spiWriteRead(uint8_t sendByte, uint8_t releaseLine);

  AMT22::Position position;
  byte _pinMISO = 12;
  byte _pinMOSI = 13;
  byte _pinCLCK = 14;
  byte _pinSS = 15;
 

  // uninitalised pointers to SPI objects
  static SPIClass *encoder;
};

#endif

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.