Treehopper C++ API
HardwareSpi.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vector>
4 #include "Treehopper.h"
5 #include "Spi.h"
6 
7 namespace Treehopper {
8  class TreehopperUsb;
9 
65  class TREEHOPPER_API HardwareSpi : public Spi {
66  public:
67  explicit HardwareSpi(TreehopperUsb &board);
68 
70  bool enabled() override;
71 
73  void enabled(bool) override;
74 
75 #if 0
76  std::vector<uint8_t> sendReceive(std::vector<uint8_t> dataToWrite,
77  SpiChipSelectPin *chipSelect = nullptr,
79  double speed = 6,
81  SpiMode spiMode=SpiMode::Mode00) override;
82 #endif
83 
84  std::vector<uint8_t> sendReceive(std::vector<uint8_t> dataToWrite,
85  SpiChipSelectPin *chipSelect,
86  ChipSelectMode chipSelectMode,
87  double speed,
88  SpiBurstMode burstMode,
89  SpiMode spiMode) override;
91  private:
92  TreehopperUsb &board;
93  bool _enabled;
94  };
95 }
Built-in SPI peripheral.
Definition: HardwareSpi.h:65
SpiMode
Defines the clock phase and polarity used for SPI communication.
Definition: SpiMode.h:10
SpiBurstMode
The SPI burst mode to use.
Definition: SpiBurstMode.h:7
An SPI port.
Definition: Spi.h:15
The core class for communicating with Treehopper USB boards.
Definition: TreehopperUsb.h:59
Clock is initially low; data is valid on the rising edge of the clock
CS is asserted low, the SPI transaction takes place, and then the signal is returned high...
Definition: AdcPin.h:3
Definition: SpiChipSelectPin.h:7
No burst – always read the same number of bytes as transmitted.
#define TREEHOPPER_API
Definition: Treehopper.h:17
ChipSelectMode
Definition: ChipSelectMode.h:3