analogdevicesinc / no-OS

Software drivers in C for systems without an operating system
http://analogdevicesinc.github.io/no-OS/
Other
927 stars 1.65k forks source link

drivers: dac: max2201x : Add MAX2201X driver support #2110

Closed RaduSabau1 closed 6 months ago

RaduSabau1 commented 7 months ago

Pull Request Description

The MAX22017 is a two-channel industrial-grade configurable analog output device that can be changed on-the-fly in software to voltage or current output mode. The MAX22017 offers one 16-bit DAC per output channel. The MAX22017 can operate from an internal or external reference.

The first commit consists of main driver header and source files. The second commit consists of IIO driver header and source files. The third commit consists of driver's README.rst documentation file. The fourth commit consists of project related files. The fifth commit consists of project's README.rst documentation file.

PR Type

PR Checklist

RaduSabau1 commented 7 months ago

V2

RaduSabau1 commented 7 months ago

V3

RaduSabau1 commented 7 months ago

V4

RaduSabau1 commented 6 months ago

V5

RaduSabau1 commented 6 months ago

V6

RaduSabau1 commented 6 months ago

V7

RaduSabau1 commented 6 months ago

V8

rbolboac commented 6 months ago

you still have build warnings, please fix them

2024-03-25T10:53:24.2916931Z CC iio_max2201x.c
2024-03-25T10:53:24.3139448Z dac/max2201x/iio_max2201x.c: In function 'max2201x_iio_write_slew_rate':
2024-03-25T10:53:24.3144583Z dac/max2201x/iio_max2201x.c:504:12: warning: implicit declaration of function 'max2201x_iio_read_avail'; did you mean 'max2201x_iio_read_raw'? [-Wimplicit-function-declaration]
2024-03-25T10:53:24.3145907Z   504 |   enable = max2201x_iio_read_avail(max2201x_enable_avail, buf);
2024-03-25T10:53:24.3146629Z       |            ^~~~~~~~~~~~~~~~~~~~~~~
2024-03-25T10:53:24.3146877Z       |            max2201x_iio_read_raw
2024-03-25T10:53:24.3152005Z dac/max2201x/iio_max2201x.c:486:16: warning: unused variable 'i' [-Wunused-variable]
2024-03-25T10:53:24.3152533Z   486 |  uint32_t val, i;
2024-03-25T10:53:24.3152913Z       |                ^
2024-03-25T10:53:24.3162949Z dac/max2201x/iio_max2201x.c: In function 'max2201x_iio_read_step_size_available':
2024-03-25T10:53:24.3167447Z dac/max2201x/iio_max2201x.c:527:9: warning: implicit declaration of function 'max2201x_iio_read_avail_length'; did you mean 'max2201x_iio_read_offset'? [-Wimplicit-function-declaration]
2024-03-25T10:53:24.3168083Z   527 |  return max2201x_iio_read_avail_length(max2201x_step_size_avail, buf);
2024-03-25T10:53:24.3168694Z       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2024-03-25T10:53:24.3168917Z       |         max2201x_iio_read_offset
2024-03-25T10:53:24.3175695Z dac/max2201x/iio_max2201x.c: In function 'max2201x_iio_write_ao_config':
2024-03-25T10:53:24.3179561Z dac/max2201x/iio_max2201x.c:574:16: warning: unused variable 'i' [-Wunused-variable]
2024-03-25T10:53:24.3180091Z   574 |  uint32_t val, i;
2024-03-25T10:53:24.3180479Z       |                ^
2024-03-25T10:53:24.3188531Z CC max2201x.c
2024-03-25T10:53:24.3193821Z In file included from dac/max2201x/iio_max2201x.c:44:
2024-03-25T10:53:24.3194542Z dac/max2201x/iio_max2201x.c: In function 'max2201x_iio_read_avail':
2024-03-25T10:53:24.3200617Z ../include/no_os_util.h:54:13: warning: division 'sizeof (char *) / sizeof (char)' does not compute the number of array elements [-Wsizeof-pointer-div]
2024-03-25T10:53:24.3201206Z    54 |  (sizeof(x) / sizeof((x)[0]))
2024-03-25T10:53:24.3201697Z       |             ^
2024-03-25T10:53:24.3202232Z dac/max2201x/iio_max2201x.c:734:18: note: in expansion of macro 'NO_OS_ARRAY_SIZE'
2024-03-25T10:53:24.3202475Z   734 |  for (i = 0; i < NO_OS_ARRAY_SIZE(array_avail); i++)
2024-03-25T10:53:24.3202661Z       |                  ^~~~~~~~~~~~~~~~
2024-03-25T10:53:24.3207579Z dac/max2201x/iio_max2201x.c:730:35: note: first 'sizeof' operand was declared here
2024-03-25T10:53:24.3208061Z   730 | int max2201x_iio_read_avail(char *array_avail, char *buf)
2024-03-25T10:53:24.3208489Z       |                             ~~~~~~^~~~~~~~~~~
2024-03-25T10:53:24.3213877Z dac/max2201x/iio_max2201x.c:735:31: warning: passing argument 2 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
2024-03-25T10:53:24.3214379Z   735 |   if (!strcmp(buf, array_avail[i]))
2024-03-25T10:53:24.3214793Z       |                    ~~~~~~~~~~~^~~
2024-03-25T10:53:24.3215194Z       |                               |
2024-03-25T10:53:24.3215394Z       |                               char
2024-03-25T10:53:24.3220657Z In file included from dac/max2201x/iio_max2201x.c:41:
2024-03-25T10:53:24.3221324Z /usr/include/newlib/string.h:36:28: note: expected 'const char *' but argument is of type 'char'
2024-03-25T10:53:24.3221784Z    36 | int  strcmp (const char *, const char *);
2024-03-25T10:53:24.3222113Z       |                            ^~~~~~~~~~~~
2024-03-25T10:53:24.3229764Z In file included from dac/max2201x/iio_max2201x.c:44:
2024-03-25T10:53:24.3230517Z ../include/no_os_util.h:54:13: warning: division 'sizeof (char *) / sizeof (char)' does not compute the number of array elements [-Wsizeof-pointer-div]
2024-03-25T10:53:24.3230927Z    54 |  (sizeof(x) / sizeof((x)[0]))
2024-03-25T10:53:24.3231430Z       |             ^
2024-03-25T10:53:24.3232168Z dac/max2201x/iio_max2201x.c:738:11: note: in expansion of macro 'NO_OS_ARRAY_SIZE'
2024-03-25T10:53:24.3232482Z   738 |  if (i == NO_OS_ARRAY_SIZE(array_avail))
2024-03-25T10:53:24.3232661Z       |           ^~~~~~~~~~~~~~~~
2024-03-25T10:53:24.3239881Z dac/max2201x/iio_max2201x.c:730:35: note: first 'sizeof' operand was declared here
2024-03-25T10:53:24.3240681Z   730 | int max2201x_iio_read_avail(char *array_avail, char *buf)
2024-03-25T10:53:24.3241021Z       |                             ~~~~~~^~~~~~~~~~~
2024-03-25T10:53:24.3244122Z In file included from dac/max2201x/iio_max2201x.c:44:
2024-03-25T10:53:24.3244637Z dac/max2201x/iio_max2201x.c: In function 'max2201x_iio_read_avail_length':
2024-03-25T10:53:24.3247432Z ../include/no_os_util.h:54:13: warning: division 'sizeof (char *) / sizeof (char)' does not compute the number of array elements [-Wsizeof-pointer-div]
2024-03-25T10:53:24.3247850Z    54 |  (sizeof(x) / sizeof((x)[0]))
2024-03-25T10:53:24.3248289Z       |             ^
2024-03-25T10:53:24.3248670Z dac/max2201x/iio_max2201x.c:749:18: note: in expansion of macro 'NO_OS_ARRAY_SIZE'
2024-03-25T10:53:24.3249000Z   749 |  for (i = 0; i < NO_OS_ARRAY_SIZE(array_avail); i++)
2024-03-25T10:53:24.3249268Z       |                  ^~~~~~~~~~~~~~~~
2024-03-25T10:53:24.3251889Z dac/max2201x/iio_max2201x.c:744:42: note: first 'sizeof' operand was declared here
2024-03-25T10:53:24.3252266Z   744 | int max2201x_iio_read_avail_length(char *array_avail, char *buf)
2024-03-25T10:53:24.3252558Z       |                                    ~~~~~~^~~~~~~~~~~
RaduSabau1 commented 6 months ago

V9

RaduSabau1 commented 6 months ago

V10