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).
Collaboration diagram for PAL MTB:

Data Structures

class  GPIOMtb
 
class  SPICMtb
 Mtb SPIC class. More...
 
class  TimerMtb
 

Detailed Description


Data Structure Documentation

◆ GPIOMtb

class GPIOMtb
Inheritance diagram for GPIOMtb:
Collaboration diagram for GPIOMtb:

Public Types

enum  Error_t {
  OK = 0 , INTF_ERROR = -1 , CONF_ERROR = -2 , READ_ERROR = -3 ,
  WRITE_ERROR = -4
}
 
Interrupt event
enum  IntEvent_t { INT_FALLING_EDGE = 0 , INT_RISING_EDGE = 1 }
 
Voltage level
enum  VLevel_t { GPIO_LOW = 0 , GPIO_HIGH = 1 }
 
Voltage logic
enum  VLogic_t { NEGATIVE = 1 , POSITIVE = 2 }
 

Public Member Functions

 GPIOMtb ()
 GPIO MTB default constructor. More...
 
 GPIOMtb (mtb_gpio_t pin, mtb_gpio_config_t config, VLogic_t logic)
 GPIO MTB default constructor. More...
 
 ~GPIOMtb ()
 GPIO MTB destructor. More...
 
Error_t init ()
 Initializes the MTB GPIO. More...
 
Error_t deinit ()
 Initializes the MTB GPIO. More...
 
VLevel_t read ()
 Reads the MTB GPIO voltage level. More...
 
Error_t write (VLevel_t level)
 Writes the MTB GPIO output voltage level. More...
 
Error_t enable ()
 Enables the MTB output according to the GPIO logic. More...
 
Error_t disable ()
 Disables the MTB output according to the GPIO logic. More...
 
virtual Error_t changeMode (uint8_t mode)=0
 Changes the IN/OUT mode. More...
 
Error_t checkErrorStatus ()
 

Member Enumeration Documentation

◆ Error_t

enum GPIO::Error_t
inherited
Enumerator
OK 

No error

INTF_ERROR 

Interface error

CONF_ERROR 

Configuration error

READ_ERROR 

Read error

WRITE_ERROR 

Write error

◆ IntEvent_t

enum GPIO::IntEvent_t
inherited
Enumerator
INT_FALLING_EDGE 

Interrupt on falling edge

INT_RISING_EDGE 

Interrupt on rising edge

◆ VLevel_t

enum GPIO::VLevel_t
inherited
Enumerator
GPIO_LOW 

Level low

GPIO_HIGH 

Level high

◆ VLogic_t

enum GPIO::VLogic_t
inherited
Enumerator
NEGATIVE 

Negative logic. 0 on voltage level high, 1 on voltage low

POSITIVE 

Positive logic. 1 on voltage level high, 0 on voltage low

Constructor & Destructor Documentation

◆ GPIOMtb() [1/2]

GPIOMtb::GPIOMtb ( )

GPIO MTB default constructor.

◆ GPIOMtb() [2/2]

GPIOMtb::GPIOMtb ( mtb_gpio_t  pin,
mtb_gpio_config_t  config,
VLogic_t  logic 
)

GPIO MTB default constructor.

◆ ~GPIOMtb()

GPIOMtb::~GPIOMtb ( )

GPIO MTB destructor.

Here is the call graph for this function:

Member Function Documentation

◆ init()

GPIOMtb::Error_t GPIOMtb::init ( )
inlinevirtual

Initializes the MTB GPIO.

Returns
GPIO error code
Return values
OKif success
INTF_ERRORif initialization error

Implements GPIO.

◆ deinit()

GPIOMtb::Error_t GPIOMtb::deinit ( )
inlinevirtual

Initializes the MTB GPIO.

Returns
GPIO error code
Return values
OKif success
INTF_ERRORif deinitialization error

Implements GPIO.

◆ read()

GPIOMtb::VLevel_t GPIOMtb::read ( )
inlinevirtual

Reads the MTB GPIO voltage level.

Returns
GPIO voltage level
Return values
GPIO_LOWif voltage low
GPIO_HIGHif voltage high

Implements GPIO.

◆ write()

GPIOMtb::Error_t GPIOMtb::write ( VLevel_t  level)
inlinevirtual

Writes the MTB GPIO output voltage level.

Parameters
[in]levelVoltage level
Returns
GPIO error code
Return values
OKif success
INTF_ERRORif error

Implements GPIO.

◆ enable()

GPIOMtb::Error_t GPIOMtb::enable ( )
inlinevirtual

Enables the MTB output according to the GPIO logic.

  • Low if negative
  • High if positive
    Returns
    GPIO interrupt event
    Return values
    OKif success
    INTF_ERRORif error

Implements GPIO.

◆ disable()

GPIOMtb::Error_t GPIOMtb::disable ( )
inlinevirtual

Disables the MTB output according to the GPIO logic.

  • Low if positive
  • High if negative
    Returns
    GPIO error code
    Return values
    OKif success
    INTF_ERRORif error

Implements GPIO.

◆ changeMode()

virtual Error_t GPIO::changeMode ( uint8_t  mode)
pure virtualinherited

Changes the IN/OUT mode.

Parameters
[in]modeINPUT or OUTPUT mode of pin
Returns
GPIO error code
Return values
OKif success
INIT_ERRORif deinitialization error

Implemented in GPIOIno.

◆ checkErrorStatus()

GPIO::Error_t GPIO::checkErrorStatus ( )
inherited

◆ SPICMtb

class SPICMtb

Mtb SPIC class.

Inheritance diagram for SPICMtb:
Collaboration diagram for SPICMtb:

Public Types

enum  Error_t {
  OK = 0 , INTF_ERROR = -1 , CONF_ERROR = -2 , READ_ERROR = -3 ,
  WRITE_ERROR = -4
}
 

Public Member Functions

 SPICMtb ()
 Constructor of the MTB SPIC class. More...
 
 SPICMtb (mtb_spi_t port, mtb_gpio_t csPin)
 Construct a new SPICMtb::SPICMtb object. More...
 
 SPICMtb (mtb_spi_t port, mtb_gpio_t csPin, uint8_t speed, uint8_t mode, uint8_t bits)
 Construct a new SPICMtb::SPICMtb object. More...
 
 ~SPICMtb ()
 Destructor of the MTB SPIC class. More...
 
Error_t init ()
 Initialize the SPIC. More...
 
Error_t deinit ()
 Deinitialize the SPIC. More...
 
Error_t transfer (uint8_t send, uint8_t &received)
 transfers a data package via the spi bus More...
 
Error_t transfer16 (uint16_t send, uint16_t &received)
 transfers a data package via the spi bus More...
 
virtual Error_t triggerUpdate ()=0
 Sends a trigger through out the SPI bus. More...
 
virtual Error_t sendReceive (uint16_t *sent_data, uint16_t size_of_sent_data, uint16_t *received_data, uint16_t size_of_received_data)=0
 Function which allows 3wire SPI (SSC) by sending and receiving data in the same function. More...
 
Error_t checkErrorStatus ()
 

Member Enumeration Documentation

◆ Error_t

enum SPIC::Error_t
inherited
Enumerator
OK 

No error

INTF_ERROR 

Interface error

CONF_ERROR 

Configuration error

READ_ERROR 

Read error

WRITE_ERROR 

Write error

Constructor & Destructor Documentation

◆ SPICMtb() [1/3]

SPICMtb::SPICMtb ( )

Constructor of the MTB SPIC class.

This function is setting the basics for a SPIC and the default spi on Arduino which is implemented as MTB_SPI_0 by patching the following:

◆ SPICMtb() [2/3]

SPICMtb::SPICMtb ( mtb_spi_t  port,
mtb_gpio_t  csPin 
)

Construct a new SPICMtb::SPICMtb object.

This function is setting the basics for a SPIC. It allows to set the SPI channel and the used GPIOs if they are different from the standard GPIOs.

Parameters
portSPI channel to be used
csPinNumber of the desired ChipSelect pin
Attention
Yet not implemented

◆ SPICMtb() [3/3]

SPICMtb::SPICMtb ( mtb_spi_t  port,
mtb_gpio_t  csPin,
uint8_t  speed,
uint8_t  mode,
uint8_t  bits 
)

Construct a new SPICMtb::SPICMtb object.

This function allows to set all parameters of the SPI master.

Parameters
portSPI channel to be used
csPinNumber of the desired ChipSelect pin
speedSPI baud setting
modeSPI mode setting
bitsnumber of bits in one command
Attention
This does not set the platform_spi_peripherals structure yet

◆ ~SPICMtb()

SPICMtb::~SPICMtb ( )

Destructor of the MTB SPIC class.

Here is the call graph for this function:

Member Function Documentation

◆ init()

SPICMtb::Error_t SPICMtb::init ( )
virtual

Initialize the SPIC.

This function is initializing the chosen spi channel with the given values for lsb,clock and mode

Returns
SPICMtb::Error_t

Implements SPIC.

◆ deinit()

SPICMtb::Error_t SPICMtb::deinit ( )
virtual

Deinitialize the SPIC.

This function is deinitializing the chosen spi channel.

Returns
SPICMtb::Error_t

Implements SPIC.

◆ transfer()

SPICMtb::Error_t SPICMtb::transfer ( uint8_t  send,
uint8_t &  received 
)

transfers a data package via the spi bus

Parameters
sendaddress and/or command to send
receivedreceived data from spi bus
Returns
SPICMtb::Error_t

◆ transfer16()

SPICMtb::Error_t SPICMtb::transfer16 ( uint16_t  send,
uint16_t &  received 
)

transfers a data package via the spi bus

Parameters
sendaddress and/or command to send as 16bit
receivedreceived data from spi bus as 16bit
Returns
SPICMtb::Error_t

◆ triggerUpdate()

virtual Error_t SPIC::triggerUpdate ( )
pure virtualinherited

Sends a trigger through out the SPI bus.

Returns
SPIC error code
Return values
OKif success
INIT_ERRORif deinitialization error

Implemented in SPICWiced, and SPICIno.

◆ sendReceive()

virtual Error_t SPIC::sendReceive ( uint16_t *  sent_data,
uint16_t  size_of_sent_data,
uint16_t *  received_data,
uint16_t  size_of_received_data 
)
pure virtualinherited

Function which allows 3wire SPI (SSC) by sending and receiving data in the same function.

Parameters
sent_datapointer two 2*unit16_t value for one command word and one data word if something should be written
size_of_sent_datathe size of the command word default 1 = only command 2 = command and data word
received_datapointer to data structure buffer for the read data
size_of_received_datasize of data words to be read
Returns
SPIC error code
Return values
OKif success
INIT_ERRORif transfer fails

Implemented in SPICWiced, and SPICIno.

◆ checkErrorStatus()

SPIC::Error_t SPIC::checkErrorStatus ( )
inherited

◆ TimerMtb

class TimerMtb
Inheritance diagram for TimerMtb:
Collaboration diagram for TimerMtb:

Public Types

enum  Error_t { OK = 0 , ERROR = 1 }
 

Public Member Functions

 TimerMtb ()
 Constructor of the MTB Timer class. More...
 
 ~TimerMtb ()
 Destructor of the MTB Timer class. More...
 
Error_t init ()
 Initialization of the Timer. More...
 
Error_t deinit ()
 Deinitialize the Timer. More...
 
Error_t start ()
 Start the timer. More...
 
Error_t elapsed (mtb_time_t &elapsed)
 Calculate the elapsed time. More...
 
Error_t stop ()
 Stop the timer. More...
 
Error_t delayMilli (uint32_t timeout)
 Time delay. More...
 
Error_t delayMicro (uint32_t timeout)
 Time delay. More...
 
virtual Error_t elapsed (uint32_t &elapsed)=0
 Elapsed time since the timer was started. More...
 

Member Enumeration Documentation

◆ Error_t

enum Timer::Error_t
inherited
Enumerator
OK 

No error

ERROR 

Error

Constructor & Destructor Documentation

◆ TimerMtb()

TimerMtb::TimerMtb ( )

Constructor of the MTB Timer class.

◆ ~TimerMtb()

TimerMtb::~TimerMtb ( )

Destructor of the MTB Timer class.

Member Function Documentation

◆ init()

TimerMtb::Error_t TimerMtb::init ( )
virtual

Initialization of the Timer.

This function is initializing the Timer and sets the elapsed time to zero.

Returns
TimerMtb::Error_t

Implements Timer.

◆ deinit()

TimerMtb::Error_t TimerMtb::deinit ( )
virtual

Deinitialize the Timer.

This function deinitialize the Timer and also resets the elapsed time variable.

Returns
TimerMtb::Error_t

Implements Timer.

◆ start()

TimerMtb::Error_t TimerMtb::start ( )
virtual

Start the timer.

This function is starting the timer.

Returns
TimerMtb::Error_t

Implements Timer.

◆ elapsed() [1/2]

TimerMtb::Error_t TimerMtb::elapsed ( mtb_time_t &  elapsed)

Calculate the elapsed time.

This function is calculating the elapsed time since the start of the timer. The value stored in the given variable is in milliseconds.

Parameters
[in]&elapsedAddress of a value where the elapsed time should be stored
Returns
TimerMtb::Error_t

◆ stop()

TimerMtb::Error_t TimerMtb::stop ( )
virtual

Stop the timer.

This function stops the timer and resets the start time variable.

Returns
TimerMtb::Error_t

Implements Timer.

◆ delayMilli()

TimerMtb::Error_t TimerMtb::delayMilli ( uint32_t  timeout)
virtual

Time delay.

This function is causing a desired delay of the application. The input value is given in milliseconds.

Parameters
[in]timeoutDesired timeout in ms
Returns
TimerMtb::Error_t

Implements Timer.

◆ delayMicro()

TimerMtb::Error_t TimerMtb::delayMicro ( uint32_t  timeout)
virtual

Time delay.

This function is causing a desired delay of the application. The input value is given in microseconds.

Parameters
[in]timeoutDesired timeout in us
Returns
TimerMtb::Error_t

Implements Timer.

◆ elapsed() [2/2]

virtual Error_t Timer::elapsed ( uint32_t &  elapsed)
pure virtualinherited

Elapsed time since the timer was started.

Parameters
[out]elapsedTime in milliseconds
Returns
Timer error code
Return values
OKif success
INIT_ERRORif hardware interface error