Si446x Radio SPI Driver

Description

Provide functions to control Si4446x Radio via SPI interface.

Functions

sl_ext_device_config_t sl_ext_device_init (sl_ext_device_handler_t interrupt_handler, sl_ext_device_handler_t ready_handler)
 Initialize Device GPIOs.
 
sl_ext_device_interrupt_depth_t sl_ext_device_enable_interrupt (bool clearPending)
 Decrement interrupt nesting level and, if 0, enable device interrupt.
 

Macros

#define sl_ext_device_power_down(void)   sl_si446x_power_down
 Power down the device per GPIO.
 
#define sl_ext_device_power_up(void)   sl_si446x_power_up
 Power up the device per GPIO.
 
#define sl_ext_device_is_ready(void)   sl_si446x_is_ready
 Indicate if the device is ready per GPIO.
 
#define sl_ext_device_not_ready(void)   sl_si446x_not_ready
 Indicate if the device is not ready per GPIO.
 
#define sl_ext_device_wait_ready(void)   sl_si446x_wait_ready
 Wait for the device to become ready per GPIO.
 
#define sl_ext_device_select(void)   sl_si446x_select
 Select the external device.
 
#define sl_ext_device_deselect(void)   sl_si446x_deselect
 Unselect the external device.
 
#define sl_ext_device_is_selected(void)   sl_si446x_is_selected
 Indicate if the device is selected.
 
#define sl_ext_device_not_selected(void)   sl_si446x_not_selected
 Indicate if the device is not selected.
 
#define sl_ext_device_is_interrupt_pending(void)   sl_si446x_is_interrupt_pending
 Indicate if device interrupt GPIO is pending.
 
#define sl_ext_device_no_interrupt_pending(void)   sl_si446x_no_interrupt_pending
 Indicate if device interrupt is not pending.
 
#define sl_ext_device_disable_interrupt(void)   sl_si446x_disable_interrupt
 Disable device interrupt and increment interrupt nesting level.
 
#define SL_EXT_DEVICE_POLARITY_INVERT   false
 Specifies GPIO pin polarity is inverted (assert = low)
 
#define SL_EXT_DEVICE_POLARITY_NORMAL   true
 Specifies GPIO pin polarity is normal (assert = high)
 
#define sl_ext_device_init   sl_si446x_init
 
#define sl_ext_device_enable_interrupt   sl_si446x_enable_interrupt
 
#define sl_ext_device_spi_config   sl_si446x_spi_config
 

Typedefs

typedef void(* sl_ext_device_handler_t) (void)
 Event Handler callback type.
 

Enumerations

enum  sl_ext_device_config_t {
  SL_EXT_DEVICE_HAS_NOTHING = 0x00u,
  SL_EXT_DEVICE_HAS_POWER = 0x01u,
  SL_EXT_DEVICE_HAS_READY = 0x02u,
  SL_EXT_DEVICE_HAS_SELECT = 0x04u,
  SL_EXT_DEVICE_HAS_INTERRUPT = 0x08u,
  SL_EXT_DEVICE_HAS_READY_IRQ = 0x20u,
  SL_EXT_DEVICE_HAS_INTERRUPT_IRQ = 0x80u
}
 Device GPIO Capabilities.
 
enum  sl_ext_device_interrupt_depth_t {
  SL_EXT_DEVICE_INTERRUPT_DEPTH_ON = 0x00u,
  SL_EXT_DEVICE_INTERRUPT_DEPTH_OFF = 0x01u,
  SL_EXT_DEVICE_INTERRUPT_UNCONFIGURED = 0xFFu
}
 Device interrupt depth state.
 

Variables

const SPIDRV_Init_t sl_ext_device_spi_config
 Device SPI driver configuration.
 
SPIDRV_Handle_t sl_ext_device_spi_handle
 Device SPI driver instance handle (pointer)
 

Function Documentation

◆ sl_ext_device_init()

sl_ext_device_config_t sl_ext_device_init ( sl_ext_device_handler_t  interrupt_handler,
sl_ext_device_handler_t  ready_handler 
)

Initialize Device GPIOs.

Parameters
interrupt_handlerThe handler for device general interrupt (NULL to disable)
ready_handlerThe handler for device ready interrupt (NULL to disable)
Returns
bitmask of configured features for this device
Note
First initialization after bootup leaves the device powered down and unselected. Subsequent inits don't touch the device powered or selected states and can be used to reconfigure callback(s), which always clears any stale/pending events. For ready_handler its interrupt is enabled upon configuration; for interrupt_handler sl_ext_device_enable_interrupt() must subsequently be called to enable it.

◆ sl_ext_device_enable_interrupt()

sl_ext_device_interrupt_depth_t sl_ext_device_enable_interrupt ( bool  clearPending)

Decrement interrupt nesting level and, if 0, enable device interrupt.

Parameters
clearPendingif true clears any "stale" pending interrupt just prior to enabling device interrupt.
Returns
interrupt level prior to enabling (0=interrupts were enabled)

Macro Definition Documentation

◆ sl_ext_device_power_down

void sl_ext_device_power_down   sl_si446x_power_down

Power down the device per GPIO.

◆ sl_ext_device_power_up

void sl_ext_device_power_up   sl_si446x_power_up

Power up the device per GPIO.

◆ sl_ext_device_is_ready

bool sl_ext_device_is_ready (   void)    sl_si446x_is_ready

Indicate if the device is ready per GPIO.

Returns
true if device is ready, false otherwise

◆ sl_ext_device_not_ready

bool sl_ext_device_not_ready (   void)    sl_si446x_not_ready
inline

Indicate if the device is not ready per GPIO.

Returns
true if device is not ready, false otherwise

◆ sl_ext_device_wait_ready

void sl_ext_device_wait_ready   sl_si446x_wait_ready

Wait for the device to become ready per GPIO.

◆ sl_ext_device_select

void sl_ext_device_select   sl_si446x_select

Select the external device.

◆ sl_ext_device_deselect

void sl_ext_device_deselect   sl_si446x_deselect

Unselect the external device.

◆ sl_ext_device_is_selected

bool sl_ext_device_is_selected   sl_si446x_is_selected

Indicate if the device is selected.

◆ sl_ext_device_not_selected

bool sl_ext_device_not_selected   sl_si446x_not_selected
inline

Indicate if the device is not selected.

◆ sl_ext_device_is_interrupt_pending

bool sl_ext_device_is_interrupt_pending (   void)    sl_si446x_is_interrupt_pending

Indicate if device interrupt GPIO is pending.

Returns
true if device interrupt is pending, false otherwise

◆ sl_ext_device_no_interrupt_pending

bool sl_ext_device_no_interrupt_pending (   void)    sl_si446x_no_interrupt_pending
inline

Indicate if device interrupt is not pending.

Returns
true if device interrupt is not pending, false otherwise

◆ sl_ext_device_disable_interrupt

sl_ext_device_interrupt_depth_t sl_ext_device_disable_interrupt (   void)    sl_si446x_disable_interrupt

Disable device interrupt and increment interrupt nesting level.

Returns
interrupt level prior to disabling (0=interrupts were enabled)

◆ SL_EXT_DEVICE_POLARITY_INVERT

#define SL_EXT_DEVICE_POLARITY_INVERT   false

Specifies GPIO pin polarity is inverted (assert = low)

◆ SL_EXT_DEVICE_POLARITY_NORMAL

#define SL_EXT_DEVICE_POLARITY_NORMAL   true

Specifies GPIO pin polarity is normal (assert = high)

Typedef Documentation

◆ sl_ext_device_handler_t

typedef void(* sl_ext_device_handler_t) (void)

Event Handler callback type.

Enumeration Type Documentation

◆ sl_ext_device_config_t

Device GPIO Capabilities.

Enumerator
SL_EXT_DEVICE_HAS_NOTHING 

Not any of the others.

SL_EXT_DEVICE_HAS_POWER 

Device has power input pin.

SL_EXT_DEVICE_HAS_READY 

Device has ready output pin.

SL_EXT_DEVICE_HAS_SELECT 

Device has select input pin.

SL_EXT_DEVICE_HAS_INTERRUPT 

Device has interrupt output pin.

SL_EXT_DEVICE_HAS_READY_IRQ 

An IRQ is assigned to ready pin.

SL_EXT_DEVICE_HAS_INTERRUPT_IRQ 

An IRQ is assigned to interrupt pin.

◆ sl_ext_device_interrupt_depth_t

Device interrupt depth state.

Enumerator
SL_EXT_DEVICE_INTERRUPT_DEPTH_ON 

Interrupt is enabled.

SL_EXT_DEVICE_INTERRUPT_DEPTH_OFF 

Interrupt lowest depth disabled.

SL_EXT_DEVICE_INTERRUPT_UNCONFIGURED 

Interrupt is not configured.

Variable Documentation

◆ sl_ext_device_spi_config

const SPIDRV_Init_t sl_ext_device_spi_config

Device SPI driver configuration.

◆ sl_ext_device_spi_handle

SPIDRV_Handle_t sl_ext_device_spi_handle

Device SPI driver instance handle (pointer)