Sensor Watch 0.0.2
A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
Loading...
Searching...
No Matches
Functions
SPI Controller Driver

This section covers functions related to the SAM L22's built-in SPI driver, including configuring the SPI bus and writing to / reading from devices. More...

Functions

void watch_enable_spi (void)
 Enables the SPI peripheral. Call this before attempting to interface with SPI devices.
 
void watch_disable_spi (void)
 Disables the SPI peripheral.
 
bool watch_spi_write (const uint8_t *buf, uint16_t length)
 Writes a series of values to a device on the SPI bus.
 
bool watch_spi_read (uint8_t *buf, uint16_t length)
 Reads a series of values from a device on the SPI bus.
 
bool watch_spi_transfer (const uint8_t *data_out, uint8_t *data_in, uint16_t length)
 Reads a series of values from a device on the SPI bus.
 

Detailed Description

This section covers functions related to the SAM L22's built-in SPI driver, including configuring the SPI bus and writing to / reading from devices.

Function Documentation

◆ watch_spi_read()

bool watch_spi_read ( uint8_t *  buf,
uint16_t  length 
)

Reads a series of values from a device on the SPI bus.

Parameters
bufStorage for the incoming bytes; on return, it will contain the received data.
lengthThe number of bytes that you wish to receive.
Note
This function does not manage the chip select pin (usually A3).

◆ watch_spi_transfer()

bool watch_spi_transfer ( const uint8_t *  data_out,
uint8_t *  data_in,
uint16_t  length 
)

Reads a series of values from a device on the SPI bus.

Parameters
data_outStorage for outgoing bytes.
data_inStorage for incoming bytes.
lengthThe number of bytes to transfer.
Note
This function does not manage the chip select pin (usually A3).

◆ watch_spi_write()

bool watch_spi_write ( const uint8_t *  buf,
uint16_t  length 
)

Writes a series of values to a device on the SPI bus.

Parameters
bufA series of unsigned bytes; the data you wish to transmit.
lengthThe number of bytes in buf that you wish to send.
Note
This function does not manage the chip select pin (usually A3).