Nordic Semiconductor nRF5 AirFuel SDK  version 2.2.0
ptu_hal_evkit.c
Go to the documentation of this file.
1 /* Copyright (c) Nordic Semiconductor. All Rights Reserved.
2  *
3  * The information contained herein is property of Nordic Semiconductor ASA.
4  * Terms and conditions of usage are described in detail in NORDIC
5  * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
6  *
7  * Licensees are granted free, non-transferable use of the information. NO
8  * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
9  * the file.
10  *
11  */
12 
13 
17 #include <stdbool.h>
18 #include <stdint.h>
19 #include <string.h>
20 
21 #include "ptu_hw_config.h"
22 #include "nrf_error.h"
23 #include "nrf_assert.h"
24 
25 
26 /******************************************************************************/
29 /******************************************************************************/
30 
31 static volatile uint16_t m_itx;
32 static volatile uint16_t m_vtx;
33 static volatile uint16_t m_temp;
34 static volatile uint16_t m_poweramp_level;
35 static volatile bool m_poweramp_enable;
39 /******************************************************************************/
42 /******************************************************************************/
43 
44 uint32_t ptu_hal_init(void)
45 {
50  m_poweramp_enable = false;
51 
52  return NRF_SUCCESS;
53 }
54 
55 uint32_t ptu_hal_poweramp_enable_set(bool enable)
56 {
57  m_poweramp_enable = enable;
58  return NRF_SUCCESS;
59 }
60 
61 uint32_t ptu_hal_poweramp_enable_get(bool * enable)
62 {
63  if (enable == NULL)
64  return NRF_ERROR_INVALID_PARAM;
65  *enable = m_poweramp_enable;
66  return NRF_SUCCESS;
67 }
68 
69 uint32_t ptu_hal_poweramp_level_set(uint16_t level)
70 {
71  m_poweramp_level = level;
72  return NRF_SUCCESS;
73 }
74 
75 uint32_t ptu_hal_poweramp_level_get(uint16_t * level)
76 {
77  if (level == NULL)
78  return NRF_ERROR_INVALID_PARAM;
79  *level = m_poweramp_level;
80  return NRF_SUCCESS;
81 }
82 
83 uint32_t ptu_hal_itx_get(uint16_t * p_itx)
84 {
85  if (p_itx == NULL)
86  return NRF_ERROR_INVALID_PARAM;
87  *p_itx = m_itx;
88  return NRF_SUCCESS;
89 }
90 
91 uint32_t ptu_hal_vtx_get(uint16_t * p_vtx)
92 {
93  if (p_vtx == NULL)
94  return NRF_ERROR_INVALID_PARAM;
95  *p_vtx = m_vtx;
96  return NRF_SUCCESS;
97 }
98 
99 uint32_t ptu_hal_ptx_get(uint16_t * p_ptx)
100 {
101  if (p_ptx == NULL)
102  return NRF_ERROR_INVALID_PARAM;
103  *p_ptx = m_vtx * m_itx;
104  return NRF_SUCCESS;
105 }
106 
107 uint32_t ptu_hal_temperature_get(int16_t * p_temperature)
108 {
109  if (p_temperature == NULL)
110  return NRF_ERROR_INVALID_PARAM;
111  *p_temperature = m_temp;
112  return NRF_SUCCESS;
113 }
static volatile uint16_t m_temp
Definition: ptu_hal_evkit.c:33
uint32_t ptu_hal_temperature_get(int16_t *p_temperature)
Read the board temperature.
static volatile uint16_t m_itx
Definition: ptu_hal_evkit.c:31
uint32_t ptu_hal_poweramp_level_get(uint16_t *level)
Get output level setting of power amplifier.
Definition: ptu_hal_evkit.c:75
static volatile uint16_t m_poweramp_level
Definition: ptu_hal_evkit.c:34
uint32_t ptu_hal_vtx_get(uint16_t *p_vtx)
Read resonator voltage.
Definition: ptu_hal_evkit.c:91
uint32_t ptu_hal_poweramp_enable_set(bool enable)
Enable power amplifier output (resonator power on).
Definition: ptu_hal_evkit.c:55
static volatile uint16_t m_vtx
Definition: ptu_hal_evkit.c:32
#define PTU_VTX_DEFAULT
#define PTU_POWERAMP_INPUT_DEFAULT
uint32_t ptu_hal_ptx_get(uint16_t *p_ptx)
Read resonator voltage.
Definition: ptu_hal_evkit.c:99
uint32_t ptu_hal_poweramp_enable_get(bool *enable)
Get status of power amplifier output enable (resonator power on).
Definition: ptu_hal_evkit.c:61
uint32_t ptu_hal_init(void)
Initialize the PTU's Hardware abstraction layer.
Definition: ptu_hal_evkit.c:44
uint32_t ptu_hal_poweramp_level_set(uint16_t level)
Set output level of power amplifier (resonator power).
Definition: ptu_hal_evkit.c:69
#define PTU_TEMPERATUR_DEFAULT
uint32_t ptu_hal_itx_get(uint16_t *p_itx)
Read the value of ITX.
Definition: ptu_hal_evkit.c:83
static volatile bool m_poweramp_enable
Definition: ptu_hal_evkit.c:35
#define PTU_ITX_DEFAULT