| Nordic Thingy:52 v2.0.0

sx150x_led_drv_calc.h
1 /*
2 Copyright (c) 2010 - 2017, Nordic Semiconductor ASA
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without modification,
6 are permitted provided that the following conditions are met:
7
8 1. Redistributions of source code must retain the above copyright notice, this
9 list of conditions and the following disclaimer.
10
11 2. Redistributions in binary form, except as embedded into a Nordic
12 Semiconductor ASA integrated circuit in a product or a software update for
13 such product, must reproduce the above copyright notice, this list of
14 conditions and the following disclaimer in the documentation and/or other
15 materials provided with the distribution.
16
17 3. Neither the name of Nordic Semiconductor ASA 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 4. This software, with or without modification, must only be used with a
22 Nordic Semiconductor ASA integrated circuit.
23
24 5. Any software provided in binary form under this license must not be reverse
25 engineered, decompiled, modified and/or disassembled.
26
27 THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
28 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
29 OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
30 DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
31 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
33 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
36 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 */
38
48 #ifndef __SX150X_LED_DRV_CALC_H__
49 #define __SX150X_LED_DRV_CALC_H__
50
51 #include "sx150x_led_drv_calc.h"
52 #include "sx150x_led_drv_regs.h"
53 #include "sdk_errors.h"
54 #include <stdint.h>
55 #include <stdbool.h>
56
59 enum
60 {
61 SX150x_LED_DRC_CALC_STATUS_CODE_SUCCESS,
62 SX150x_LED_DRV_CALC_STATUS_CODE_INACCURATE,
63 SX150x_LED_DRV_CALC_STATUS_CODE_INVALID_PARAM,
64 SX150x_LED_DRV_CALC_STATUS_CODE_NULL,
65 SX150x_LED_DRV_CALC_STATUS_CODE_NOT_INIT,
66 };
67
68
78 bool sx150x_led_drv_calc_fade_supp(uint16_t port_mask);
79
80
93 ret_code_t sx150x_led_drv_calc_convert(uint16_t port_mask, drv_ext_light_sequence_t * const real_vals,
94 sx150x_led_drv_regs_vals_t * const reg_vals);
95
102 void sx150x_led_drv_calc_init(uint16_t fade_supported_port_mask, uint32_t clkx_tics_pr_sec);
103
104 #endif
105
SX150x_LED_DRV_CALC_STATUS_CODE_INACCURATE
One or more of the set time parameters deviate by more than 20 %. Accept or try again with different ...
Definition: sx150x_led_drv_calc.h:62
SX150x_LED_DRV_CALC_STATUS_CODE_NULL
NULL parameter supplied.
Definition: sx150x_led_drv_calc.h:64
SX150x_LED_DRV_CALC_STATUS_CODE_INVALID_PARAM
Invalid parameters.
Definition: sx150x_led_drv_calc.h:63
sx150x_led_drv_regs_vals_t
Struct for holding values to be placed in io extender led driver registers. Consult the SX150x manual...
Definition: sx150x_led_drv_regs.h:67
sx150x_led_drv_calc_init
void sx150x_led_drv_calc_init(uint16_t fade_supported_port_mask, uint32_t clkx_tics_pr_sec)
Initializes the SX150x led driver register calculation module.
sx150x_led_drv_calc_fade_supp
bool sx150x_led_drv_calc_fade_supp(uint16_t port_mask)
Checks if all the supplied pins in port_mask supports fade.
sx150x_led_drv_calc_convert
ret_code_t sx150x_led_drv_calc_convert(uint16_t port_mask, drv_ext_light_sequence_t *const real_vals, sx150x_led_drv_regs_vals_t *const reg_vals)
Converts from real values (intensity (0x00-0xFF and time in milliseconds) to register values...
SX150x_LED_DRV_CALC_STATUS_CODE_NOT_INIT
The module has not been initalized. Has init been called?
Definition: sx150x_led_drv_calc.h:65
SX150x_LED_DRC_CALC_STATUS_CODE_SUCCESS
Successful.
Definition: sx150x_led_drv_calc.h:61