Class SPICMtb

Inheritance Relationships

Base Type

  • public SPIC

Class Documentation

class SPICMtb : public virtual SPIC

Mtb SPIC class.

Public Functions

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(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.

Attention

Yet not implemented

Parameters:
  • port – SPI channel to be used

  • csPin – Number of the desired ChipSelect pin

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.

Attention

This does not set the platform_spi_peripherals structure yet

Parameters:
  • port – SPI channel to be used

  • csPin – Number of the desired ChipSelect pin

  • speed – SPI baud setting

  • mode – SPI mode setting

  • bits – number of bits in one command

~SPICMtb()

Destructor of the MTB SPIC class.

Error_t init()

Initialize the SPIC.

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

Returns:

SPICMtb::Error_t

Error_t deinit()

Deinitialize the SPIC.

This function is deinitializing the chosen spi channel.

Returns:

SPICMtb::Error_t

Error_t transfer(uint8_t send, uint8_t &received)

transfers a data package via the spi bus

Parameters:
  • send – address and/or command to send

  • received – received data from spi bus

Returns:

SPICMtb::Error_t

Error_t transfer16(uint16_t send, uint16_t &received)

transfers a data package via the spi bus

Parameters:
  • send – address and/or command to send as 16bit

  • received – received data from spi bus as 16bit

Returns:

SPICMtb::Error_t