Class SPICWiced

Inheritance Relationships

Base Type

  • public SPIC

Class Documentation

class SPICWiced : public virtual SPIC

Wiced SPIC class.

Public Functions

SPICWiced(wiced_gpio_t csPin)

Constructor of the WICED SPIC class.

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

  • <WICED_SDK>/platforms/<platform_name>/platform.h add WICED_SPI_0, to the wiced_spi_t

  • <WICED_SDK>/platforms/<platform_name>/platform.c add the following to the platform_spi_peripherals [WICED_SPI_0] = { .port = BCM4390X_SPI_0, .pin_mosi = &platform_gpio_pins[WICED_GPIO_6], .pin_miso = &platform_gpio_pins[WICED_GPIO_8], .pin_clock = &platform_gpio_pins[WICED_GPIO_5], .pin_cs = &platform_gpio_pins[WICED_GPIO_7], .driver = &spi_bb_driver, }, which sets the Arduino header GPIOs and the bit banging driver.

Attention

Yet not implemented

Parameters:

csPin – Number of the desired ChipSelect pin

SPICWiced(wiced_spi_t port, wiced_gpio_t csPin, wiced_gpio_t misoPin, wiced_gpio_t mosiPin, wiced_gpio_t sckPin)

Construct a new SPICWiced::SPICWiced 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

  • misoPin – miso pin number

  • mosiPin – mosi pin number

  • sckPin – systemclock pin number

~SPICWiced()

Destructor of the WICED 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:

SPICWiced::Error_t

Error_t deinit()

Deinitialize the SPIC.

This function is deinitializing the chosen spi channel.

Returns:

SPICWiced::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:

SPICWiced::Error_t

Error_t triggerUpdate()

Triggers an update in the register buffer. This function should be triggered once before UPD registers where read as it generates a snapshot of the UPD register values at trigger point.

Returns:

SPICIno::Error_t

Error_t sendReceive(uint16_t *sent_data, uint16_t size_of_sent_data, uint16_t *received_data, uint16_t size_of_received_data)

Main SPI three wire communication functions for sending and receiving data

Parameters:
  • sent_data – pointer two 2*unit16_t value for one command word and one data word if something should be written

  • size_of_sent_data – the size of the command word default 1 = only command 2 = command and data word

  • received_data – pointer to data structure buffer for the read data

  • size_of_received_data – size of data words to be read