Skip to content

Commit ae57393

Browse files
committed
npmx 0.6.0 release
Signed-off-by: Marcin Szymczyk <marcin.szymczyk@nordicsemi.no>
1 parent f15d9bf commit ae57393

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+20928
-0
lines changed

CHANGELOG.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# Changelog
2+
All notable changes to this project are documented in this file.
3+
4+
## [0.6.0] - 2023-05-11
5+
### Added
6+
- Added functions that convert enumerations to integers.
7+
- Added functions that convert enumerations to strings.
8+
- Added `npmx_ship_time_convert` function.
9+
- Added `npmx_adc_ntc_type_convert`, `npmx_adc_ntc_meas_interval_convert` and `npmx_adc_die_temp_meas_interval_convert` functions.
10+
- Added `npmx_timer_status_t` structure.
11+
12+
### Changed
13+
- Renamed `NPMX_TIMER_PESCALER_SLOW` to `NPMX_TIMER_PRESCALER_SLOW`.
14+
- Renamed `NPMX_TIMER_PESCALER_FAST` to `NPMX_TIMER_PRESCALER_FAST`.
15+
- Renamed `npmx_adc_all_meas_t` to `npmx_adc_meas_all_t`.
16+
- Renamed `npmx_adc_battery_ntc_type_t` to `npmx_adc_ntc_type_t`.
17+
- Renamed `npmx_adc_auto_meas_inverval_*_{set, get}` to `npmx_adc_*_meas_interval_{set, get}`.
18+
- Renamed `npmx_charger_termination_voltage_{normal, warm}_{set, get}` to `npmx_charger_termination_{normal, warm}_voltage_{set, get}`.
19+
- Renamed `npmx_charger_trickle_{set, get}` to `npmx_charger_trickle_voltage_{set, get}`.
20+
- Renamed `NPMX_EVENT_GROUP_VBUSIN_OVRVOLT_DETECTED_MASK` to `NPMX_EVENT_GROUP_VBUSIN_OVERVOLT_DETECTED_MASK`.
21+
- Renamed `NPMX_EVENT_GROUP_THERMAL_SHDN_{DETECTED, REMOVED}_MASK` to `NPMX_EVENT_GROUP_THERMAL_SHUTDOWN_{DETECTED, REMOVED}_MASK`.
22+
- Renamed `NPMX_GPIO_NO_PULL` to `NPMX_GPIO_PULL_NONE`.
23+
- Renamed `npmx_gpio_config_t` member `pull_state` to `pull`.
24+
- Renamed `npmx_gpio_config_t` members: `open_drain_enable` to `open_drain`, `debounce_enable` to `debounce`.
25+
- Renamed `NPMX_LDSW_STATUS_LDSW_EN_MASK` to `NPMX_LDSW_STATUS_DEEPSLEEP_MASK`.
26+
- Renamed `NPMX_LDSW_STATUS_PWUP_{LDO, LDSW}_{1, 2}_MASK` to `NPMX_LDSW_STATUS_POWERUP_{LDO, LDSW}_{1, 2}_MASK`.
27+
- Reworked `npmx_ship_gpio_status_check` to return boolean instead of `npmx_ship_button_t` enumeration.
28+
- Reworked `npmx_timer_status_get` to return `npmx_timer_status_t` structure.
29+
30+
### Fixed
31+
- Fixed an issue in `npmx_ldsw_mode_get` that caused an incorrect mode to be returned.
32+
- Multiple documentation fixes.
33+
- Multiple formatting fixes.
34+
35+
### Removed
36+
- Removed `npmx_ship_button_t` enumeration.
37+
- Removed `npmx_timer_boot_monitor_t` enumeration.
38+
- Removed `npmx_timer_slow_domain_t` enumeration.
39+
40+
## [0.5.0] - 2023-04-21
41+
### Fixed
42+
- Fixed an issue in MDK where reserved registers were using the `uint32_t` type. All registers are using the `uint8_t` type now.
43+
- Fixed an issue in MDK where POF polarity had incorrect values for nPM1300 Engineering B.
44+
45+
### Removed
46+
- Removed the long press string for the SHIPHOLD event for nPM1300 Engineering B.
47+
48+
## [0.4.0] - 2023-04-19
49+
### Added
50+
- Added the `npmx_charger_iterm_convert` function.
51+
52+
### Fixed
53+
- Fixed values for the `*_INVALID` enumerators.
54+
55+
## [0.3.1] - 2023-03-08
56+
### Fixed
57+
- Fixed a calculation code error in `vbus_value_from_code`.
58+
- Fixed the charger error handling procedure. `NPMX_CHARGER_TASK_RELEASE` is now triggered when an error is detected.
59+
60+
## [0.3.0] - 2023-02-08
61+
### Added
62+
- Added conversion functions for enumerations.
63+
- Added assertions and `NPMX_CHECK` macro.
64+
- Added user-defined context data to npmx_instance. `npmx_core_context_set` and `npmx_core_context_get` can be used to modify it.
65+
- Added the `npmx_adc_meas_check` function.
66+
- Added enumerations for invalid values.
67+
68+
### Changed
69+
- Reworked ADC driver not to use NTC resistance stored on host side.
70+
71+
### Fixed
72+
- Fixed MAX and DEFAULT enum values.
73+
- Fixed: casting errors, division by 0, wrong read functions.
74+
- Fixed multiple minor issues.
75+
76+
## [0.2.0] - 2022-10-20
77+
### Added
78+
- Added new drivers:
79+
- ERRLOG,
80+
- SHIP,
81+
- VBUSIN.
82+
- Added missing functionality in the following drivers:
83+
- ADC,
84+
- BUCK,
85+
- CHARGER,
86+
- CORE,
87+
- GPIO,
88+
- LDSW,
89+
- LED,
90+
- POF,
91+
- TIMER.
92+
- Extended npmx instance structure to contain device-specific instance structures.
93+
94+
### Changed
95+
- npmx API now returns npmx_error_t enumeration instead of bool.
96+
- Minor code alignments in all drivers.
97+
98+
### Fixed
99+
- Initialization order in npmx_core.
100+
101+
## [0.1.0] - 2022-09-09
102+
### Added
103+
- Added CHANGELOG.md file.
104+
- Added README.md file.
105+
- Added new drivers:
106+
- ADC,
107+
- BUCK,
108+
- CHARGER,
109+
- COMMON,
110+
- CORE,
111+
- EVENT,
112+
- GPIO,
113+
- LDSW,
114+
- LED,
115+
- POF,
116+
- TIMER.
117+
- Added template integration files.

LICENSE

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Copyright (c) 2022 - 2023, Nordic Semiconductor ASA
2+
All rights reserved.
3+
4+
SPDX-License-Identifier: BSD-3-Clause
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
1. Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
2. Redistributions in binary form must reproduce the above copyright
13+
notice, this list of conditions and the following disclaimer in the
14+
documentation and/or other materials provided with the distribution.
15+
16+
3. Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from this
18+
software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30+
POSSIBILITY OF SUCH DAMAGE.
31+

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# npmx
2+
## Overview
3+
npmx is a set of drivers for peripherals present in Nordic Semiconductor's Power Management ICs (PMICs).
4+
5+
For the user's convenience, the drivers come with the MDK package. This package contains definitions of register structures and bitfields for PMICs.
6+
7+
## Supported devices
8+
9+
* nPM1300 Engineering B
10+
11+
## Directories
12+
```
13+
.
14+
├── backends # npmx backend files
15+
├── doc # Project documentation files
16+
├── drivers # npmx driver files
17+
│ ├── include # npmx driver headers
18+
│ └── src # npmx driver sources
19+
├── mdk # nPM MDK files
20+
├── templates # Templates of npmx integration files
21+
└── zephyr # Zephyr integration files
22+
```

backends/npmx_backend.h

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
/*
2+
* Copyright (c) 2022 - 2023, Nordic Semiconductor ASA
3+
* All rights reserved.
4+
*
5+
* SPDX-License-Identifier: BSD-3-Clause
6+
*
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* 1. Redistributions of source code must retain the above copyright notice, this
11+
* list of conditions and the following disclaimer.
12+
*
13+
* 2. Redistributions in binary form must reproduce the above copyright
14+
* notice, this list of conditions and the following disclaimer in the
15+
* documentation and/or other materials provided with the distribution.
16+
*
17+
* 3. Neither the name of the copyright holder nor the names of its
18+
* contributors may be used to endorse or promote products derived from this
19+
* software without specific prior written permission.
20+
*
21+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31+
* POSSIBILITY OF SUCH DAMAGE.
32+
*/
33+
34+
#ifndef NPMX_BACKEND_H__
35+
#define NPMX_BACKEND_H__
36+
37+
#include <stdint.h>
38+
#include <npmx_error.h>
39+
40+
#ifdef __cplusplus
41+
extern "C" {
42+
#endif
43+
44+
/** @brief Struct for backend handler and device address. */
45+
typedef struct
46+
{
47+
uint16_t address; ///< nPM device address (for example, I2C address).
48+
void * p_backend; ///< Pointer to nPM backend handler.
49+
} npmx_backend_instance_t;
50+
51+
/**
52+
* @brief Init function for the chosen transport backend.
53+
*
54+
* @param[in] p_inst Pointer to backend instance.
55+
* @param[in] p_backend Pointer to backend.
56+
* @param[in] dev_address Device address.
57+
*/
58+
void npmx_backend_init(npmx_backend_instance_t * const p_inst,
59+
void * p_backend,
60+
uint16_t dev_address);
61+
62+
/**
63+
* @brief Function for sending a message over the chosen transport backend.
64+
*
65+
* This function is used by services to write to npmx registers.
66+
*
67+
* @param[in] p_inst Pointer to the backend instance.
68+
* @param[in] register_address Register address in npmx device to be modified.
69+
* @param[in] p_data Pointer to data to write.
70+
* @param[in] num_of_bytes Number of bytes of data to write.
71+
*
72+
* @return NPMX_SUCCESS All data written successfully.
73+
* @return NPMX_ERROR_IO Backend returned IO error during data writing.
74+
*/
75+
npmx_error_t npmx_backend_register_write(npmx_backend_instance_t const * p_inst,
76+
uint16_t register_address,
77+
uint8_t * p_data,
78+
size_t num_of_bytes);
79+
80+
/**
81+
* @brief Function for reading a message over the chosen transport backend.
82+
*
83+
* This function is used by services to read npmx registers.
84+
*
85+
* @param[in] p_inst Pointer to the backend instance.
86+
* @param[in] register_address Register address in npmx device to be read.
87+
* @param[in] p_data Pointer to buffer for read data.
88+
* @param[in] num_of_bytes Number of bytes to read.
89+
*
90+
* @return NPMX_SUCCESS All data read successfully.
91+
* @return NPMX_ERROR_IO Backend returned IO error during data reading.
92+
*/
93+
npmx_error_t npmx_backend_register_read(npmx_backend_instance_t const * p_inst,
94+
uint16_t register_address,
95+
uint8_t * p_data,
96+
size_t num_of_bytes);
97+
98+
#ifdef __cplusplus
99+
}
100+
#endif
101+
102+
#endif // NPMX_BACKEND_H__

backends/npmx_backend_twim.c

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright (c) 2022 - 2023, Nordic Semiconductor ASA
3+
* All rights reserved.
4+
*
5+
* SPDX-License-Identifier: BSD-3-Clause
6+
*
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* 1. Redistributions of source code must retain the above copyright notice, this
11+
* list of conditions and the following disclaimer.
12+
*
13+
* 2. Redistributions in binary form must reproduce the above copyright
14+
* notice, this list of conditions and the following disclaimer in the
15+
* documentation and/or other materials provided with the distribution.
16+
*
17+
* 3. Neither the name of the copyright holder nor the names of its
18+
* contributors may be used to endorse or promote products derived from this
19+
* software without specific prior written permission.
20+
*
21+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31+
* POSSIBILITY OF SUCH DAMAGE.
32+
*/
33+
34+
#include <npmx.h>
35+
36+
void npmx_backend_init(npmx_backend_instance_t * const p_inst,
37+
void * p_backend,
38+
uint16_t dev_address)
39+
{
40+
NPMX_ASSERT(p_inst);
41+
NPMX_ASSERT(p_backend);
42+
43+
p_inst->p_backend = p_backend;
44+
p_inst->address = dev_address;
45+
}
46+
47+
npmx_error_t npmx_backend_register_write(npmx_backend_instance_t const * p_inst,
48+
uint16_t register_address,
49+
uint8_t * p_data,
50+
size_t num_of_bytes)
51+
{
52+
return npmx_backend_i2c_write(p_inst, register_address, p_data, num_of_bytes);
53+
}
54+
55+
npmx_error_t npmx_backend_register_read(npmx_backend_instance_t const * p_inst,
56+
uint16_t register_address,
57+
uint8_t * p_data,
58+
size_t num_of_bytes)
59+
{
60+
return npmx_backend_i2c_read(p_inst, register_address, p_data, num_of_bytes);
61+
}

doc/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# npmx documentation
2+
3+
## Doxygen
4+
5+
You can generate `doxygen` based documentation by running from `doc`
6+
directory
7+
8+
```shell
9+
doxygen npmx.doxyfile
10+
```
11+
12+
You may want to use the provided scripts `generate_html_doc.sh` or
13+
`generate_html_doc.bat`. The result can be viewed by opening
14+
`html/index.html`.
26.1 KB
Loading
21.7 KB
Loading

0 commit comments

Comments
 (0)