-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
projects: max25603 : Add MAX25603 project files
Add initial header and source files alongside Makefiles for MAX25603 device project. Signed-off-by: Radu Sabau <[email protected]>
- Loading branch information
1 parent
bdc6add
commit 841e8da
Showing
13 changed files
with
558 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
include ../../tools/scripts/generic_variables.mk | ||
|
||
include src.mk | ||
|
||
include ../../tools/scripts/generic.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"maxim": { | ||
"basic_example_max32690": { | ||
"flags" : "TARGET=max32690" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
include $(PROJECT)/src/platform/$(PLATFORM)/platform_src.mk | ||
include $(PROJECT)/src/examples/examples_src.mk | ||
|
||
SRCS += $(PROJECT)/src/platform/$(PLATFORM)/main.c | ||
|
||
INCS += $(PROJECT)/src/common/common_data.h | ||
SRCS += $(PROJECT)/src/common/common_data.c | ||
|
||
INCS += $(PROJECT)/src/platform/platform_includes.h | ||
|
||
INCS += $(PROJECT)/src/platform/$(PLATFORM)/parameters.h | ||
SRCS += $(PROJECT)/src/platform/$(PLATFORM)/parameters.c | ||
|
||
INCS += $(INCLUDE)/no_os_delay.h \ | ||
$(INCLUDE)/no_os_error.h \ | ||
$(INCLUDE)/no_os_gpio.h \ | ||
$(INCLUDE)/no_os_print_log.h \ | ||
$(INCLUDE)/no_os_alloc.h \ | ||
$(INCLUDE)/no_os_irq.h \ | ||
$(INCLUDE)/no_os_list.h \ | ||
$(INCLUDE)/no_os_dma.h \ | ||
$(INCLUDE)/no_os_uart.h \ | ||
$(INCLUDE)/no_os_lf256fifo.h \ | ||
$(INCLUDE)/no_os_util.h \ | ||
$(INCLUDE)/no_os_units.h \ | ||
$(INCLUDE)/no_os_pwm.h \ | ||
$(INCLUDE)/no_os_mutex.h | ||
|
||
SRCS += $(DRIVERS)/api/no_os_gpio.c \ | ||
$(NO-OS)/util/no_os_lf256fifo.c \ | ||
$(DRIVERS)/api/no_os_irq.c \ | ||
$(DRIVERS)/api/no_os_uart.c \ | ||
$(DRIVERS)/api/no_os_dma.c \ | ||
$(DRIVERS)/api/no_os_pwm.c \ | ||
$(NO-OS)/util/no_os_list.c \ | ||
$(NO-OS)/util/no_os_util.c \ | ||
$(NO-OS)/util/no_os_alloc.c \ | ||
$(NO-OS)/util/no_os_mutex.c | ||
|
||
INCS += $(DRIVERS)/led/max25603/max25603.h | ||
SRCS += $(DRIVERS)/led/max25603/max25603.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/***************************************************************************//** | ||
* @file common_data.c | ||
* @brief Common data used by the MAX25603 project. | ||
* @author Radu Sabau ([email protected]) | ||
******************************************************************************** | ||
* Copyright 2024(c) Analog Devices, Inc. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* 3. Neither the name of Analog Devices, Inc. nor the names of its | ||
* contributors may be used to endorse or promote products derived from this | ||
* software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR | ||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
* EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | ||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*******************************************************************************/ | ||
#include "common_data.h" | ||
|
||
|
||
struct no_os_uart_init_param max25603_uart_ip = { | ||
.device_id = UART_DEVICE_ID, | ||
.baud_rate = UART_BAUDRATE, | ||
.size = NO_OS_UART_CS_8, | ||
.platform_ops = UART_OPS, | ||
.parity = NO_OS_UART_PAR_NO, | ||
.stop = NO_OS_UART_STOP_1_BIT, | ||
.extra = UART_EXTRA, | ||
}; | ||
|
||
struct no_os_gpio_init_param max25603_shunt_ip = { | ||
.port = GPIO_SHUNT_PORT_NUM, | ||
.pull = NO_OS_PULL_NONE, | ||
.number = GPIO_SHUNT_PIN_NUM, | ||
.platform_ops = GPIO_OPS, | ||
.extra = GPIO_EXTRA, | ||
}; | ||
|
||
struct no_os_pwm_init_param max25603_en1_ip = { | ||
.id = PWM_EN1_ID, | ||
.period_ns = PWM_EN1_PERIOD_NS, | ||
.duty_cycle_ns = PWM_EN1_DUTY_NS, | ||
.polarity = NO_OS_PWM_POLARITY_HIGH, | ||
.platform_ops = PWM_OPS, | ||
.extra = PWM_EXTRA, | ||
}; | ||
|
||
struct no_os_pwm_init_param max25603_en2_ip = { | ||
.id = PWM_EN2_ID, | ||
.period_ns = PWM_EN2_PERIOD_NS, | ||
.duty_cycle_ns = PWM_EN2_DUTY_NS, | ||
.polarity = NO_OS_PWM_POLARITY_HIGH, | ||
.platform_ops = PWM_OPS, | ||
.extra = PWM_EXTRA, | ||
}; | ||
|
||
struct no_os_pwm_init_param max25603_hb_ip = { | ||
.id = PWM_HB_ID, | ||
.period_ns = PWM_HB_PERIOD_NS, | ||
.duty_cycle_ns = PWM_HB_DUTY_NS, | ||
.polarity = NO_OS_PWM_POLARITY_HIGH, | ||
.platform_ops = PWM_OPS, | ||
.extra = PWM_EXTRA, | ||
}; | ||
|
||
struct no_os_pwm_init_param max25603_lb_ip = { | ||
.id = PWM_LB_ID, | ||
.period_ns = PWM_LB_PERIOD_NS, | ||
.duty_cycle_ns = PWM_LB_DUTY_NS, | ||
.polarity = NO_OS_PWM_POLARITY_HIGH, | ||
.platform_ops = PWM_OPS, | ||
.extra = PWM_EXTRA, | ||
}; | ||
|
||
struct max25603_init_param max25603_ip = { | ||
.en1_param = &max25603_en1_ip, | ||
.en2_param = &max25603_en2_ip, | ||
.flt_param = NULL, | ||
.hb_param = &max25603_hb_ip, | ||
.lb_param = &max25603_lb_ip, | ||
.shunt_param = &max25603_shunt_ip, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/***************************************************************************//** | ||
* @file common_data.h | ||
* @brief Common data used by the MAX25603 project. | ||
* @author Radu Sabau ([email protected]) | ||
******************************************************************************** | ||
* Copyright 2024(c) Analog Devices, Inc. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* 3. Neither the name of Analog Devices, Inc. nor the names of its | ||
* contributors may be used to endorse or promote products derived from this | ||
* software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR | ||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
* EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | ||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*******************************************************************************/ | ||
#ifndef __COMMON_DATA_H__ | ||
#define __COMMON_DATA_H__ | ||
|
||
#include "platform_includes.h" | ||
#include "max25603.h" | ||
|
||
extern struct no_os_uart_init_param max25603_uart_ip; | ||
extern struct no_os_gpio_init_param max25603_shunt_ip; | ||
extern struct no_os_gpio_init_param max25603_flt_ip; | ||
extern struct no_os_pwm_init_param max25603_en1_ip; | ||
extern struct no_os_pwm_init_param max25603_en2_ip; | ||
extern struct no_os_pwm_init_param max25603_hb_ip; | ||
extern struct no_os_pwm_init_param max25603_lb_ip; | ||
extern struct max25603_init_param max25603_ip; | ||
|
||
#endif /* __COMMON_DATA_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/***************************************************************************//** | ||
* @file basic_example.c | ||
* @brief Source file for basic example. | ||
* @author Radu Sabau ([email protected]) | ||
******************************************************************************** | ||
* Copyright 2024(c) Analog Devices, Inc. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* 3. Neither the name of Analog Devices, Inc. nor the names of its | ||
* contributors may be used to endorse or promote products derived from this | ||
* software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR | ||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
* EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | ||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*******************************************************************************/ | ||
#include "basic_example.h" | ||
#include "common_data.h" | ||
#include "max25603.h" | ||
#include "no_os_delay.h" | ||
#include "no_os_print_log.h" | ||
#include "no_os_irq.h" | ||
|
||
int basic_example_main() | ||
{ | ||
struct max25603_desc *max25603_desc; | ||
int ret; | ||
|
||
ret = max25603_init(&max25603_desc, &max25603_ip); | ||
if (ret) | ||
goto exit; | ||
|
||
ret = max25603_sel_comp(max25603_desc, MAX25603_COMP1); | ||
if (ret) | ||
goto remove_max25603; | ||
|
||
ret = max25603_set_enable(max25603_desc, MAX25603_EN2, 100000, 100); | ||
if (ret) | ||
goto remove_max25603; | ||
|
||
ret = max25603_set_beam(max25603_desc, MAX25603_LOW_BEAM, 50, 50); | ||
if (ret) | ||
goto remove_max25603; | ||
|
||
no_os_mdelay(5000); | ||
|
||
ret = max25603_set_beam(max25603_desc, MAX25603_DISABLE_BEAM, 0, 0); | ||
if (ret) | ||
goto remove_max25603; | ||
|
||
ret = max25603_set_enable(max25603_desc, MAX25603_DISABLE_EN, 0, 0); | ||
if (ret) | ||
goto remove_max25603; | ||
|
||
remove_max25603: | ||
max25603_remove(max25603_desc); | ||
exit: | ||
if (ret) | ||
pr_info("Error!\n"); | ||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/***************************************************************************//** | ||
* @file basic_example.h | ||
* @brief Header file for basic example. | ||
* @author Radu Sabau ([email protected]) | ||
******************************************************************************** | ||
* Copyright 2024(c) Analog Devices, Inc. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* 3. Neither the name of Analog Devices, Inc. nor the names of its | ||
* contributors may be used to endorse or promote products derived from this | ||
* software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR | ||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
* EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | ||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*******************************************************************************/ | ||
#ifndef __BASIC_EXAMPLE_H__ | ||
#define __BASIC_EXAMPLE_H__ | ||
|
||
int basic_example_main(); | ||
|
||
#endif /* __BASIC_EXAMPLE_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
SRCS += $(PROJECT)/src/examples/basic/basic_example.c | ||
INCS += $(PROJECT)/src/examples/basic/basic_example.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/***************************************************************************//** | ||
* @file main.c | ||
* @brief Main file for Maxim platform of MAX25603 project. | ||
* @author Radu Sabau ([email protected]) | ||
******************************************************************************** | ||
* Copyright 2024(c) Analog Devices, Inc. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* 3. Neither the name of Analog Devices, Inc. nor the names of its | ||
* contributors may be used to endorse or promote products derived from this | ||
* software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR | ||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
* EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | ||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*******************************************************************************/ | ||
#include "platform_includes.h" | ||
#include "common_data.h" | ||
#include "no_os_error.h" | ||
#include "basic_example.h" | ||
|
||
int main() | ||
{ | ||
int ret = -EINVAL; | ||
|
||
struct no_os_uart_desc *uart_desc; | ||
|
||
ret = no_os_uart_init(&uart_desc, &max25603_uart_ip); | ||
if (ret) | ||
return ret; | ||
|
||
no_os_uart_stdio(uart_desc); | ||
|
||
ret = basic_example_main(); | ||
|
||
no_os_uart_remove(uart_desc); | ||
|
||
return ret; | ||
} |
Oops, something went wrong.