HAL SMBUS Functions ¶
Initialization and de-initialization functions ¶
- group SMBUS_Exported_Functions_Group1
-
A set of functions allowing to initialize and deinitialize the SMBUSx functionality in the I2Cx peripheral :
-
HAL_SMBUS_Init() : initialize the selected device with the SMBUS instance.
-
HAL_SMBUS_DeInit() : restore the default configuration of the selected SMBUSx functionality in the I2Cx peripheral.
Functions
-
hal_status_t
HAL_SMBUS_Init
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_t
instance
)
¶
-
Initialize the SMBUS according to the associated handle.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
instance – HAL SMBUS instance
-
- Return values :
-
-
HAL_OK – HAL SMBUS instance has been correctly Initialized.
-
HAL_INVALID_PARAM – HAL SMBUS instance is NULL
-
HAL_ERROR – HAL SMBUS semaphore creation is failed (USE_HAL_MUTEX is set to 1)
-
-
void
HAL_SMBUS_DeInit
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Deinitialize the HAL SMBUS driver for the given handle and disable the SMBUSx functionality in the I2Cx peripheral.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t structure.
-
- group SMBUS_Exported_Functions_Group1
-
A set of functions allowing to initialize and deinitialize the SMBUSx functionality in the I2Cx peripheral :
-
HAL_SMBUS_Init() : initialize the selected device with the SMBUS instance.
-
HAL_SMBUS_DeInit() : restore the default configuration of the selected SMBUSx functionality in the I2Cx peripheral.
Functions
-
hal_status_t
HAL_SMBUS_Init
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_t
instance
)
-
Initialize the SMBUS according to the associated handle.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
instance – HAL SMBUS instance
-
- Return values :
-
-
HAL_OK – HAL SMBUS instance has been correctly Initialized.
-
HAL_INVALID_PARAM – HAL SMBUS instance is NULL
-
HAL_ERROR – HAL SMBUS semaphore creation is failed (USE_HAL_MUTEX is set to 1)
-
-
void
HAL_SMBUS_DeInit
(
hal_smbus_handle_t
*
hsmbus
)
-
Deinitialize the HAL SMBUS driver for the given handle and disable the SMBUSx functionality in the I2Cx peripheral.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t structure.
-
- group SMBUS_Exported_Functions_Group1
-
A set of functions allowing to initialize and deinitialize the SMBUSx functionality in the I2Cx peripheral :
-
HAL_SMBUS_Init() : initialize the selected device with the SMBUS instance.
-
HAL_SMBUS_DeInit() : restore the default configuration of the selected SMBUSx functionality in the I2Cx peripheral.
Functions
-
hal_status_t
HAL_SMBUS_Init
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_t
instance
)
-
Initialize the SMBUS according to the associated handle.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
instance – HAL SMBUS instance
-
- Return values :
-
-
HAL_OK – HAL SMBUS instance has been correctly Initialized.
-
HAL_INVALID_PARAM – HAL SMBUS instance is NULL
-
HAL_ERROR – HAL SMBUS semaphore creation is failed (USE_HAL_MUTEX is set to 1)
-
-
void
HAL_SMBUS_DeInit
(
hal_smbus_handle_t
*
hsmbus
)
-
Deinitialize the HAL SMBUS driver for the given handle and disable the SMBUSx functionality in the I2Cx peripheral.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t structure.
-
Configuration functions ¶
- group SMBUS_Exported_Functions_Group2
-
A set of functions allowing to configure the I2Cx peripheral in SMBUS:
-
Global configuration :
-
Unitary configuration :
-
Timeout configuration:
-
Filter Mode :
-
Acknowledge General Call:
-
Second Own Address configuration :
-
Packet Error Check :
-
Alert interrupt:
-
Wakeup from Stop mode(s) :
-
Fast mode plus driving capability :
-
Autonomous mode :
Functions
-
hal_status_t
HAL_SMBUS_SetConfig
(
hal_smbus_handle_t
*
hsmbus
,
const
hal_smbus_config_t
*
p_config
)
¶
-
Configure the SMBUS according to the user parameters.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_config – Pointer to the configuration structure
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
void
HAL_SMBUS_GetConfig
(
const
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_config_t
*
p_config
)
¶
-
Retrieve the SMBUS configuration.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_config – Pointer to the configuration structure
-
-
hal_status_t
HAL_SMBUS_SetTiming
(
hal_smbus_handle_t
*
hsmbus
,
uint32_t
value
)
¶
-
Set the SMBUS Timing.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
value – SMBUS timing
-
- Return values :
-
HAL_OK – Operation completed successfully
-
uint32_t
HAL_SMBUS_GetTiming
(
const
hal_smbus_handle_t
*
hsmbus
)
¶
-
Get the SMBUS Timing.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
uint32_t – SMBUS timing value
-
hal_status_t
HAL_SMBUS_EnableAnalogFilter
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Enable SMBUS Analog noise filter.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_DisableAnalogFilter
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Disable SMBUS Analog noise filter.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_analog_filter_status_t
HAL_SMBUS_IsEnabledAnalogFilter
(
const
hal_smbus_handle_t
*
hsmbus
)
¶
-
Check SMBUS analog noise filter status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_ANALOG_FILTER_ENABLED – Analog Filter is enabled
-
HAL_SMBUS_ANALOG_FILTER_DISABLED – Analog Filter is disabled
-
-
hal_status_t
HAL_SMBUS_SetDigitalFilter
(
hal_smbus_handle_t
*
hsmbus
,
uint32_t
noise_filtering_in_bus_clk_period
)
¶
-
Set the SMBUS Digital noise filter.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
noise_filtering_in_bus_clk_period – Filtering period between Min_Data=0x00 and Max_Data=0x0F.
-
- Return values :
-
HAL_OK – Operation completed successfully
-
uint32_t
HAL_SMBUS_GetDigitalFilter
(
const
hal_smbus_handle_t
*
hsmbus
)
¶
-
Get the SMBUS Digital noise filter.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
uint32_t – Coefficient of digital noise filter between Min_Data=0x00 and Max_Data=0x0F.
-
hal_status_t
HAL_SMBUS_SLAVE_EnableWakeUp
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Enable SMBUS Slave wakeup from Stop mode(s).
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_SLAVE_DisableWakeUp
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Disable Slave SMBUS wakeup from Stop mode(s).
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_slave_wake_up_status_t
HAL_SMBUS_SLAVE_IsEnabledWakeUp
(
const
hal_smbus_handle_t
*
hsmbus
)
¶
-
Check SMBUS slave wake up status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_SLAVE_WAKE_UP_ENABLED – Slave Wake Up is enabled
-
HAL_SMBUS_SLAVE_WAKE_UP_DISABLED – Slave Wake Up is disabled
-
-
hal_status_t
HAL_SMBUS_AM_SetConfigTrigger
(
hal_smbus_handle_t
*
hsmbus
,
const
hal_smbus_am_trig_config_t
*
p_config
)
¶
-
Set the SMBUS autonomous mode trigger configuration.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t .
-
p_config – Pointer to a hal_smbus_am_trig_config_t .
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
void
HAL_SMBUS_AM_GetConfigTrigger
(
const
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_am_trig_config_t
*
p_config
)
¶
-
Get the SMBUS autonomous mode trigger configuration.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t .
-
p_config – Pointer to a hal_smbus_am_trig_config_t .
-
-
hal_status_t
HAL_SMBUS_AM_EnableTrigger
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Enable the SMBUS Autonomous mode.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_AM_DisableTrigger
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Disable the SMBUS Autonomous mode.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_am_trig_status_t
HAL_SMBUS_AM_IsEnabledTrigger
(
const
hal_smbus_handle_t
*
hsmbus
)
¶
-
Get SMBUS autonomous mode status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_AM_TRIG_ENABLED – Autonomous mode trigger enabled
-
HAL_SMBUS_AM_TRIG_DISABLED – Autonomous mode trigger disabled
-
-
hal_status_t
HAL_SMBUS_SetConfigTimeout
(
hal_smbus_handle_t
*
hsmbus
,
const
hal_smbus_timeout_config_t
*
p_config
)
¶
-
Set hardware timeout config.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_config – Pointer to hal_smbus_timeout_config_t containing both TimeoutA and B configuration.
-
- Return values :
-
HAL_OK – Operation completed successfully
-
void
HAL_SMBUS_GetConfigTimeout
(
const
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_timeout_config_t
*
p_config
)
¶
-
Get hardware timeout config.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_config – Pointer to hal_smbus_timeout_config_t containing both TimeoutA and B configuration.
-
-
hal_status_t
HAL_SMBUS_EnableTimeout
(
hal_smbus_handle_t
*
hsmbus
,
const
hal_smbus_timeout_t
timeout
)
¶
-
Enable SMBUS timeout feature.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
timeout – Timeout to Enable
-
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_DisableTimeout
(
hal_smbus_handle_t
*
hsmbus
,
const
hal_smbus_timeout_t
timeout
)
¶
-
Disable SMBUS timeout feature.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
timeout – Timeout to disable
-
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_timeout_t
HAL_SMBUS_IsEnabledTimeoutA
(
const
hal_smbus_handle_t
*
hsmbus
)
¶
-
Get SMBUS Timeout A status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_TIMEOUT_NONE – Timeout A is disabled
-
HAL_SMBUS_SELECT_TIMEOUT_A – Timeout A is enabled
-
-
hal_smbus_timeout_t
HAL_SMBUS_IsEnabledTimeoutB
(
const
hal_smbus_handle_t
*
hsmbus
)
¶
-
Get SMBUS Timeout B status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_TIMEOUT_NONE – Timeout B is disabled
-
HAL_SMBUS_SELECT_TIMEOUT_A – Timeout B is enabled
-
-
hal_status_t
HAL_SMBUS_SLAVE_EnableAckGeneralCall
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Enable SMBUS slave acknowledge general call address.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_SLAVE_DisableAckGeneralCall
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Disable SMBUS slave acknowledge general call address.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_slave_ack_general_call_status_t
HAL_SMBUS_SLAVE_IsEnabledAckGeneralCall
(
const
hal_smbus_handle_t
*
hsmbus
)
¶
-
Check SMBUS slave acknowledge general call status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_SLAVE_ACK_GENERAL_CALL_ENABLED – Slave Acknowledge General Call is enabled
-
HAL_SMBUS_SLAVE_ACK_GENERAL_CALL_DISABLED – Slave Acknowledge General Call is disabled
-
-
hal_status_t
HAL_SMBUS_EnablePacketErrorCheck
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Enable Packet Error Check.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_DisablePacketErrorCheck
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Disable Packet Error Check.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_pec_status_t
HAL_SMBUS_IsEnabledPacketErrorCheck
(
const
hal_smbus_handle_t
*
hsmbus
)
¶
-
Check SMBUS packet error check(PEC) status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_PEC_ENABLED – Packet Error Check enabled
-
HAL_SMBUS_PEC_DISABLED – Packet Error Check disabled
-
-
hal_status_t
HAL_SMBUS_MASTER_EnableAlertIT
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Enable Alert Interruption.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_MASTER_DisableAlertIT
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Disable Alert Interruption.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_alert_status_t
HAL_SMBUS_MASTER_IsEnabledAlertIT
(
const
hal_smbus_handle_t
*
hsmbus
)
¶
-
Check SMBUS Alert interruption status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_ALERT_ENABLED – Alert interruption enabled
-
HAL_SMBUS_ALERT_DISABLED – Alert interruption disabled
-
-
hal_status_t
HAL_SMBUS_SetConfigOwnAddress2
(
hal_smbus_handle_t
*
hsmbus
,
uint32_t
addr
,
hal_smbus_own_addr2_mask_t
mask
)
¶
-
Set the SMBUS own address2 configuration.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t .
-
addr – The second device own address. It is a 7-bit address but the value must be shifted left by 1 bit. In other words, an 8-bit value is required and the bit 0 is not considered.
-
mask – Acknowledge mask address second device own address.
-
- Return values :
-
HAL_OK – Operation completed successfully
-
void
HAL_SMBUS_GetConfigOwnAddress2
(
const
hal_smbus_handle_t
*
hsmbus
,
uint32_t
*
p_addr
,
hal_smbus_own_addr2_mask_t
*
p_mask
)
¶
-
Get the SMBUS own address2 configuration.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t .
-
p_addr – The second device own address. It is a 7-bit address but the value is shifted left by 1 bit. In other words, an 8-bit value is returned and the bit 0 is not considered.
-
p_mask – Acknowledge mask address second device own address.
-
-
hal_status_t
HAL_SMBUS_EnableOwnAddress2
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Enable SMBUS Own Address2.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_DisableOwnAddress2
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Disable SMBUS Own Address2.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_own_addr2_status_t
HAL_SMBUS_IsEnabledOwnAddress2
(
const
hal_smbus_handle_t
*
hsmbus
)
¶
-
Check SMBUS own address 2 status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_OWN_ADDR2_ENABLED – Dual addressing is enabled
-
HAL_SMBUS_OWN_ADDR2_DISABLED – Dual addressing is disabled
-
-
hal_status_t
HAL_SMBUS_SetMode
(
hal_smbus_handle_t
*
hsmbus
,
const
hal_smbus_mode_t
mode
)
¶
-
Set the functional SMBUS mode(Host, Slave or Slave ARP).
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
mode – Mode to set from hal_smbus_mode_t
-
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_mode_t
HAL_SMBUS_GetMode
(
const
hal_smbus_handle_t
*
hsmbus
)
¶
-
Return the functional SMBUS mode. Host, Slave or Slave ARP.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL – mode
-
hal_status_t
HAL_SMBUS_EnableFastModePlus
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Enable the SMBUS fast mode plus driving capability.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_DisableFastModePlus
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Disable the SMBUS fast mode plus driving capability.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t .
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_fast_mode_plus_status_t
HAL_SMBUS_IsEnabledFastModePlus
(
const
hal_smbus_handle_t
*
hsmbus
)
¶
-
Check SMBUS fast mode plus feature status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_FAST_MODE_PLUS_ENABLED – Fast mode plus enabled
-
HAL_SMBUS_FAST_MODE_PLUS_DISABLED – Fast mode plus disabled
-
-
hal_status_t
HAL_SMBUS_MASTER_RegisterTxCpltCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_cb_t
p_callback
)
¶
-
Register the SMBUS Master Tx Transfer completed callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_callback – Pointer to the Master Tx Transfer completed callback function
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_MASTER_RegisterRxCpltCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_cb_t
p_callback
)
¶
-
Register the SMBUS Master Rx Transfer completed callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_callback – Pointer to the Master Rx Transfer completed callback function
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_SLAVE_RegisterTxCpltCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_cb_t
p_callback
)
¶
-
Register the SMBUS Slave Tx Transfer completed callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_callback – Pointer to the Slave Tx Transfer completed callback function
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_SLAVE_RegisterRxCpltCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_cb_t
p_callback
)
¶
-
Register the SMBUS Slave Rx Transfer completed callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_callback – Pointer to the Slave Rx Transfer completed callback function
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_SLAVE_RegisterListenCpltCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_cb_t
p_callback
)
¶
-
Register the SMBUS Slave Listen completed callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_callback – Pointer to the SMBUS slave listen completed callback function
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_RegisterAbortCpltCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_cb_t
p_callback
)
¶
-
Register the SMBUS Abort completed callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_callback – Pointer to the SMBUS Abort completed callback function
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_SLAVE_RegisterAddrMatchCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_slave_addr_cb_t
p_callback
)
¶
-
Register the SMBUS Slave Address Match callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_callback – Pointer to the SMBUS Slave Address Match callback function
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_RegisterErrorCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_cb_t
p_callback
)
¶
-
Register the SMBUS Error callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_callback – Pointer to the SMBUS Error callback function
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
- group SMBUS_Exported_Functions_Group2
-
A set of functions allowing to configure the I2Cx peripheral in SMBUS:
-
Global configuration :
-
Unitary configuration :
-
Timeout configuration:
-
Filter Mode :
-
Acknowledge General Call:
-
Second Own Address configuration :
-
Packet Error Check :
-
Alert interrupt:
-
Wakeup from Stop mode(s) :
-
Fast mode plus driving capability :
-
Autonomous mode :
Functions
-
hal_status_t
HAL_SMBUS_SetConfig
(
hal_smbus_handle_t
*
hsmbus
,
const
hal_smbus_config_t
*
p_config
)
-
Configure the SMBUS according to the user parameters.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_config – Pointer to the configuration structure
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
void
HAL_SMBUS_GetConfig
(
const
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_config_t
*
p_config
)
-
Retrieve the SMBUS configuration.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_config – Pointer to the configuration structure
-
-
hal_status_t
HAL_SMBUS_SetTiming
(
hal_smbus_handle_t
*
hsmbus
,
uint32_t
value
)
-
Set the SMBUS Timing.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
value – SMBUS timing
-
- Return values :
-
HAL_OK – Operation completed successfully
-
uint32_t
HAL_SMBUS_GetTiming
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Get the SMBUS Timing.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
uint32_t – SMBUS timing value
-
hal_status_t
HAL_SMBUS_EnableAnalogFilter
(
hal_smbus_handle_t
*
hsmbus
)
-
Enable SMBUS Analog noise filter.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_DisableAnalogFilter
(
hal_smbus_handle_t
*
hsmbus
)
-
Disable SMBUS Analog noise filter.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_analog_filter_status_t
HAL_SMBUS_IsEnabledAnalogFilter
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Check SMBUS analog noise filter status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_ANALOG_FILTER_ENABLED – Analog Filter is enabled
-
HAL_SMBUS_ANALOG_FILTER_DISABLED – Analog Filter is disabled
-
-
hal_status_t
HAL_SMBUS_SetDigitalFilter
(
hal_smbus_handle_t
*
hsmbus
,
uint32_t
noise_filtering_in_bus_clk_period
)
-
Set the SMBUS Digital noise filter.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
noise_filtering_in_bus_clk_period – Filtering period between Min_Data=0x00 and Max_Data=0x0F.
-
- Return values :
-
HAL_OK – Operation completed successfully
-
uint32_t
HAL_SMBUS_GetDigitalFilter
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Get the SMBUS Digital noise filter.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
uint32_t – Coefficient of digital noise filter between Min_Data=0x00 and Max_Data=0x0F.
-
hal_status_t
HAL_SMBUS_SLAVE_EnableWakeUp
(
hal_smbus_handle_t
*
hsmbus
)
-
Enable SMBUS Slave wakeup from Stop mode(s).
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_SLAVE_DisableWakeUp
(
hal_smbus_handle_t
*
hsmbus
)
-
Disable Slave SMBUS wakeup from Stop mode(s).
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_slave_wake_up_status_t
HAL_SMBUS_SLAVE_IsEnabledWakeUp
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Check SMBUS slave wake up status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_SLAVE_WAKE_UP_ENABLED – Slave Wake Up is enabled
-
HAL_SMBUS_SLAVE_WAKE_UP_DISABLED – Slave Wake Up is disabled
-
-
hal_status_t
HAL_SMBUS_AM_SetConfigTrigger
(
hal_smbus_handle_t
*
hsmbus
,
const
hal_smbus_am_trig_config_t
*
p_config
)
-
Set the SMBUS autonomous mode trigger configuration.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t .
-
p_config – Pointer to a hal_smbus_am_trig_config_t .
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
void
HAL_SMBUS_AM_GetConfigTrigger
(
const
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_am_trig_config_t
*
p_config
)
-
Get the SMBUS autonomous mode trigger configuration.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t .
-
p_config – Pointer to a hal_smbus_am_trig_config_t .
-
-
hal_status_t
HAL_SMBUS_AM_EnableTrigger
(
hal_smbus_handle_t
*
hsmbus
)
-
Enable the SMBUS Autonomous mode.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_AM_DisableTrigger
(
hal_smbus_handle_t
*
hsmbus
)
-
Disable the SMBUS Autonomous mode.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_am_trig_status_t
HAL_SMBUS_AM_IsEnabledTrigger
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Get SMBUS autonomous mode status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_AM_TRIG_ENABLED – Autonomous mode trigger enabled
-
HAL_SMBUS_AM_TRIG_DISABLED – Autonomous mode trigger disabled
-
-
hal_status_t
HAL_SMBUS_SetConfigTimeout
(
hal_smbus_handle_t
*
hsmbus
,
const
hal_smbus_timeout_config_t
*
p_config
)
-
Set hardware timeout config.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_config – Pointer to hal_smbus_timeout_config_t containing both TimeoutA and B configuration.
-
- Return values :
-
HAL_OK – Operation completed successfully
-
void
HAL_SMBUS_GetConfigTimeout
(
const
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_timeout_config_t
*
p_config
)
-
Get hardware timeout config.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_config – Pointer to hal_smbus_timeout_config_t containing both TimeoutA and B configuration.
-
-
hal_status_t
HAL_SMBUS_EnableTimeout
(
hal_smbus_handle_t
*
hsmbus
,
const
hal_smbus_timeout_t
timeout
)
-
Enable SMBUS timeout feature.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
timeout – Timeout to Enable
-
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_DisableTimeout
(
hal_smbus_handle_t
*
hsmbus
,
const
hal_smbus_timeout_t
timeout
)
-
Disable SMBUS timeout feature.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
timeout – Timeout to disable
-
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_timeout_t
HAL_SMBUS_IsEnabledTimeoutA
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Get SMBUS Timeout A status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_TIMEOUT_NONE – Timeout A is disabled
-
HAL_SMBUS_SELECT_TIMEOUT_A – Timeout A is enabled
-
-
hal_smbus_timeout_t
HAL_SMBUS_IsEnabledTimeoutB
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Get SMBUS Timeout B status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_TIMEOUT_NONE – Timeout B is disabled
-
HAL_SMBUS_SELECT_TIMEOUT_A – Timeout B is enabled
-
-
hal_status_t
HAL_SMBUS_SLAVE_EnableAckGeneralCall
(
hal_smbus_handle_t
*
hsmbus
)
-
Enable SMBUS slave acknowledge general call address.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_SLAVE_DisableAckGeneralCall
(
hal_smbus_handle_t
*
hsmbus
)
-
Disable SMBUS slave acknowledge general call address.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_slave_ack_general_call_status_t
HAL_SMBUS_SLAVE_IsEnabledAckGeneralCall
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Check SMBUS slave acknowledge general call status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_SLAVE_ACK_GENERAL_CALL_ENABLED – Slave Acknowledge General Call is enabled
-
HAL_SMBUS_SLAVE_ACK_GENERAL_CALL_DISABLED – Slave Acknowledge General Call is disabled
-
-
hal_status_t
HAL_SMBUS_EnablePacketErrorCheck
(
hal_smbus_handle_t
*
hsmbus
)
-
Enable Packet Error Check.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_DisablePacketErrorCheck
(
hal_smbus_handle_t
*
hsmbus
)
-
Disable Packet Error Check.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_pec_status_t
HAL_SMBUS_IsEnabledPacketErrorCheck
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Check SMBUS packet error check(PEC) status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_PEC_ENABLED – Packet Error Check enabled
-
HAL_SMBUS_PEC_DISABLED – Packet Error Check disabled
-
-
hal_status_t
HAL_SMBUS_MASTER_EnableAlertIT
(
hal_smbus_handle_t
*
hsmbus
)
-
Enable Alert Interruption.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_MASTER_DisableAlertIT
(
hal_smbus_handle_t
*
hsmbus
)
-
Disable Alert Interruption.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_alert_status_t
HAL_SMBUS_MASTER_IsEnabledAlertIT
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Check SMBUS Alert interruption status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_ALERT_ENABLED – Alert interruption enabled
-
HAL_SMBUS_ALERT_DISABLED – Alert interruption disabled
-
-
hal_status_t
HAL_SMBUS_SetConfigOwnAddress2
(
hal_smbus_handle_t
*
hsmbus
,
uint32_t
addr
,
hal_smbus_own_addr2_mask_t
mask
)
-
Set the SMBUS own address2 configuration.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t .
-
addr – The second device own address. It is a 7-bit address but the value must be shifted left by 1 bit. In other words, an 8-bit value is required and the bit 0 is not considered.
-
mask – Acknowledge mask address second device own address.
-
- Return values :
-
HAL_OK – Operation completed successfully
-
void
HAL_SMBUS_GetConfigOwnAddress2
(
const
hal_smbus_handle_t
*
hsmbus
,
uint32_t
*
p_addr
,
hal_smbus_own_addr2_mask_t
*
p_mask
)
-
Get the SMBUS own address2 configuration.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t .
-
p_addr – The second device own address. It is a 7-bit address but the value is shifted left by 1 bit. In other words, an 8-bit value is returned and the bit 0 is not considered.
-
p_mask – Acknowledge mask address second device own address.
-
-
hal_status_t
HAL_SMBUS_EnableOwnAddress2
(
hal_smbus_handle_t
*
hsmbus
)
-
Enable SMBUS Own Address2.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_DisableOwnAddress2
(
hal_smbus_handle_t
*
hsmbus
)
-
Disable SMBUS Own Address2.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_own_addr2_status_t
HAL_SMBUS_IsEnabledOwnAddress2
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Check SMBUS own address 2 status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_OWN_ADDR2_ENABLED – Dual addressing is enabled
-
HAL_SMBUS_OWN_ADDR2_DISABLED – Dual addressing is disabled
-
-
hal_status_t
HAL_SMBUS_SetMode
(
hal_smbus_handle_t
*
hsmbus
,
const
hal_smbus_mode_t
mode
)
-
Set the functional SMBUS mode(Host, Slave or Slave ARP).
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
mode – Mode to set from hal_smbus_mode_t
-
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_mode_t
HAL_SMBUS_GetMode
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Return the functional SMBUS mode. Host, Slave or Slave ARP.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL – mode
-
hal_status_t
HAL_SMBUS_EnableFastModePlus
(
hal_smbus_handle_t
*
hsmbus
)
-
Enable the SMBUS fast mode plus driving capability.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_DisableFastModePlus
(
hal_smbus_handle_t
*
hsmbus
)
-
Disable the SMBUS fast mode plus driving capability.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t .
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_fast_mode_plus_status_t
HAL_SMBUS_IsEnabledFastModePlus
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Check SMBUS fast mode plus feature status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_FAST_MODE_PLUS_ENABLED – Fast mode plus enabled
-
HAL_SMBUS_FAST_MODE_PLUS_DISABLED – Fast mode plus disabled
-
-
hal_status_t
HAL_SMBUS_MASTER_RegisterTxCpltCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_cb_t
p_callback
)
-
Register the SMBUS Master Tx Transfer completed callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_callback – Pointer to the Master Tx Transfer completed callback function
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_MASTER_RegisterRxCpltCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_cb_t
p_callback
)
-
Register the SMBUS Master Rx Transfer completed callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_callback – Pointer to the Master Rx Transfer completed callback function
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_SLAVE_RegisterTxCpltCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_cb_t
p_callback
)
-
Register the SMBUS Slave Tx Transfer completed callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_callback – Pointer to the Slave Tx Transfer completed callback function
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_SLAVE_RegisterRxCpltCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_cb_t
p_callback
)
-
Register the SMBUS Slave Rx Transfer completed callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_callback – Pointer to the Slave Rx Transfer completed callback function
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_SLAVE_RegisterListenCpltCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_cb_t
p_callback
)
-
Register the SMBUS Slave Listen completed callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_callback – Pointer to the SMBUS slave listen completed callback function
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_RegisterAbortCpltCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_cb_t
p_callback
)
-
Register the SMBUS Abort completed callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_callback – Pointer to the SMBUS Abort completed callback function
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_SLAVE_RegisterAddrMatchCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_slave_addr_cb_t
p_callback
)
-
Register the SMBUS Slave Address Match callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_callback – Pointer to the SMBUS Slave Address Match callback function
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_RegisterErrorCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_cb_t
p_callback
)
-
Register the SMBUS Error callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_callback – Pointer to the SMBUS Error callback function
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
- group SMBUS_Exported_Functions_Group2
-
A set of functions allowing to configure the I2Cx peripheral in SMBUS:
-
Global configuration :
-
Unitary configuration :
-
Timeout configuration:
-
Filter Mode :
-
Acknowledge General Call:
-
Second Own Address configuration :
-
Packet Error Check :
-
Alert interrupt:
-
Wakeup from Stop mode(s) :
-
Fast mode plus driving capability :
-
Autonomous mode :
Functions
-
hal_status_t
HAL_SMBUS_SetConfig
(
hal_smbus_handle_t
*
hsmbus
,
const
hal_smbus_config_t
*
p_config
)
-
Configure the SMBUS according to the user parameters.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_config – Pointer to the configuration structure
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
void
HAL_SMBUS_GetConfig
(
const
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_config_t
*
p_config
)
-
Retrieve the SMBUS configuration.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_config – Pointer to the configuration structure
-
-
hal_status_t
HAL_SMBUS_SetTiming
(
hal_smbus_handle_t
*
hsmbus
,
uint32_t
value
)
-
Set the SMBUS Timing.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
value – SMBUS timing
-
- Return values :
-
HAL_OK – Operation completed successfully
-
uint32_t
HAL_SMBUS_GetTiming
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Get the SMBUS Timing.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
uint32_t – SMBUS timing value
-
hal_status_t
HAL_SMBUS_EnableAnalogFilter
(
hal_smbus_handle_t
*
hsmbus
)
-
Enable SMBUS Analog noise filter.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_DisableAnalogFilter
(
hal_smbus_handle_t
*
hsmbus
)
-
Disable SMBUS Analog noise filter.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_analog_filter_status_t
HAL_SMBUS_IsEnabledAnalogFilter
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Check SMBUS analog noise filter status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_ANALOG_FILTER_ENABLED – Analog Filter is enabled
-
HAL_SMBUS_ANALOG_FILTER_DISABLED – Analog Filter is disabled
-
-
hal_status_t
HAL_SMBUS_SetDigitalFilter
(
hal_smbus_handle_t
*
hsmbus
,
uint32_t
noise_filtering_in_bus_clk_period
)
-
Set the SMBUS Digital noise filter.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
noise_filtering_in_bus_clk_period – Filtering period between Min_Data=0x00 and Max_Data=0x0F.
-
- Return values :
-
HAL_OK – Operation completed successfully
-
uint32_t
HAL_SMBUS_GetDigitalFilter
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Get the SMBUS Digital noise filter.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
uint32_t – Coefficient of digital noise filter between Min_Data=0x00 and Max_Data=0x0F.
-
hal_status_t
HAL_SMBUS_SLAVE_EnableWakeUp
(
hal_smbus_handle_t
*
hsmbus
)
-
Enable SMBUS Slave wakeup from Stop mode(s).
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_SLAVE_DisableWakeUp
(
hal_smbus_handle_t
*
hsmbus
)
-
Disable Slave SMBUS wakeup from Stop mode(s).
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_slave_wake_up_status_t
HAL_SMBUS_SLAVE_IsEnabledWakeUp
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Check SMBUS slave wake up status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_SLAVE_WAKE_UP_ENABLED – Slave Wake Up is enabled
-
HAL_SMBUS_SLAVE_WAKE_UP_DISABLED – Slave Wake Up is disabled
-
-
hal_status_t
HAL_SMBUS_AM_SetConfigTrigger
(
hal_smbus_handle_t
*
hsmbus
,
const
hal_smbus_am_trig_config_t
*
p_config
)
-
Set the SMBUS autonomous mode trigger configuration.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t .
-
p_config – Pointer to a hal_smbus_am_trig_config_t .
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
void
HAL_SMBUS_AM_GetConfigTrigger
(
const
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_am_trig_config_t
*
p_config
)
-
Get the SMBUS autonomous mode trigger configuration.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t .
-
p_config – Pointer to a hal_smbus_am_trig_config_t .
-
-
hal_status_t
HAL_SMBUS_AM_EnableTrigger
(
hal_smbus_handle_t
*
hsmbus
)
-
Enable the SMBUS Autonomous mode.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_AM_DisableTrigger
(
hal_smbus_handle_t
*
hsmbus
)
-
Disable the SMBUS Autonomous mode.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_am_trig_status_t
HAL_SMBUS_AM_IsEnabledTrigger
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Get SMBUS autonomous mode status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_AM_TRIG_ENABLED – Autonomous mode trigger enabled
-
HAL_SMBUS_AM_TRIG_DISABLED – Autonomous mode trigger disabled
-
-
hal_status_t
HAL_SMBUS_SetConfigTimeout
(
hal_smbus_handle_t
*
hsmbus
,
const
hal_smbus_timeout_config_t
*
p_config
)
-
Set hardware timeout config.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_config – Pointer to hal_smbus_timeout_config_t containing both TimeoutA and B configuration.
-
- Return values :
-
HAL_OK – Operation completed successfully
-
void
HAL_SMBUS_GetConfigTimeout
(
const
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_timeout_config_t
*
p_config
)
-
Get hardware timeout config.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_config – Pointer to hal_smbus_timeout_config_t containing both TimeoutA and B configuration.
-
-
hal_status_t
HAL_SMBUS_EnableTimeout
(
hal_smbus_handle_t
*
hsmbus
,
const
hal_smbus_timeout_t
timeout
)
-
Enable SMBUS timeout feature.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
timeout – Timeout to Enable
-
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_DisableTimeout
(
hal_smbus_handle_t
*
hsmbus
,
const
hal_smbus_timeout_t
timeout
)
-
Disable SMBUS timeout feature.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
timeout – Timeout to disable
-
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_timeout_t
HAL_SMBUS_IsEnabledTimeoutA
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Get SMBUS Timeout A status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_TIMEOUT_NONE – Timeout A is disabled
-
HAL_SMBUS_SELECT_TIMEOUT_A – Timeout A is enabled
-
-
hal_smbus_timeout_t
HAL_SMBUS_IsEnabledTimeoutB
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Get SMBUS Timeout B status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_TIMEOUT_NONE – Timeout B is disabled
-
HAL_SMBUS_SELECT_TIMEOUT_A – Timeout B is enabled
-
-
hal_status_t
HAL_SMBUS_SLAVE_EnableAckGeneralCall
(
hal_smbus_handle_t
*
hsmbus
)
-
Enable SMBUS slave acknowledge general call address.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_SLAVE_DisableAckGeneralCall
(
hal_smbus_handle_t
*
hsmbus
)
-
Disable SMBUS slave acknowledge general call address.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_slave_ack_general_call_status_t
HAL_SMBUS_SLAVE_IsEnabledAckGeneralCall
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Check SMBUS slave acknowledge general call status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_SLAVE_ACK_GENERAL_CALL_ENABLED – Slave Acknowledge General Call is enabled
-
HAL_SMBUS_SLAVE_ACK_GENERAL_CALL_DISABLED – Slave Acknowledge General Call is disabled
-
-
hal_status_t
HAL_SMBUS_EnablePacketErrorCheck
(
hal_smbus_handle_t
*
hsmbus
)
-
Enable Packet Error Check.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_DisablePacketErrorCheck
(
hal_smbus_handle_t
*
hsmbus
)
-
Disable Packet Error Check.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_pec_status_t
HAL_SMBUS_IsEnabledPacketErrorCheck
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Check SMBUS packet error check(PEC) status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_PEC_ENABLED – Packet Error Check enabled
-
HAL_SMBUS_PEC_DISABLED – Packet Error Check disabled
-
-
hal_status_t
HAL_SMBUS_MASTER_EnableAlertIT
(
hal_smbus_handle_t
*
hsmbus
)
-
Enable Alert Interruption.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_MASTER_DisableAlertIT
(
hal_smbus_handle_t
*
hsmbus
)
-
Disable Alert Interruption.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_alert_status_t
HAL_SMBUS_MASTER_IsEnabledAlertIT
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Check SMBUS Alert interruption status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_ALERT_ENABLED – Alert interruption enabled
-
HAL_SMBUS_ALERT_DISABLED – Alert interruption disabled
-
-
hal_status_t
HAL_SMBUS_SetConfigOwnAddress2
(
hal_smbus_handle_t
*
hsmbus
,
uint32_t
addr
,
hal_smbus_own_addr2_mask_t
mask
)
-
Set the SMBUS own address2 configuration.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t .
-
addr – The second device own address. It is a 7-bit address but the value must be shifted left by 1 bit. In other words, an 8-bit value is required and the bit 0 is not considered.
-
mask – Acknowledge mask address second device own address.
-
- Return values :
-
HAL_OK – Operation completed successfully
-
void
HAL_SMBUS_GetConfigOwnAddress2
(
const
hal_smbus_handle_t
*
hsmbus
,
uint32_t
*
p_addr
,
hal_smbus_own_addr2_mask_t
*
p_mask
)
-
Get the SMBUS own address2 configuration.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t .
-
p_addr – The second device own address. It is a 7-bit address but the value is shifted left by 1 bit. In other words, an 8-bit value is returned and the bit 0 is not considered.
-
p_mask – Acknowledge mask address second device own address.
-
-
hal_status_t
HAL_SMBUS_EnableOwnAddress2
(
hal_smbus_handle_t
*
hsmbus
)
-
Enable SMBUS Own Address2.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_DisableOwnAddress2
(
hal_smbus_handle_t
*
hsmbus
)
-
Disable SMBUS Own Address2.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_own_addr2_status_t
HAL_SMBUS_IsEnabledOwnAddress2
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Check SMBUS own address 2 status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_OWN_ADDR2_ENABLED – Dual addressing is enabled
-
HAL_SMBUS_OWN_ADDR2_DISABLED – Dual addressing is disabled
-
-
hal_status_t
HAL_SMBUS_SetMode
(
hal_smbus_handle_t
*
hsmbus
,
const
hal_smbus_mode_t
mode
)
-
Set the functional SMBUS mode(Host, Slave or Slave ARP).
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
mode – Mode to set from hal_smbus_mode_t
-
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_mode_t
HAL_SMBUS_GetMode
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Return the functional SMBUS mode. Host, Slave or Slave ARP.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL – mode
-
hal_status_t
HAL_SMBUS_EnableFastModePlus
(
hal_smbus_handle_t
*
hsmbus
)
-
Enable the SMBUS fast mode plus driving capability.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_status_t
HAL_SMBUS_DisableFastModePlus
(
hal_smbus_handle_t
*
hsmbus
)
-
Disable the SMBUS fast mode plus driving capability.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t .
- Return values :
-
HAL_OK – Operation completed successfully
-
hal_smbus_fast_mode_plus_status_t
HAL_SMBUS_IsEnabledFastModePlus
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Check SMBUS fast mode plus feature status.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_SMBUS_FAST_MODE_PLUS_ENABLED – Fast mode plus enabled
-
HAL_SMBUS_FAST_MODE_PLUS_DISABLED – Fast mode plus disabled
-
-
hal_status_t
HAL_SMBUS_MASTER_RegisterTxCpltCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_cb_t
p_callback
)
-
Register the SMBUS Master Tx Transfer completed callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_callback – Pointer to the Master Tx Transfer completed callback function
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_MASTER_RegisterRxCpltCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_cb_t
p_callback
)
-
Register the SMBUS Master Rx Transfer completed callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_callback – Pointer to the Master Rx Transfer completed callback function
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_SLAVE_RegisterTxCpltCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_cb_t
p_callback
)
-
Register the SMBUS Slave Tx Transfer completed callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_callback – Pointer to the Slave Tx Transfer completed callback function
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_SLAVE_RegisterRxCpltCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_cb_t
p_callback
)
-
Register the SMBUS Slave Rx Transfer completed callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_callback – Pointer to the Slave Rx Transfer completed callback function
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_SLAVE_RegisterListenCpltCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_cb_t
p_callback
)
-
Register the SMBUS Slave Listen completed callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_callback – Pointer to the SMBUS slave listen completed callback function
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_RegisterAbortCpltCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_cb_t
p_callback
)
-
Register the SMBUS Abort completed callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_callback – Pointer to the SMBUS Abort completed callback function
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_SLAVE_RegisterAddrMatchCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_slave_addr_cb_t
p_callback
)
-
Register the SMBUS Slave Address Match callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_callback – Pointer to the SMBUS Slave Address Match callback function
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_RegisterErrorCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_cb_t
p_callback
)
-
Register the SMBUS Error callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_callback – Pointer to the SMBUS Error callback function
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_INVALID_PARAM – Invalid parameter
-
-
Input and Output operation functions ¶
- group SMBUS_Exported_Functions_Group3
-
A set of functions allowing to manage the SMBUS data transfers.
-
There are two modes of transfer :
-
Blocking mode : The communication is performed in the polling mode. The status of all data processing is returned by the same function after finishing transfer.
-
Non-Blocking mode : The communication is performed using Interrupts as DMA is not supported due to SMBUS need to perform exchange with a byte granularity within the slave device. These functions return the status of the transfer startup. The end of the data processing will be indicated through the dedicated SMBUS IRQ when using Interrupt mode.
-
-
Blocking mode functions are :
-
Non-Blocking mode functions with Interrupt are :
-
A set of Transfer weak complete callbacks are provided in non-blocking mode:
Functions
-
hal_status_t
HAL_SMBUS_MASTER_IsSlaveReady
(
hal_smbus_handle_t
*
hsmbus
,
uint32_t
device_addr
,
uint32_t
trials
,
uint32_t
timeout_ms
)
¶
-
Check if slave device is ready for communication.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
device_addr – Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface
-
trials – Number of trials
-
timeout_ms – Timeout duration in millisecond
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_BUSY – Concurrent process ongoing or bus is busy
-
HAL_INVALID_PARAM – Invalid parameter
-
HAL_TIMEOUT – Operation exceeds user timeout
-
-
hal_status_t
HAL_SMBUS_MASTER_SEQ_Transmit_IT
(
hal_smbus_handle_t
*
hsmbus
,
uint32_t
device_addr
,
const
void
*
p_data
,
uint32_t
size_byte
,
hal_smbus_xfer_opt_t
xfer_opt
)
¶
-
Sequential transmit in master SMBUS mode an amount of data in non-blocking mode with Interrupt.
Note
This interface allows to manage repeated start condition when a direction change during transfer
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
device_addr – Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface
-
p_data – Pointer to data buffer
-
size_byte – Amount of data to send in bytes
-
xfer_opt – Options of Transfer
-
- Return values :
-
-
HAL_OK – Operation started successfully
-
HAL_BUSY – Concurrent process ongoing
-
HAL_INVALID_PARAM – Invalid parameter
-
HAL_ERROR – Operation completed with error
-
-
hal_status_t
HAL_SMBUS_MASTER_SEQ_Receive_IT
(
hal_smbus_handle_t
*
hsmbus
,
uint32_t
device_addr
,
void
*
p_data
,
uint32_t
size_byte
,
hal_smbus_xfer_opt_t
xfer_opt
)
¶
-
Sequential receive in master SMBUS mode an amount of data in non-blocking mode with Interrupt.
Note
This interface allows to manage repeated start condition when a direction change during transfer
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
device_addr – Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface
-
p_data – Pointer to data buffer
-
size_byte – Amount of data to receive in bytes
-
xfer_opt – Options of Transfer
-
- Return values :
-
-
HAL_OK – Operation started successfully
-
HAL_BUSY – Concurrent process ongoing
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_SLAVE_SEQ_Transmit_IT
(
hal_smbus_handle_t
*
hsmbus
,
const
void
*
p_data
,
uint32_t
size_byte
,
hal_smbus_xfer_opt_t
xfer_opt
)
¶
-
Sequential transmit in slave/device SMBUS mode an amount of data in non-blocking mode with Interrupt.
Note
This interface allows to manage repeated start condition when a direction change during transfer
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_data – Pointer to data buffer
-
size_byte – Amount of data to send in bytes
-
xfer_opt – Options of Transfer
-
- Return values :
-
-
HAL_OK – Operation started successfully
-
HAL_BUSY – Concurrent process ongoing
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_SLAVE_SEQ_Receive_IT
(
hal_smbus_handle_t
*
hsmbus
,
void
*
p_data
,
uint32_t
size_byte
,
hal_smbus_xfer_opt_t
xfer_opt
)
¶
-
Sequential receive in slave/device SMBUS mode an amount of data in non-blocking mode with Interrupt.
Note
This interface allows to manage repeated start condition when a direction change during transfer
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_data – Pointer to data buffer
-
size_byte – Amount of data to receive in bytes
-
xfer_opt – Options of Transfer
-
- Return values :
-
-
HAL_OK – Operation started successfully
-
HAL_BUSY – Concurrent process ongoing
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_SLAVE_EnableListen_IT
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Enable the Address listen mode with Interrupt.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_OK – Operation started successfully
-
HAL_BUSY – Concurrent process ongoing
-
-
hal_status_t
HAL_SMBUS_SLAVE_DisableListen_IT
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Disable the Address listen mode with Interrupt.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_OK – Operation started successfully
-
HAL_BUSY – Concurrent process ongoing
-
-
hal_status_t
HAL_SMBUS_MASTER_Abort_IT
(
hal_smbus_handle_t
*
hsmbus
,
uint32_t
device_addr
)
¶
-
Abort a master SMBUS process communication with Interrupt.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
device_addr – Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface
-
- Return values :
-
-
HAL_OK – Operation started successfully
-
HAL_ERROR – Mode is not Master
-
HAL_BUSY – No process ongoing
-
-
hal_status_t
HAL_SMBUS_SLAVE_Abort_IT
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Abort a slave SMBUS process communication with Interrupt.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_OK – Operation started successfully
-
HAL_ERROR – Mode is not Slave
-
-
- group SMBUS_Exported_Functions_Group3
-
A set of functions allowing to manage the SMBUS data transfers.
-
There are two modes of transfer :
-
Blocking mode : The communication is performed in the polling mode. The status of all data processing is returned by the same function after finishing transfer.
-
Non-Blocking mode : The communication is performed using Interrupts as DMA is not supported due to SMBUS need to perform exchange with a byte granularity within the slave device. These functions return the status of the transfer startup. The end of the data processing will be indicated through the dedicated SMBUS IRQ when using Interrupt mode.
-
-
Blocking mode functions are :
-
Non-Blocking mode functions with Interrupt are :
-
A set of Transfer weak complete callbacks are provided in non-blocking mode:
Functions
-
hal_status_t
HAL_SMBUS_MASTER_IsSlaveReady
(
hal_smbus_handle_t
*
hsmbus
,
uint32_t
device_addr
,
uint32_t
trials
,
uint32_t
timeout_ms
)
-
Check if slave device is ready for communication.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
device_addr – Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface
-
trials – Number of trials
-
timeout_ms – Timeout duration in millisecond
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_BUSY – Concurrent process ongoing or bus is busy
-
HAL_INVALID_PARAM – Invalid parameter
-
HAL_TIMEOUT – Operation exceeds user timeout
-
-
hal_status_t
HAL_SMBUS_MASTER_SEQ_Transmit_IT
(
hal_smbus_handle_t
*
hsmbus
,
uint32_t
device_addr
,
const
void
*
p_data
,
uint32_t
size_byte
,
hal_smbus_xfer_opt_t
xfer_opt
)
-
Sequential transmit in master SMBUS mode an amount of data in non-blocking mode with Interrupt.
Note
This interface allows to manage repeated start condition when a direction change during transfer
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
device_addr – Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface
-
p_data – Pointer to data buffer
-
size_byte – Amount of data to send in bytes
-
xfer_opt – Options of Transfer
-
- Return values :
-
-
HAL_OK – Operation started successfully
-
HAL_BUSY – Concurrent process ongoing
-
HAL_INVALID_PARAM – Invalid parameter
-
HAL_ERROR – Operation completed with error
-
-
hal_status_t
HAL_SMBUS_MASTER_SEQ_Receive_IT
(
hal_smbus_handle_t
*
hsmbus
,
uint32_t
device_addr
,
void
*
p_data
,
uint32_t
size_byte
,
hal_smbus_xfer_opt_t
xfer_opt
)
-
Sequential receive in master SMBUS mode an amount of data in non-blocking mode with Interrupt.
Note
This interface allows to manage repeated start condition when a direction change during transfer
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
device_addr – Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface
-
p_data – Pointer to data buffer
-
size_byte – Amount of data to receive in bytes
-
xfer_opt – Options of Transfer
-
- Return values :
-
-
HAL_OK – Operation started successfully
-
HAL_BUSY – Concurrent process ongoing
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_SLAVE_SEQ_Transmit_IT
(
hal_smbus_handle_t
*
hsmbus
,
const
void
*
p_data
,
uint32_t
size_byte
,
hal_smbus_xfer_opt_t
xfer_opt
)
-
Sequential transmit in slave/device SMBUS mode an amount of data in non-blocking mode with Interrupt.
Note
This interface allows to manage repeated start condition when a direction change during transfer
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_data – Pointer to data buffer
-
size_byte – Amount of data to send in bytes
-
xfer_opt – Options of Transfer
-
- Return values :
-
-
HAL_OK – Operation started successfully
-
HAL_BUSY – Concurrent process ongoing
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_SLAVE_SEQ_Receive_IT
(
hal_smbus_handle_t
*
hsmbus
,
void
*
p_data
,
uint32_t
size_byte
,
hal_smbus_xfer_opt_t
xfer_opt
)
-
Sequential receive in slave/device SMBUS mode an amount of data in non-blocking mode with Interrupt.
Note
This interface allows to manage repeated start condition when a direction change during transfer
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_data – Pointer to data buffer
-
size_byte – Amount of data to receive in bytes
-
xfer_opt – Options of Transfer
-
- Return values :
-
-
HAL_OK – Operation started successfully
-
HAL_BUSY – Concurrent process ongoing
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_SLAVE_EnableListen_IT
(
hal_smbus_handle_t
*
hsmbus
)
-
Enable the Address listen mode with Interrupt.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_OK – Operation started successfully
-
HAL_BUSY – Concurrent process ongoing
-
-
hal_status_t
HAL_SMBUS_SLAVE_DisableListen_IT
(
hal_smbus_handle_t
*
hsmbus
)
-
Disable the Address listen mode with Interrupt.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_OK – Operation started successfully
-
HAL_BUSY – Concurrent process ongoing
-
-
hal_status_t
HAL_SMBUS_MASTER_Abort_IT
(
hal_smbus_handle_t
*
hsmbus
,
uint32_t
device_addr
)
-
Abort a master SMBUS process communication with Interrupt.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
device_addr – Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface
-
- Return values :
-
-
HAL_OK – Operation started successfully
-
HAL_ERROR – Mode is not Master
-
HAL_BUSY – No process ongoing
-
-
hal_status_t
HAL_SMBUS_SLAVE_Abort_IT
(
hal_smbus_handle_t
*
hsmbus
)
-
Abort a slave SMBUS process communication with Interrupt.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_OK – Operation started successfully
-
HAL_ERROR – Mode is not Slave
-
-
- group SMBUS_Exported_Functions_Group3
-
A set of functions allowing to manage the SMBUS data transfers.
-
There are two modes of transfer :
-
Blocking mode : The communication is performed in the polling mode. The status of all data processing is returned by the same function after finishing transfer.
-
Non-Blocking mode : The communication is performed using Interrupts as DMA is not supported due to SMBUS need to perform exchange with a byte granularity within the slave device. These functions return the status of the transfer startup. The end of the data processing will be indicated through the dedicated SMBUS IRQ when using Interrupt mode.
-
-
Blocking mode functions are :
-
Non-Blocking mode functions with Interrupt are :
-
A set of Transfer weak complete callbacks are provided in non-blocking mode:
Functions
-
hal_status_t
HAL_SMBUS_MASTER_IsSlaveReady
(
hal_smbus_handle_t
*
hsmbus
,
uint32_t
device_addr
,
uint32_t
trials
,
uint32_t
timeout_ms
)
-
Check if slave device is ready for communication.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
device_addr – Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface
-
trials – Number of trials
-
timeout_ms – Timeout duration in millisecond
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_BUSY – Concurrent process ongoing or bus is busy
-
HAL_INVALID_PARAM – Invalid parameter
-
HAL_TIMEOUT – Operation exceeds user timeout
-
-
hal_status_t
HAL_SMBUS_MASTER_SEQ_Transmit_IT
(
hal_smbus_handle_t
*
hsmbus
,
uint32_t
device_addr
,
const
void
*
p_data
,
uint32_t
size_byte
,
hal_smbus_xfer_opt_t
xfer_opt
)
-
Sequential transmit in master SMBUS mode an amount of data in non-blocking mode with Interrupt.
Note
This interface allows to manage repeated start condition when a direction change during transfer
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
device_addr – Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface
-
p_data – Pointer to data buffer
-
size_byte – Amount of data to send in bytes
-
xfer_opt – Options of Transfer
-
- Return values :
-
-
HAL_OK – Operation started successfully
-
HAL_BUSY – Concurrent process ongoing
-
HAL_INVALID_PARAM – Invalid parameter
-
HAL_ERROR – Operation completed with error
-
-
hal_status_t
HAL_SMBUS_MASTER_SEQ_Receive_IT
(
hal_smbus_handle_t
*
hsmbus
,
uint32_t
device_addr
,
void
*
p_data
,
uint32_t
size_byte
,
hal_smbus_xfer_opt_t
xfer_opt
)
-
Sequential receive in master SMBUS mode an amount of data in non-blocking mode with Interrupt.
Note
This interface allows to manage repeated start condition when a direction change during transfer
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
device_addr – Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface
-
p_data – Pointer to data buffer
-
size_byte – Amount of data to receive in bytes
-
xfer_opt – Options of Transfer
-
- Return values :
-
-
HAL_OK – Operation started successfully
-
HAL_BUSY – Concurrent process ongoing
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_SLAVE_SEQ_Transmit_IT
(
hal_smbus_handle_t
*
hsmbus
,
const
void
*
p_data
,
uint32_t
size_byte
,
hal_smbus_xfer_opt_t
xfer_opt
)
-
Sequential transmit in slave/device SMBUS mode an amount of data in non-blocking mode with Interrupt.
Note
This interface allows to manage repeated start condition when a direction change during transfer
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_data – Pointer to data buffer
-
size_byte – Amount of data to send in bytes
-
xfer_opt – Options of Transfer
-
- Return values :
-
-
HAL_OK – Operation started successfully
-
HAL_BUSY – Concurrent process ongoing
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_SLAVE_SEQ_Receive_IT
(
hal_smbus_handle_t
*
hsmbus
,
void
*
p_data
,
uint32_t
size_byte
,
hal_smbus_xfer_opt_t
xfer_opt
)
-
Sequential receive in slave/device SMBUS mode an amount of data in non-blocking mode with Interrupt.
Note
This interface allows to manage repeated start condition when a direction change during transfer
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_data – Pointer to data buffer
-
size_byte – Amount of data to receive in bytes
-
xfer_opt – Options of Transfer
-
- Return values :
-
-
HAL_OK – Operation started successfully
-
HAL_BUSY – Concurrent process ongoing
-
HAL_INVALID_PARAM – Invalid parameter
-
-
hal_status_t
HAL_SMBUS_SLAVE_EnableListen_IT
(
hal_smbus_handle_t
*
hsmbus
)
-
Enable the Address listen mode with Interrupt.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_OK – Operation started successfully
-
HAL_BUSY – Concurrent process ongoing
-
-
hal_status_t
HAL_SMBUS_SLAVE_DisableListen_IT
(
hal_smbus_handle_t
*
hsmbus
)
-
Disable the Address listen mode with Interrupt.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_OK – Operation started successfully
-
HAL_BUSY – Concurrent process ongoing
-
-
hal_status_t
HAL_SMBUS_MASTER_Abort_IT
(
hal_smbus_handle_t
*
hsmbus
,
uint32_t
device_addr
)
-
Abort a master SMBUS process communication with Interrupt.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
device_addr – Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface
-
- Return values :
-
-
HAL_OK – Operation started successfully
-
HAL_ERROR – Mode is not Master
-
HAL_BUSY – No process ongoing
-
-
hal_status_t
HAL_SMBUS_SLAVE_Abort_IT
(
hal_smbus_handle_t
*
hsmbus
)
-
Abort a slave SMBUS process communication with Interrupt.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_OK – Operation started successfully
-
HAL_ERROR – Mode is not Slave
-
-
IRQ Handlers ¶
- group SMBUS_Exported_Functions_Group4
-
This subsection provides the function handling the interruption of the SMBUS.
-
SMBUS Event IRQ Handler : HAL_SMBUS_EV_IRQHandler
-
SMBUS Error IRQ Handler : HAL_SMBUS_ER_IRQHandler
Depending on the process function one’s use, different callback might be triggered:
Process API
\
CallbacksHAL_SMBUS_MASTER_SEQ_Transmit_IT
HAL_SMBUS_MASTER_SEQ_Receive_IT
HAL_SMBUS_MASTER_TxCpltCallback
x
HAL_SMBUS_MASTER_RxCpltCallback
x
HAL_SMBUS_ErrorCallback
x
x
HAL_SMBUS_AbortCpltCallback*
x
x
Process API
\
CallbacksHAL_SMBUS_SLAVE_SEQ_Transmit_IT
HAL_SMBUS_SLAVE_SEQ_Receive_IT
HAL_SMBUS_SLAVE_TxCpltCallback
x
HAL_SMBUS_SLAVE_RxCpltCallback
x
HAL_SMBUS_SLAVE_ListenCpltCallback
x
x
HAL_SMBUS_ErrorCallback
x
x
Process API
\
CallbacksHAL_SMBUS_SLAVE_EnableListen_IT
HAL_SMBUS_SLAVE_AddrCallback
x
Process API
\
CallbacksHAL_SMBUS_MASTER_Abort_IT
HAL_SMBUS_SLAVE_Abort_IT
HAL_SMBUS_AbortCpltCallback
x
x
Note
* HAL_SMBUS_AbortCpltCallback is called by the ISR when the abort is requested by the slave (using NACK) or the master (by generating STOP)
Note
HAL_SMBUS_SLAVE_EnableListen_IT must be called before HAL_SMBUS_SLAVE_SEQ_Transmit_IT and HAL_SMBUS_SLAVE_SEQ_Receive_IT
Functions
-
void
HAL_SMBUS_EV_IRQHandler
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Handle SMBUS event interrupt request.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t structure that contains the configuration information for the specified SMBUS.
-
void
HAL_SMBUS_ER_IRQHandler
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Handle SMBUS error interrupt request.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t structure that contains the configuration information for the specified SMBUS.
-
- group SMBUS_Exported_Functions_Group4
-
This subsection provides the function handling the interruption of the SMBUS.
-
SMBUS Event IRQ Handler : HAL_SMBUS_EV_IRQHandler
-
SMBUS Error IRQ Handler : HAL_SMBUS_ER_IRQHandler
Depending on the process function one’s use, different callback might be triggered:
Process API
\
CallbacksHAL_SMBUS_MASTER_SEQ_Transmit_IT
HAL_SMBUS_MASTER_SEQ_Receive_IT
HAL_SMBUS_MASTER_TxCpltCallback
x
HAL_SMBUS_MASTER_RxCpltCallback
x
HAL_SMBUS_ErrorCallback
x
x
HAL_SMBUS_AbortCpltCallback*
x
x
Process API
\
CallbacksHAL_SMBUS_SLAVE_SEQ_Transmit_IT
HAL_SMBUS_SLAVE_SEQ_Receive_IT
HAL_SMBUS_SLAVE_TxCpltCallback
x
HAL_SMBUS_SLAVE_RxCpltCallback
x
HAL_SMBUS_SLAVE_ListenCpltCallback
x
x
HAL_SMBUS_ErrorCallback
x
x
Process API
\
CallbacksHAL_SMBUS_SLAVE_EnableListen_IT
HAL_SMBUS_SLAVE_AddrCallback
x
Process API
\
CallbacksHAL_SMBUS_MASTER_Abort_IT
HAL_SMBUS_SLAVE_Abort_IT
HAL_SMBUS_AbortCpltCallback
x
x
Note
* HAL_SMBUS_AbortCpltCallback is called by the ISR when the abort is requested by the slave (using NACK) or the master (by generating STOP)
Note
HAL_SMBUS_SLAVE_EnableListen_IT must be called before HAL_SMBUS_SLAVE_SEQ_Transmit_IT and HAL_SMBUS_SLAVE_SEQ_Receive_IT
Functions
-
void
HAL_SMBUS_EV_IRQHandler
(
hal_smbus_handle_t
*
hsmbus
)
-
Handle SMBUS event interrupt request.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t structure that contains the configuration information for the specified SMBUS.
-
void
HAL_SMBUS_ER_IRQHandler
(
hal_smbus_handle_t
*
hsmbus
)
-
Handle SMBUS error interrupt request.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t structure that contains the configuration information for the specified SMBUS.
-
- group SMBUS_Exported_Functions_Group4
-
This subsection provides the function handling the interruption of the SMBUS.
-
SMBUS Event IRQ Handler : HAL_SMBUS_EV_IRQHandler
-
SMBUS Error IRQ Handler : HAL_SMBUS_ER_IRQHandler
Depending on the process function one’s use, different callback might be triggered:
Process API
\
CallbacksHAL_SMBUS_MASTER_SEQ_Transmit_IT
HAL_SMBUS_MASTER_SEQ_Receive_IT
HAL_SMBUS_MASTER_TxCpltCallback
x
HAL_SMBUS_MASTER_RxCpltCallback
x
HAL_SMBUS_ErrorCallback
x
x
HAL_SMBUS_AbortCpltCallback*
x
x
Process API
\
CallbacksHAL_SMBUS_SLAVE_SEQ_Transmit_IT
HAL_SMBUS_SLAVE_SEQ_Receive_IT
HAL_SMBUS_SLAVE_TxCpltCallback
x
HAL_SMBUS_SLAVE_RxCpltCallback
x
HAL_SMBUS_SLAVE_ListenCpltCallback
x
x
HAL_SMBUS_ErrorCallback
x
x
Process API
\
CallbacksHAL_SMBUS_SLAVE_EnableListen_IT
HAL_SMBUS_SLAVE_AddrCallback
x
Process API
\
CallbacksHAL_SMBUS_MASTER_Abort_IT
HAL_SMBUS_SLAVE_Abort_IT
HAL_SMBUS_AbortCpltCallback
x
x
Note
* HAL_SMBUS_AbortCpltCallback is called by the ISR when the abort is requested by the slave (using NACK) or the master (by generating STOP)
Note
HAL_SMBUS_SLAVE_EnableListen_IT must be called before HAL_SMBUS_SLAVE_SEQ_Transmit_IT and HAL_SMBUS_SLAVE_SEQ_Receive_IT
Functions
-
void
HAL_SMBUS_EV_IRQHandler
(
hal_smbus_handle_t
*
hsmbus
)
-
Handle SMBUS event interrupt request.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t structure that contains the configuration information for the specified SMBUS.
-
void
HAL_SMBUS_ER_IRQHandler
(
hal_smbus_handle_t
*
hsmbus
)
-
Handle SMBUS error interrupt request.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t structure that contains the configuration information for the specified SMBUS.
-
Weak Callback Functions ¶
- group SMBUS_Exported_Functions_Group5
-
A set of weak functions (or default callbacks functions if USE_HAL_SMBUS_REGISTER_CALLBACKS is set to 1U) which are used to asynchronously informed the application in non blocking modes (Interrupt) :
-
HAL_SMBUS_MASTER_TxCpltCallback() : Master Tx Transfer completed callback
-
HAL_SMBUS_MASTER_RxCpltCallback() : Master Rx Transfer completed callback
-
HAL_SMBUS_SLAVE_TxCpltCallback() : Slave Tx Transfer completed callback
-
HAL_SMBUS_SLAVE_RxCpltCallback() : Slave Rx Transfer completed callback
-
HAL_SMBUS_SLAVE_AddrCallback() : Slave Address Match callback
-
HAL_SMBUS_SLAVE_ListenCpltCallback() : Slave listen completed callback
-
HAL_SMBUS_ErrorCallback() : SMBUS error callback
-
HAL_SMBUS_AbortCpltCallback() : SMBUS abort callback
Functions
-
void
HAL_SMBUS_MASTER_TxCpltCallback
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Master Tx transfer completed callback.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
-
void
HAL_SMBUS_MASTER_RxCpltCallback
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Master Rx transfer completed callback.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
-
void
HAL_SMBUS_SLAVE_TxCpltCallback
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Slave Tx transfer completed callback.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
-
void
HAL_SMBUS_SLAVE_RxCpltCallback
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Slave Rx transfer completed callback.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
-
void
HAL_SMBUS_SLAVE_AddrCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_slave_xfer_direction_t
xfer_direction
,
uint32_t
addr_match_code
)
¶
-
Slave address match callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
xfer_direction – Master request Transfer Direction (Write/Read)
-
addr_match_code – Address Match Code
-
-
void
HAL_SMBUS_SLAVE_ListenCpltCallback
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Slave listen complete callback.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
-
void
HAL_SMBUS_ErrorCallback
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
SMBUS error callback.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
-
void
HAL_SMBUS_AbortCpltCallback
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
SMBUS abort callback.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
-
- group SMBUS_Exported_Functions_Group5
-
A set of weak functions (or default callbacks functions if USE_HAL_SMBUS_REGISTER_CALLBACKS is set to 1U) which are used to asynchronously informed the application in non blocking modes (Interrupt) :
-
HAL_SMBUS_MASTER_TxCpltCallback() : Master Tx Transfer completed callback
-
HAL_SMBUS_MASTER_RxCpltCallback() : Master Rx Transfer completed callback
-
HAL_SMBUS_SLAVE_TxCpltCallback() : Slave Tx Transfer completed callback
-
HAL_SMBUS_SLAVE_RxCpltCallback() : Slave Rx Transfer completed callback
-
HAL_SMBUS_SLAVE_AddrCallback() : Slave Address Match callback
-
HAL_SMBUS_SLAVE_ListenCpltCallback() : Slave listen completed callback
-
HAL_SMBUS_ErrorCallback() : SMBUS error callback
-
HAL_SMBUS_AbortCpltCallback() : SMBUS abort callback
Functions
-
void
HAL_SMBUS_MASTER_TxCpltCallback
(
hal_smbus_handle_t
*
hsmbus
)
-
Master Tx transfer completed callback.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
-
void
HAL_SMBUS_MASTER_RxCpltCallback
(
hal_smbus_handle_t
*
hsmbus
)
-
Master Rx transfer completed callback.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
-
void
HAL_SMBUS_SLAVE_TxCpltCallback
(
hal_smbus_handle_t
*
hsmbus
)
-
Slave Tx transfer completed callback.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
-
void
HAL_SMBUS_SLAVE_RxCpltCallback
(
hal_smbus_handle_t
*
hsmbus
)
-
Slave Rx transfer completed callback.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
-
void
HAL_SMBUS_SLAVE_AddrCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_slave_xfer_direction_t
xfer_direction
,
uint32_t
addr_match_code
)
-
Slave address match callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
xfer_direction – Master request Transfer Direction (Write/Read)
-
addr_match_code – Address Match Code
-
-
void
HAL_SMBUS_SLAVE_ListenCpltCallback
(
hal_smbus_handle_t
*
hsmbus
)
-
Slave listen complete callback.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
-
void
HAL_SMBUS_ErrorCallback
(
hal_smbus_handle_t
*
hsmbus
)
-
SMBUS error callback.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
-
void
HAL_SMBUS_AbortCpltCallback
(
hal_smbus_handle_t
*
hsmbus
)
-
SMBUS abort callback.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
-
- group SMBUS_Exported_Functions_Group5
-
A set of weak functions (or default callbacks functions if USE_HAL_SMBUS_REGISTER_CALLBACKS is set to 1U) which are used to asynchronously informed the application in non blocking modes (Interrupt) :
-
HAL_SMBUS_MASTER_TxCpltCallback() : Master Tx Transfer completed callback
-
HAL_SMBUS_MASTER_RxCpltCallback() : Master Rx Transfer completed callback
-
HAL_SMBUS_SLAVE_TxCpltCallback() : Slave Tx Transfer completed callback
-
HAL_SMBUS_SLAVE_RxCpltCallback() : Slave Rx Transfer completed callback
-
HAL_SMBUS_SLAVE_AddrCallback() : Slave Address Match callback
-
HAL_SMBUS_SLAVE_ListenCpltCallback() : Slave listen completed callback
-
HAL_SMBUS_ErrorCallback() : SMBUS error callback
-
HAL_SMBUS_AbortCpltCallback() : SMBUS abort callback
Functions
-
void
HAL_SMBUS_MASTER_TxCpltCallback
(
hal_smbus_handle_t
*
hsmbus
)
-
Master Tx transfer completed callback.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
-
void
HAL_SMBUS_MASTER_RxCpltCallback
(
hal_smbus_handle_t
*
hsmbus
)
-
Master Rx transfer completed callback.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
-
void
HAL_SMBUS_SLAVE_TxCpltCallback
(
hal_smbus_handle_t
*
hsmbus
)
-
Slave Tx transfer completed callback.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
-
void
HAL_SMBUS_SLAVE_RxCpltCallback
(
hal_smbus_handle_t
*
hsmbus
)
-
Slave Rx transfer completed callback.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
-
void
HAL_SMBUS_SLAVE_AddrCallback
(
hal_smbus_handle_t
*
hsmbus
,
hal_smbus_slave_xfer_direction_t
xfer_direction
,
uint32_t
addr_match_code
)
-
Slave address match callback.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
xfer_direction – Master request Transfer Direction (Write/Read)
-
addr_match_code – Address Match Code
-
-
void
HAL_SMBUS_SLAVE_ListenCpltCallback
(
hal_smbus_handle_t
*
hsmbus
)
-
Slave listen complete callback.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
-
void
HAL_SMBUS_ErrorCallback
(
hal_smbus_handle_t
*
hsmbus
)
-
SMBUS error callback.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
-
void
HAL_SMBUS_AbortCpltCallback
(
hal_smbus_handle_t
*
hsmbus
)
-
SMBUS abort callback.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
-
Peripheral State, Peripheral Clock Frequency, Mode and Errors functions ¶
- group SMBUS_Exported_Functions_Group6
-
A set of functions allowing to retrieve peripheral state and last process errors.
-
HAL_SMBUS_GetState() : Return the SMBUS handle state
-
HAL_SMBUS_GetLastErrorCodes() : Return errors limited to the last process.
-
HAL_SMBUS_GetClockFreq() : Retrieve the HAL SMBUS instance kernel clock frequency.
Functions
-
hal_smbus_state_t
HAL_SMBUS_GetState
(
const
hal_smbus_handle_t
*
hsmbus
)
¶
-
Return the SMBUS handle state.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL – state
-
uint32_t
HAL_SMBUS_GetLastErrorCodes
(
const
hal_smbus_handle_t
*
hsmbus
)
¶
-
Return errors limited to the last process.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
uint32_t – Last error code. It can be NULL or a combinaison of the following values:
-
uint32_t
HAL_SMBUS_GetClockFreq
(
const
hal_smbus_handle_t
*
hsmbus
)
¶
-
Return the peripheral clock frequency for SMBUS.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
uint32_t – Frequency in Hz. 0 if the source clock of the SMBUS is not configured or not ready.
-
- group SMBUS_Exported_Functions_Group6
-
A set of functions allowing to retrieve peripheral state and last process errors.
-
HAL_SMBUS_GetState() : Return the SMBUS handle state
-
HAL_SMBUS_GetLastErrorCodes() : Return errors limited to the last process.
-
HAL_SMBUS_GetClockFreq() : Retrieve the HAL SMBUS instance kernel clock frequency.
Functions
-
hal_smbus_state_t
HAL_SMBUS_GetState
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Return the SMBUS handle state.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL – state
-
uint32_t
HAL_SMBUS_GetLastErrorCodes
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Return errors limited to the last process.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
uint32_t – Last error code. It can be NULL or a combinaison of the following values:
-
uint32_t
HAL_SMBUS_GetClockFreq
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Return the peripheral clock frequency for SMBUS.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
uint32_t – Frequency in Hz. 0 if the source clock of the SMBUS is not configured or not ready.
-
- group SMBUS_Exported_Functions_Group6
-
A set of functions allowing to retrieve peripheral state and last process errors.
-
HAL_SMBUS_GetState() : Return the SMBUS handle state
-
HAL_SMBUS_GetLastErrorCodes() : Return errors limited to the last process.
-
HAL_SMBUS_GetClockFreq() : Retrieve the HAL SMBUS instance kernel clock frequency.
Functions
-
hal_smbus_state_t
HAL_SMBUS_GetState
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Return the SMBUS handle state.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
HAL – state
-
uint32_t
HAL_SMBUS_GetLastErrorCodes
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Return errors limited to the last process.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
uint32_t – Last error code. It can be NULL or a combinaison of the following values:
-
uint32_t
HAL_SMBUS_GetClockFreq
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Return the peripheral clock frequency for SMBUS.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
uint32_t – Frequency in Hz. 0 if the source clock of the SMBUS is not configured or not ready.
-
Acquire/Release/Free the bus ¶
- group SMBUS_Exported_Functions_Group7
-
A set of functions allowing to Acquire/Release the bus based on the HAL OS abstraction layer (stm32_hal_os.c/.h osal):
-
HAL_SMBUS_AcquireBus() Acquire the SMBUS bus.
-
HAL_SMBUS_ReleaseBus() Release the SMBUS bus.
Functions
-
hal_status_t
HAL_SMBUS_AcquireBus
(
hal_smbus_handle_t
*
hsmbus
,
uint32_t
timeout_ms
)
¶
-
Acquire the SMBUS bus thanks to the the HAL OS abstraction layer (stm32_hal_os.c/.h osal).
Note
The HAL_SMBUS_AcquireBus must be called from thread mode only (not from handler mode e.g from ISR).
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
timeout_ms – Timeout duration in millisecond.
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_ERROR – Operation completed with error
-
-
hal_status_t
HAL_SMBUS_ReleaseBus
(
hal_smbus_handle_t
*
hsmbus
)
¶
-
Release the SMBUS bus thanks to the the HAL OS abstraction layer (stm32_hal_os.c/.h osal).
Note
The HAL_SMBUS_ReleaseBus can be called from thread mode or from handler mode e.g from ISR.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_ERROR – Operation completed with error
-
-
- group SMBUS_Exported_Functions_Group7
-
A set of functions allowing to Acquire/Release the bus based on the HAL OS abstraction layer (stm32_hal_os.c/.h osal):
-
HAL_SMBUS_AcquireBus() Acquire the SMBUS bus.
-
HAL_SMBUS_ReleaseBus() Release the SMBUS bus.
Functions
-
hal_status_t
HAL_SMBUS_AcquireBus
(
hal_smbus_handle_t
*
hsmbus
,
uint32_t
timeout_ms
)
-
Acquire the SMBUS bus thanks to the the HAL OS abstraction layer (stm32_hal_os.c/.h osal).
Note
The HAL_SMBUS_AcquireBus must be called from thread mode only (not from handler mode e.g from ISR).
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
timeout_ms – Timeout duration in millisecond.
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_ERROR – Operation completed with error
-
-
hal_status_t
HAL_SMBUS_ReleaseBus
(
hal_smbus_handle_t
*
hsmbus
)
-
Release the SMBUS bus thanks to the the HAL OS abstraction layer (stm32_hal_os.c/.h osal).
Note
The HAL_SMBUS_ReleaseBus can be called from thread mode or from handler mode e.g from ISR.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_ERROR – Operation completed with error
-
-
- group SMBUS_Exported_Functions_Group7
-
A set of functions allowing to Acquire/Release the bus based on the HAL OS abstraction layer (stm32_hal_os.c/.h osal):
-
HAL_SMBUS_AcquireBus() Acquire the SMBUS bus.
-
HAL_SMBUS_ReleaseBus() Release the SMBUS bus.
Functions
-
hal_status_t
HAL_SMBUS_AcquireBus
(
hal_smbus_handle_t
*
hsmbus
,
uint32_t
timeout_ms
)
-
Acquire the SMBUS bus thanks to the the HAL OS abstraction layer (stm32_hal_os.c/.h osal).
Note
The HAL_SMBUS_AcquireBus must be called from thread mode only (not from handler mode e.g from ISR).
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
timeout_ms – Timeout duration in millisecond.
-
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_ERROR – Operation completed with error
-
-
hal_status_t
HAL_SMBUS_ReleaseBus
(
hal_smbus_handle_t
*
hsmbus
)
-
Release the SMBUS bus thanks to the the HAL OS abstraction layer (stm32_hal_os.c/.h osal).
Note
The HAL_SMBUS_ReleaseBus can be called from thread mode or from handler mode e.g from ISR.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
-
HAL_OK – Operation completed successfully
-
HAL_ERROR – Operation completed with error
-
-
Set and get user data functions ¶
- group SMBUS_Exported_Functions_Group8
-
A set of functions allowing to manage a user data pointer stored to the SMBUS handle:
-
HAL_SMBUS_SetUserData() Set the user data into the handle
-
HAL_SMBUS_GetUserData() Get the user data from the handle
Functions
-
void
HAL_SMBUS_SetUserData
(
hal_smbus_handle_t
*
hsmbus
,
const
void
*
p_user_data
)
¶
-
Set the user data pointer into the handle.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_user_data – Pointer to the user data.
-
-
const
void
*
HAL_SMBUS_GetUserData
(
const
hal_smbus_handle_t
*
hsmbus
)
¶
-
Get the user data pointer from the handle.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
Pointer – to the user data.
-
- group SMBUS_Exported_Functions_Group8
-
A set of functions allowing to manage a user data pointer stored to the SMBUS handle:
-
HAL_SMBUS_SetUserData() Set the user data into the handle
-
HAL_SMBUS_GetUserData() Get the user data from the handle
Functions
-
void
HAL_SMBUS_SetUserData
(
hal_smbus_handle_t
*
hsmbus
,
const
void
*
p_user_data
)
-
Set the user data pointer into the handle.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_user_data – Pointer to the user data.
-
-
const
void
*
HAL_SMBUS_GetUserData
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Get the user data pointer from the handle.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
Pointer – to the user data.
-
- group SMBUS_Exported_Functions_Group8
-
A set of functions allowing to manage a user data pointer stored to the SMBUS handle:
-
HAL_SMBUS_SetUserData() Set the user data into the handle
-
HAL_SMBUS_GetUserData() Get the user data from the handle
Functions
-
void
HAL_SMBUS_SetUserData
(
hal_smbus_handle_t
*
hsmbus
,
const
void
*
p_user_data
)
-
Set the user data pointer into the handle.
- Parameters :
-
-
hsmbus – Pointer to a hal_smbus_handle_t
-
p_user_data – Pointer to the user data.
-
-
const
void
*
HAL_SMBUS_GetUserData
(
const
hal_smbus_handle_t
*
hsmbus
)
-
Get the user data pointer from the handle.
- Parameters :
-
hsmbus – Pointer to a hal_smbus_handle_t
- Return values :
-
Pointer – to the user data.
-