Skip to content

Commit

Permalink
Adding project support for ADP105x - ADP1051
Browse files Browse the repository at this point in the history
Signed-off-by: ivangilmercano <[email protected]>
  • Loading branch information
ivangilmercano committed Dec 2, 2024
1 parent fb69a66 commit 65fd151
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 22 deletions.
2 changes: 1 addition & 1 deletion drivers/power/adp1050/adp1050.c
Original file line number Diff line number Diff line change
Expand Up @@ -1350,4 +1350,4 @@ int adp1050_remove(struct adp1050_desc *desc)
no_os_free(desc);

return 0;
}
}
2 changes: 1 addition & 1 deletion projects/adp1050/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ include ../../tools/scripts/generic_variables.mk

include src.mk

include ../../tools/scripts/generic.mk
include ../../tools/scripts/generic.mk
4 changes: 2 additions & 2 deletions projects/adp1050/README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ADP1050 no-OS Example Project
=============================
Evaluating the ADP1050
======================

.. contents::
:depth: 3
Expand Down
1 change: 1 addition & 0 deletions projects/adp1050/src/common/common_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,5 @@ struct adp1050_init_param adp1050_ip = {
.flgi_param = NULL,
.syni_param = NULL,
.on_off_config = ADP1050_ON_OFF_DEFAULT_CFG,
.device_id = ID_ADP1051,
};
35 changes: 22 additions & 13 deletions projects/adp1050/src/examples/basic/basic_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ int basic_example_main()
uint8_t data = 120;
uint8_t data2[2];
uint16_t vout;

ret = adp1050_init(&adp1050_desc, &adp1050_ip);
if (ret)
goto exit;
Expand All @@ -62,60 +62,69 @@ int basic_example_main()
ADP1050_EEPROM_PASS);
if (ret)
goto exit;

ret = adp1050_unlock_pass(adp1050_desc, ADP1050_TRIM_DEFAULT_PASS,
ADP1050_TRIM_PASS);
if (ret)
goto exit;

ret = adp1050_set_close_loop(adp1050_desc);
if (ret)
goto exit;

ret = adp1050_vout_tr(adp1050_desc, ADP1050_VOUT_TR_200UV_US);
if (ret)
goto exit;

ret = adp1050_vout_scale(adp1050_desc, -12, 341);
if (ret)
goto exit;

ret = adp1050_vout_value(adp1050_desc, 0x3000, 0x5000);
if (ret)
goto exit;

ret = adp1050_pwm_duty_cycle(adp1050_desc, 0x00DE, 0x000E, ADP1050_OUTA);
if (ret)
goto exit;

ret = adp1050_set_pwm(adp1050_desc, ADP1050_OUTA, ADP1050_49KHZ);
if (ret)
goto exit;

ret = adp1050_read_value(adp1050_desc, &vout, &data, ADP1050_DUTY_CYCLE);
if (ret)
goto exit;

/* Checking statuses. */
ret = adp1050_read(adp1050_desc, ADP1050_STATUS_VOUT, &data, 1);
if (ret)
goto exit;

ret = adp1050_read(adp1050_desc, ADP1050_STATUS_INPUT, &data, 1);
if (ret)
goto exit;

ret = adp1050_read(adp1050_desc, ADP1050_STATUS_CML, &data, 1);
if (ret)
goto exit;

ret = adp1050_read(adp1050_desc, ADP1050_STATUS_WORD, data2, 2);
if (ret)
goto exit;

ret = adp1051_llm_dllm_comm_setting(adp1050_desc, ADP1051_82US_7B,
ADP1051_41US_6B_AVG, ADP1051_3LSB);
if (ret)
goto exit;

ret = adp1051_llm_dllm_setting(adp1050_desc, ADP1051_0MS, ADP1051_0mv, 1);
if (ret)
goto exit;

exit:
if (ret)
pr_info("Error!\n");
adp1050_remove(adp1050_desc);
return ret;
}
}
4 changes: 2 additions & 2 deletions projects/adp1050/src/examples/examples_src.mk
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
ifeq (y,$(strip $(IIO_EXAMPLE)))
IIOD=y
CFLAGS += -DIIO_EXAMPLE
CFLAGS += -DIIO_EXAMPLE=1
SRCS += $(PROJECT)/src/examples/iio_example/iio_example.c
INCS += $(PROJECT)/src/examples/iio_example/iio_example.h
endif

ifeq (y,$(strip $(BASIC_EXAMPLE)))
CFLAGS += -DBASIC_EXAMPLE
CFLAGS += -DBASIC_EXAMPLE=1
SRCS += $(PROJECT)/src/examples/basic/basic_example.c
INCS += $(PROJECT)/src/examples/basic/basic_example.h
endif
Expand Down
2 changes: 1 addition & 1 deletion projects/adp1050/src/platform/maxim/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ Please enable only one example and rebuild the project.
#endif

return ret;
}
}
4 changes: 2 additions & 2 deletions projects/adp1050/src/platform/maxim/parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
#define INTC_DEVICE_ID 0
#endif

#define UART_DEVICE_ID 0
#define UART_DEVICE_ID 2
#define UART_BAUDRATE 57600
#define UART_OPS &max_uart_ops
#define UART_EXTRA &adp1050_uart_extra

#define GPIO_PG_ALT_PORT 0
#define GPIO_PG_ALT_PIN 24
#define GPIO_PG_ALT_PIN 9
#define GPIO_OPS &max_gpio_ops
#define GPIO_EXTRA &adp1050_pg_alt_extra

Expand Down

0 comments on commit 65fd151

Please sign in to comment.