#ifndef NRFX_TEMP_H__ #define NRFX_TEMP_H__ #include #include #include "nrf_temp.h" #ifdef __cplusplus extern "C" { #endif /** * @brief Macro for setting @ref nrfx_temp_config_t to default settings. */ #define NRFX_TEMP_DEFAULT_CONFIG \ { \ .interrupt_priority = NRFX_TEMP_CONFIG_IRQ_PRIORITY \ } /** * @brief temperature measurement Driver event types. */ typedef enum { NRFX_TEMP_EVT_NULL, NRFX_TEMP_EVT_DATARDY ///< Event generated when the buffer is filled with samples. } nrfx_temp_evt_type_t; /** * @brief temperature measurement converter driver event structure. */ typedef struct { nrfx_temp_evt_type_t type; ///< Event type. int32_t data; } nrfx_temp_evt_t; /** * @brief TEMP event handler. * * @param[in] p_event Pointer to an TEMP event. The event structure is allocated on * the stack, so it is valid only within the context of * the event handler. */ typedef void (* nrfx_temp_event_handler_t)(nrfx_temp_evt_t const * p_event); /** * @brief temperature measurement converter driver configuration structure. */ typedef struct { uint8_t interrupt_priority; ///< Interrupt priority. } nrfx_temp_config_t; /** @brief TEMP control block.*/ typedef struct { nrfx_temp_event_handler_t event_handler; ///< Event handler function pointer. nrfx_drv_state_t state; ///< Driver initialization state. int32_t *data; } nrfx_temp_cb_t; /** * @brief Function for initializing the TEMP. * * @param[in] p_config Pointer to the structure with initial configuration. * @param[in] event_handler Event handler provided by the user. * Must not be NULL. * * @retval NRFX_SUCCESS If initialization was successful. * @retval NRFX_ERROR_INVALID_STATE If the driver is already initialized. */ nrfx_err_t nrfx_temp_init(nrfx_temp_config_t const * p_config, nrfx_temp_event_handler_t event_handler); /** * @brief Function for uninitializing the TEMP. * * This function stops all ongoing conversions and disables all channels. */ void nrfx_temp_uninit(void); /** * @brief Function for start the TEMP. * * */ nrfx_err_t nrfx_temp_start(void); /** * @brief Function for stop the TEMP. * * */ nrfx_err_t nrfx_temp_stop(void); extern float temp_value; #ifdef __cplusplus } #endif #endif // NRFX_TEMP_H__ /** @} */