ruuvi.drivers.c ${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
Loading...
Searching...
No Matches
ruuvi_interface_power_test.c
Go to the documentation of this file.
2#if RUUVI_RUN_TESTS
4#include "ruuvi_driver_test.h"
6#include <stdbool.h>
7
9 const ri_power_regulators_t regulators)
10{
11 bool status = false;
12 rd_status_t err_code = RD_SUCCESS;
13 printfp ("\"power\":{\r\n");
14
15 if (regulators.DCDC_INTERNAL)
16 {
17 printfp ("\"dcdc_internal\":");
18 ri_power_regulators_t test = {0};
19 test.DCDC_INTERNAL = 1;
20 err_code = ri_power_regulators_enable (test);
21
22 if (RD_SUCCESS == err_code)
23 {
24 printfp ("\"pass\"");
25 }
26 else
27 {
28 printfp ("\"fail\"");
29 status = true;
30 }
31
32 if (regulators.DCDC_HV)
33 {
34 printfp (",\r\n");
35 }
36 else
37 {
38 printfp ("\r\n");
39 }
40 }
41
42 if (regulators.DCDC_HV)
43 {
44 printfp ("\"dcdc_hv:\"{\r\n");
45 ri_power_regulators_t test = {0};
46 test.DCDC_HV = 1;
47 err_code = ri_power_regulators_enable (test);
48
49 if (RD_SUCCESS == err_code)
50 {
51 printfp ("\"pass\"\r\n");
52 }
53 else
54 {
55 printfp ("\"fail\"\r\n");
56 status = true;
57 }
58 }
59
60 ri_power_regulators_t test = {0};
61 err_code = ri_power_regulators_enable (test);
62 printfp ("},\r\n");
63 return (status || (RD_SUCCESS != err_code));
64}
65#endif
uint32_t rd_status_t
bitfield for representing errors
#define RD_SUCCESS
Internal Error.
bool ri_power_run_integration_test(const rd_test_print_fp printfp, const ri_power_regulators_t regulators)
Run all Power integration tests.
void(* rd_test_print_fp)(const char *const msg)
function pointer to print test information
Header to enable and disable module compilation.
Ruuvi error codes and error check function.
Functions for testing drivers.
rd_status_t ri_power_regulators_enable(const ri_power_regulators_t regulators)
Enable given regulators.
Enable implementation selected by application.
unsigned int DCDC_HV
DC/DC for high voltage, i.e. nRF52840 USB.
unsigned int DCDC_INTERNAL
DC/DC for internal circuitry, i.e. nRF52832 radio.