尊敬的所有人:
我不知道如何在图形库中使用滑块、尽管我尝试从示例中获取它。 我的问题是从滑块获取值并将其传递到 DAC。 因此、我无法从滑块获取值。 onsliderchange 函数我不知道如何写入它。 请帮助。 我正在编写代码
#include "stdbool.h"
#include "stdint.h"
#include "gpio.h"
#include "rom_map.h"
#include "sysctl.h"
#include "inc/hw_memmap.h"
#include "pin_map.h"
#include "emac.h"
#include "SysTick .h"
#include "drivers/pinout.h"
#include "utils/ustdlib.h"
#include "driverlib/adc.h"
#include "math.h"
#include "driverlib/ssi.h"
#include "inc/tm4c129xncszad.h"
#include "grlib/grlib.h"
#include "grlib/widget.h"
#include "grlib/canvas.h"
#include "grlib/slider.h"
#include "drivers/frame.h"
#include "drivers/kentec320x240x16_ssd2119.h"
#include "drivers/sound.h"
#include "drivers/touch。h"
#include "driverlib/rom.h"
uint32_t ui32SysClock;
void PinoutSet (void);
void DisplayInitialize (void);
#define SYS_TICK 延迟10000
#define GPIO_PA2_SSI0CLK 0x0000080F
#define GPIO_PA3_SSI0FSS 0x00000C0F
#define GPIO_PA4_SSI0TX 0x0000100F
#define GPIO_PA5_SSI0RX 0x0000140F
void Touch_interface (void);
volatile uint32_t ui32Loop;
void OnSliderChange (tWidget * psWidget、int32_t i32Value);
void clrScreen (void);
void DisplayInitialize (void);
tContext sContext;
tRectangle sRect;
extern tCanWidget vasg_sBackground;
extern tSliderWidget g_psSliders;
画布(g_sHeading、&g_sBackground、0、&g_psSliders、
&g_sKentec320x240x16_SSD2119、0、0、320、23、
(canva_style_fill | canva_style_outline | canva_style_text)、
ClrBlack、ClrWhite、ClrRed、g_psFontCm20、"滑块控制"、 0、0);
画布(g_sBackground、widget_root、0、&g_sHeading、
&g_sKentec320x240x16_SSD2119、0、23、320、(240 - 23)、
canva_style_fill、ClrBlack、0、0、0、 0、0、0);
滑块(g_psSliders、&g_sHeading、0、0、
&g_sKentec320x240x16_SSD2119、10、105、220、30、 0、100、25、
(sl_style_fill | sl_style_BACKG_Fill | sl_style_Outline |
SL_style_text | SL_style_BACKG_text)、
ClrGrey、ClrBlack、ClrSilver、ClrWhite、ClrWhite、
G_psFontCm20、"25%"、0、0、OnSliderChange);
void SysTickIntHandler()
{
/*-------- LwIP 定时器 ------------------------------------------------------- *
}
/*
void MT_SysTick 设置()
{
SysTickPeriodSet ((((ui32SysClock / 1000000)* SYS_TICK 延迟)); //加载计数
SysTickIntRegister (SysTickIntHandler); // int 处理程序寄存器
SysTickIntEnable(); //启用 SysTick 中断
SysTickEnable(); //启用 SysTick
}
*
无效
OnSliderChange (tWidget * psWidget、int32_t i32Value)
{
}
void DAC_LDAC ()
{
/// LDAC 信号
MAP_SysCtlPeripheralEnable (SYSCTL_Periph_GPIOB);
MAP_GPIOPinTypeGPIOOutput (GPIO_PORTB_BASE、GPIO_PIN_5);
MAP_GPIOPinWrite (GPIO_PORTB_BASE、GPIO_PIN_5、GPIO_PIN_5);
//复位信号
MAP_SysCtlPeripheralEnable (SYSCTL_Periph_GPIOF);
MAP_GPIOPinTypeGPIOOutput (GPIO_PORTF_BASE、GPIO_PIN_3);
MAP_GPIOPinWrite (GPIO_PORTF_BASE、GPIO_PIN_3、0);
}
int main (空)
{
uint32_t pui32DataTx;
volatile uint32_t ui32Loop;
ui32SysClock = SysCtlClockFreqSet ((SYSCTL_XTAL_25MHz |SYSCTL_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_320)、
2000000);
// mt_SysTick _set ();
DAC_LDAC ();
DisplayInitialize();
SysCtlPeripheralEnable (SYSCTL_Periph_SSI0);
SysCtlPeripheralEnable (SYSCTL_Periph_GPIOA);
GPIOPinConfigure (GPIO_PA2_SSI0CLK);
GPIOPinConfigure (GPIO_PA3_SSI0FSS);
GPIOPinConfigure (GPIO_PA4_SSI0TX);
GPIOPinConfigure (GPIO_PA5_SSI0RX);
GPIOPinTypeSSI (GPIO_Porta_base、GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_3 | GPIO_PIN_2);
SSIConfigSetExpClk (SSI0_BASE、ui32SysClock、SSI_FRF_MOTO_MODE_3、
SSI_MODE_MASTER、10000、16);
SSIEnable (SSI0_BASE);
while (1)
{
// SysCtlDelay (10);
MAP_GPIOPinWrite (GPIO_PORTF_BASE、GPIO_PIN_3、GPIO_PIN_3);
MAP_GPIOPinWrite (GPIO_PORTB_BASE、GPIO_PIN_5、GPIO_PIN_5);//LDAC
pui32DataTx=0xafff;
SSIDataPut (SSI0_BASE、pui32DataTx);
while (SSIBusy (SSI0_BASE))
{
}
MAP_GPIOPinWrite (GPIO_PORTB_BASE、GPIO_PIN_5、0);
// SSIIntClear (SSI0_BASE、SSI_RXFF);
SysCtlDelay (10);
MAP_GPIOPinWrite (GPIO_PORTB_BASE、GPIO_PIN_5、GPIO_PIN_5);
}
}
空 clrScreen()
{
sRect.i16XMin = 0;
sRect.i16YMin = 0;
sRect.i16XMax = 319;
sRect.i16YMax = 239;
GrContextForegroundSet (&sContext、ClrBlack);
GrRectFill (&sContext、&sRect);
格林图(&S);
}
void DisplayInitialize()
{
Kentec320x240x16_SSD2119Init (ui32SysClock);
GrContextInit (&sContext、&g_sKentec320x240x16_SSD2119);
PinoutSet();
TouchScreenInit (ui32SysClock);
TouchScreenCallbackSet (WidgetPointerMessage);
WidgetAdd (widget_root、(tWidget *)&g_sBackground);
WidgetPaint (widget_root);
clrScreen();
}