added ad5303 driver

This commit is contained in:
2023-09-28 19:48:58 +02:00
parent 2fbb7b4b91
commit 8a05f907dd
5 changed files with 139 additions and 1 deletions

View File

@@ -9,6 +9,7 @@
#include "mcu_cs.h"
#include "mcp41x.h"
#include "ad9833.h"
#include "ad5303.h"
#define MAX_VOLT 330
typedef enum
@@ -32,11 +33,15 @@ typedef enum
} wave_t;
st7565_handle_t hst7565;
GFX_display_t disp;
mcp41x_handle_t hmcp41;
MCU_cs_t hmcp41_cs;
ad9833_handle_t had9833;
MCU_cs_t had9833_cs;
GFX_display_t disp;
ad5303_handle_t hdac;
MCU_cs_t hdac_cs;
uint32_t last_tick;
option_t option;
@@ -70,6 +75,9 @@ void setup(void)
mcu_cs_init(&had9833_cs, DDS1_CS_GPIO_Port, DDS1_CS_Pin, GPIO_PIN_SET);
ad9833_init(&had9833, &hspi2, &had9833_cs.super);
mcu_cs_init(&hdac_cs, OFFS1_CS_GPIO_Port, OFFS1_CS_Pin, GPIO_PIN_SET);
ad5303_init(&hdac, &hspi2, &hdac_cs.super, AD_8BIT);
bottomButtonInit();
DISP_clearScreen(&disp);
@@ -307,11 +315,13 @@ void changeValue(int8_t inc)
case OFFS:
{
var[OFFS] = (var[OFFS] + inc) & UINT8_MAX;
ad5303_set_value(&hdac, var[OFFS], AD_DAC1);
break;
}
case ZERO:
{
var[ZERO] = (var[ZERO] + inc) & UINT8_MAX;
ad5303_set_value(&hdac, var[ZERO], AD_DAC2);
break;
}
default: