sr_api_hal.h

SR1000 hardware abstraction layer.

Copyright

Copyright (C) 2020 SPARK Microsystems International Inc. All rights reserved.

License

This source code is proprietary and subject to the SPARK Microsystems Software EULA found in this package in file EULA.txt.

Author

SPARK FW Team.

struct radio_hal_t
#include <sr_api_hal.h>

SR1000 API Hardware Abstraction Layer.

This structure contains all function pointers used to interact with the microcontroller’s peripherals.

Every functions must be implemented. If a function is not needed, the user must implement an empty function.

For example, if the shutdown pin is not used, simply create : void no_shutdown_pin(void) {} and pass it to both set_shutdown_pin and reset_shutdown_pin.

Public Members

void (*set_shutdown_pin)(void)

< Set shutdown pin HIGH Set shutdown pin LOW

void (*reset_shutdown_pin)(void)

Set reset pin HIGH

void (*set_reset_pin)(void)

Set reset pin LOW

void (*reset_reset_pin)(void)

Return IRQ pin state. 0 (LOW), 1(HIGH)

bool (*read_irq_pin)(void)

Set CS pin HIGH

void (*set_cs)(void)

Set CS pin LOW

void (*reset_cs)(void)

Send array (*data) over SPI

void (*write)(uint8_t *data, uint8_t size)

Read a number of bytes (determined by size) over SPI

void (*read)(uint8_t *data, uint8_t size)

Blocking delay function in milliseconds

void (*delay_ms)(uint32_t ms)

SPI Transfer full duplex in blocking mode. Spark Radio only support full duplex on instructions actual read and write are always in half-duplex mode.

void (*transfer_full_duplex_blocking)(uint8_t *tx_data, uint8_t *rx_data, uint16_t size)

SPI Transfer full duplex in non blocking mode using DMA. Spark Radio only support full duplex on instructions actual read and write are always in half-duplex mode. FYI : CS Pin need to be externally controlled when using this mode.

void (*transfer_full_duplex_non_blocking)(uint8_t *tx_data, uint8_t *rx_data, uint16_t size)

Check if the status of the busy flag in the SPI Status Register

bool (*is_spi_busy)(void)

Trigger the Spark radio IRQ context

void (*context_switch)(void)

Disable radio IRQ interrupt source

void (*disable_radio_irq)(void)

Enable radio IRQ interrupt source

void (*enable_radio_irq)(void)

Disable SPI DMA interrupt source

void (*disable_radio_dma_irq)(void)

Enable SPI DMA interrupt source

void (*enable_radio_dma_irq)(void)