TLE5012B  3.1.0
The TLE5012B is a pre-calibrated 360° angle sensor that detects the orientation of a magnetic field. The raw signals (sine and cosine) are digitally processed internally to calculate the angle orientation of the magnetic field (magnet).
spic-mtb.hpp
Go to the documentation of this file.
1 
11 #ifndef SPIC_MTB_HPP_
12 #define SPIC_MTB_HPP_
13 
14 #include "../../../config/tle5012-conf.hpp"
15 
16 #if (TLE5012_FRAMEWORK == TLE5012_FRMWK_MTB)
17 
18 #include "../../../pal/spic.hpp"
19 #include <platform.h>
20 #include <mtb_platform.h>
21 
32 class SPICMtb: virtual public SPIC
33 {
34  private:
35  mtb_gpio_t csPin;
36  mtb_gpio_t misoPin;
37  mtb_gpio_t mosiPin;
38  mtb_gpio_t sckPin;
39 
40  mtb_spi_t port;
41  mtb_spi_device_t spi;
42  uint8_t lsb;
43  uint8_t mode;
44  uint8_t clock;
45 
46  uint8_t sendBuffer[2];
47  uint8_t receiveBuffer[2];
48  bool spiSetting = false;
49 
50  //* @brief Definition of the SPI-Segment which contains the data for the communication
51  mtb_spi_message_segment_t segment;
52 
53  public:
54  SPICMtb();
55  SPICMtb(mtb_spi_t port, mtb_gpio_t csPin);
56  SPICMtb(mtb_spi_t port, mtb_gpio_t csPin, uint8_t speed, uint8_t mode, uint8_t bits);
57  ~SPICMtb();
58  Error_t init();
59  Error_t deinit();
60  Error_t transfer(uint8_t send, uint8_t &received);
61  Error_t transfer16(uint16_t send, uint16_t &received);
62 
63 };
66 #endif
67 #endif
Error_t init()
Initialize the SPIC.
Definition: spic-mtb.cpp:91
Error_t transfer16(uint16_t send, uint16_t &received)
transfers a data package via the spi bus
Definition: spic-mtb.cpp:136
Error_t transfer(uint8_t send, uint8_t &received)
transfers a data package via the spi bus
Definition: spic-mtb.cpp:121
~SPICMtb()
Destructor of the MTB SPIC class.
Definition: spic-mtb.cpp:79
SPICMtb()
Constructor of the MTB SPIC class.
Definition: spic-mtb.cpp:24
Error_t deinit()
Deinitialize the SPIC.
Definition: spic-mtb.cpp:108
Mtb SPIC class.
Definition: spic-mtb.hpp:33
Error_t
Definition: spic.hpp:25
Definition: spic.hpp:21