IIO firmware for the AD717x and AD411x family of devices.

Dependencies:   sdp_k1_sdram

Files at this revision

API Documentation at this revision

Comitter:
Janani Sunil
Date:
Tue Nov 15 17:05:27 2022 +0530
Parent:
2:d0c2d3e1fb93
Commit message:
Added support for AD4116

Changed in this revision

README.txt Show annotated file Show diff for this revision Revisions of this file
app/.mbedignore Show annotated file Show diff for this revision Revisions of this file
app/ad717x_user_config.c Show annotated file Show diff for this revision Revisions of this file
app/app_config.c Show annotated file Show diff for this revision Revisions of this file
app/app_config.h Show annotated file Show diff for this revision Revisions of this file
app/app_config_mbed.c Show annotated file Show diff for this revision Revisions of this file
app/app_config_mbed.h Show annotated file Show diff for this revision Revisions of this file
app/no-OS.lib Show annotated file Show diff for this revision Revisions of this file
--- a/README.txt	Thu Sep 29 09:02:39 2022 +0530
+++ b/README.txt	Tue Nov 15 17:05:27 2022 +0530
@@ -4,6 +4,7 @@
 EVAL-AD4112SDZ
 EVAL-AD4114SDZ
 EVAL-AD4115SDZ
+EVAL-AD4116ASDZ
 EVAL-AD7172-2SDZ
 EVAL-AD7172-4SDZ
 EVAL-AD7173-8SDZ
--- a/app/.mbedignore	Thu Sep 29 09:02:39 2022 +0530
+++ b/app/.mbedignore	Tue Nov 15 17:05:27 2022 +0530
@@ -45,6 +45,8 @@
 no-OS/drivers/platform/generic/
 no-OS/drivers/platform/linux/
 no-OS/drivers/platform/maxim/
+no-OS/drivers/platform/pico/
+no-OS/drivers/platform/mbed/mbed_timer.cpp
 no-OS/drivers/potentiometer/
 no-OS/drivers/rf-transceiver/
 no-OS/drivers/sd-card/
--- a/app/ad717x_user_config.c	Thu Sep 29 09:02:39 2022 +0530
+++ b/app/ad717x_user_config.c	Tue Nov 15 17:05:27 2022 +0530
@@ -29,7 +29,7 @@
 /******************************************************************************/
 
 #if defined(DEV_AD4111) || defined(DEV_AD4112) || defined(DEV_AD4114) || \
-	defined(DEV_AD4115)
+	defined(DEV_AD4115) || defined (DEV_AD4116)
 #include <ad411x_regs.h>
 #define AD717X_DEVICE_MAP ad4111_regs
 #define AD717x_NUM_REGS NO_OS_ARRAY_SIZE(ad4111_regs)
@@ -92,7 +92,7 @@
 #endif
 	},
 	.chan_map = {
-#if defined (DEV_AD4111) || defined (DEV_AD4112) || defined (DEV_AD4114) || defined (DEV_AD4115)
+#if defined (DEV_AD4111) || defined (DEV_AD4112) || defined (DEV_AD4114) || defined (DEV_AD4115) || defined (DEV_AD4116)
 		{ .channel_enable = false, .setup_sel = 0, .analog_inputs.analog_input_pairs = VIN0_VIN1 },
 		{ .channel_enable = false, .setup_sel = 1, .analog_inputs.analog_input_pairs = VIN0_VIN1 },
 		{ .channel_enable = false, .setup_sel = 0, .analog_inputs.analog_input_pairs = VIN0_VIN1 },
@@ -134,7 +134,7 @@
 		{ .channel_enable = false, .setup_sel = 0, .analog_inputs.ainp.pos_analog_input = AIN0, .analog_inputs.ainp.neg_analog_input = AIN1 },
 #endif // (NUMBER_OF_CHANNELS != 4) && (NUMBER_OF_CHANNELS != 8)
 #endif // (NUMBER_OF_CHANNELS != 4)
-#endif // (DEV_AD4111),(DEV_AD4112),(DEV_AD4114),(DEV_AD4115)
+#endif // (DEV_AD4111),(DEV_AD4112),(DEV_AD4114),(DEV_AD4115), (DEV_AD4116)
 	},
 	.filter_configuration = {
 		{.odr = AD717x_ODR_SEL},
--- a/app/app_config.c	Thu Sep 29 09:02:39 2022 +0530
+++ b/app/app_config.c	Tue Nov 15 17:05:27 2022 +0530
@@ -116,11 +116,16 @@
 		}
 
 		/* Register a callback function for external interrupt */
-		ret = no_os_irq_register_callback(external_int_desc, EXTERNAL_INT_ID1,
+		ret = no_os_irq_register_callback(external_int_desc, IRQ_INT_ID,
 						  &ext_int_callback_desc);
 		if (ret) {
 			break;
 		}
+		ret = no_os_irq_trigger_level_set(external_int_desc, IRQ_INT_ID,
+						  NO_OS_IRQ_EDGE_FALLING);
+		if (ret) {
+			return ret;
+		}
 
 		return 0;
 	} while (0);
--- a/app/app_config.h	Thu Sep 29 09:02:39 2022 +0530
+++ b/app/app_config.h	Tue Nov 15 17:05:27 2022 +0530
@@ -56,6 +56,9 @@
 #elif defined(DEV_AD4115)
 #define ACTIVE_DEVICE_NAME	"ad4115"
 #define ACTIVE_DEVICE_ID	 ID_AD4115
+#elif defined(DEV_AD4116)
+#define ACTIVE_DEVICE_NAME	"ad4116"
+#define ACTIVE_DEVICE_ID	 ID_AD4116
 #elif defined(DEV_AD7172_2)
 #define AD7172_2_INIT
 #define ACTIVE_DEVICE_NAME	"ad7172-2"
@@ -99,9 +102,9 @@
 #define ext_int_extra_init_params mbed_ext_int_extra_init_params
 #define csb_platform_ops mbed_gpio_ops
 #define rdy_platform_ops mbed_gpio_ops
-#define irq_platform_ops mbed_irq_ops
+#define irq_platform_ops mbed_gpio_irq_ops
 #define spi_platform_ops mbed_spi_ops
-#define IRQ_INT_ID EXTERNAL_INT_ID1
+#define IRQ_INT_ID	GPIO_IRQ_ID1
 #endif // ACTIVE_PLATFORM
 
 /* Enable the UART/VirtualCOM port connection (default VCOM) */
@@ -131,7 +134,7 @@
 
 /* Definition for number of channels for the selected device */
 #if defined(DEV_AD4111) || defined(DEV_AD4112) || \
-	defined(DEV_AD4114) || defined(DEV_AD4115) || \
+	defined(DEV_AD4114) || defined(DEV_AD4115) || defined (DEV_AD4116) ||\
 	defined(DEV_AD7173_8) || defined(DEV_AD7175_8)
 #define NUMBER_OF_CHANNELS	16U
 #define NUMBER_OF_SETUPS	8U
@@ -165,6 +168,9 @@
  * AD4111, AD41112, AD4114, AD4115:
  * 31250, 15625, 10417, 5208, 2957, 1007, 503, 381, 200, 100, 59, 49, 20, 16, 10, 5, 2, 1.
  *
+ * AD4116:
+ * 625000, 31250, 15625, 10416, 5194, 2496, 1007, 499, 390, 200, 100, 59, 49, 20, 16, 10, 5, 2, 1.
+ *
  *AD7175_2, AD7175_8, AD7176_2:
  * 31250, 25000, 10000, 5000, 2500, 1000, 500, 397, 200, 100, 59, 49, 20, 16, 10, 5
  *
@@ -176,8 +182,8 @@
 
 /* ODR[4:0] bits*/
 #if defined (DEV_AD4111) || defined (DEV_AD4112) || defined (DEV_AD4114) ||\
- defined (DEV_AD4115) || defined (DEV_AD7172_2) || defined (DEV_AD7172_4) ||\
-defined (DEV_AD7173_8)
+ defined (DEV_AD4115) || defined (DEV_AD7172_2) ||\
+	defined (DEV_AD7172_4) || defined (DEV_AD7173_8)
 #if (AD717x_SAMPLING_RATE == 31250)
 #define AD717x_ODR_SEL	    0
 #elif (AD717x_SAMPLING_RATE == 15625)
@@ -220,6 +226,46 @@
 #define AD717x_ODR_SEL			0
 #endif
 
+#elif defined (DEV_AD4116)
+#if (AD717x_SAMPLING_RATE == 625000)
+#define AD717x_ODR_SEL      0
+#elif (AD717x_SAMPLING_RATE == 31250)
+#define AD717x_ODR_SEL      4
+#elif (AD717x_SAMPLING_RATE == 15625)
+#define AD717x_ODR_SEL      6
+#elif (AD717x_SAMPLING_RATE == 10416)
+#define AD717x_ODR_SEL      7
+#elif (AD717x_SAMPLING_RATE == 5194)
+#define AD717x_ODR_SEL      8
+#elif (AD717x_SAMPLING_RATE == 2496)
+#define AD717x_ODR_SEL      9
+#elif (AD717x_SAMPLING_RATE == 1007)
+#define AD717x_ODR_SEL      10
+#elif (AD717x_SAMPLING_RATE == 499)
+#define AD717x_ODR_SEL      11
+#elif (AD717x_SAMPLING_RATE == 390)
+#define AD717x_ODR_SEL      12
+#elif (AD717x_SAMPLING_RATE == 200)
+#define AD717x_ODR_SEL      13
+#elif (AD717x_SAMPLING_RATE == 100)
+#define AD717x_ODR_SEL      14
+#elif (AD717x_SAMPLING_RATE == 59)
+#define AD717x_ODR_SEL      15
+#elif (AD717x_SAMPLING_RATE == 49)
+#define AD717x_ODR_SEL      16
+#elif (AD717x_SAMPLING_RATE == 20)
+#define AD717x_ODR_SEL      17
+#elif (AD717x_SAMPLING_RATE == 16)
+#define AD717x_ODR_SEL      18
+#elif (AD717x_SAMPLING_RATE == 10)
+#define AD717x_ODR_SEL      19
+#elif (AD717x_SAMPLING_RATE == 5)
+#define AD717x_ODR_SEL      20
+#elif (AD717x_SAMPLING_RATE == 2)
+#define AD717x_ODR_SEL      21
+#elif (AD717x_SAMPLING_RATE == 1)
+#define AD717x_ODR_SEL      22
+#endif
 #elif defined (DEV_AD7175_2) || defined (DEV_AD7175_8) || defined (DEV_AD7176_2) || defined (DEV_AD7177_2)
 #if !defined (DEV_AD7177_2)
 #if (AD717x_SAMPLING_RATE == 31250)
@@ -271,7 +317,7 @@
 
 /* Denominator of the scale factor to be applied while converting raw values to actual voltage */
 #if  defined(DEV_AD4111) || defined(DEV_AD4112) || \
-	defined(DEV_AD4114) || defined(DEV_AD4115)
+	defined(DEV_AD4114) || defined(DEV_AD4115) || defined (DEV_AD4116)
 #define SCALE_FACTOR_DR			0.1
 #else
 #define SCALE_FACTOR_DR			1
--- a/app/app_config_mbed.c	Thu Sep 29 09:02:39 2022 +0530
+++ b/app/app_config_mbed.c	Tue Nov 15 17:05:27 2022 +0530
@@ -47,10 +47,8 @@
 };
 
 /* External interrupt Mbed platform specific parameters */
-struct mbed_irq_init_param mbed_ext_int_extra_init_params = {
-	.int_mode = EXT_IRQ_FALL,
-	.ext_int_pin = RDY_PIN,
-	.int_obj_type = NULL
+struct mbed_gpio_irq_init_param mbed_ext_int_extra_init_params = {
+	.gpio_irq_pin = RDY_PIN,
 };
 
 /******************************************************************************/
--- a/app/app_config_mbed.h	Thu Sep 29 09:02:39 2022 +0530
+++ b/app/app_config_mbed.h	Tue Nov 15 17:05:27 2022 +0530
@@ -23,6 +23,7 @@
 #include "mbed_uart.h"
 #include "mbed_irq.h"
 #include "mbed_gpio.h"
+#include "mbed_gpio_irq.h"
 #if defined(TARGET_SDP_K1)
 #include "sdram_sdpk1.h"
 #endif
@@ -36,10 +37,10 @@
  * boards. The default is the SDP-120 connector.
  *
  * Uncomment the #define ARDUINO below to enable the Arduino connector for
- * EVAL-AD4114SDZ and the EVAL-4115SDZ
+ * EVAL-AD4114SDZ, EVAL-AD4115SDZ and the EVAL-AD4116ASDZ
 */
 
-/* NOTE: Only EVAL-AD4114SDZ and  EVAL-AD4115SDZ support Arduino and SDP_120
+/* NOTE: Only EVAL-AD4114SDZ, EVAL-AD4115SDZ and EVAL-AD4116ASDZ support Arduino and SDP_120
  * interface. The other EVAL Boadrds (EVAL-AD4111SDZ, EVAL-AD4112SDZ,
  * EVAL-AD7172-4SDZ, EVAL-AD7172-2SDZ , EVAL-AD7173-8SDZ, EVAL-AD7175-2SDZ,
  * EVAL-AD7175-8SDZ, EVAL-AD7176-2SDZ, EVAL-AD7177-2SDZ) support only the
@@ -76,7 +77,7 @@
 
 extern struct mbed_uart_init_param	mbed_uart_extra_init_params;
 extern struct mbed_spi_init_param	mbed_spi_extra_init_params;
-extern struct mbed_irq_init_param mbed_ext_int_extra_init_params;
+extern struct mbed_gpio_irq_init_param mbed_ext_int_extra_init_params;
 
 #endif // APP_CONFIG_MBED_H_
 
--- a/app/no-OS.lib	Thu Sep 29 09:02:39 2022 +0530
+++ b/app/no-OS.lib	Tue Nov 15 17:05:27 2022 +0530
@@ -1,1 +1,1 @@
-https://github.com/analogdevicesinc/no-OS/#20fa59639588b9bc7a45693d6119f53d05a67401
\ No newline at end of file
+https://github.com/analogdevicesinc/no-OS/#cd900da32ce1c10510aeca83c461d4ba78a208f4
\ No newline at end of file