19 #include "clock_config.h" 21 #include "fsl_lptmr.h" 22 #include "fsl_adc12.h" 23 #include "fsl_debug_console.h" 28 #include "issdk_hal.h" 29 #include "gpio_driver.h" 35 #define dp5004_odr_callback PWT_LPTMR0_IRQHandler 37 #define adc12_irq_callback ADC0_IRQHandler 40 #define MPXV5004DR_ODR_ms 1000U 55 LPTMR_ClearStatusFlags(LPTMR0, kLPTMR_TimerCompareFlag);
70 lptmr_config_t lptmrConfig;
71 adc12_config_t adc12ConfigStruct;
74 LPTMR_GetDefaultConfig(&lptmrConfig);
75 LPTMR_Init(LPTMR0, &lptmrConfig);
76 LPTMR_SetTimerPeriod(LPTMR0, MSEC_TO_COUNT(
MPXV5004DR_ODR_ms, CLOCK_GetFreq(kCLOCK_LpoClk)));
77 LPTMR_EnableInterrupts(LPTMR0, kLPTMR_TimerInterruptEnable);
78 EnableIRQ(PWT_LPTMR0_IRQn);
79 LPTMR_StartTimer(LPTMR0);
83 CLOCK_SetIpSrc(kCLOCK_Adc0, kCLOCK_IpSrcSircAsync);
85 ADC12_GetDefaultConfig(&adc12ConfigStruct);
86 adc12ConfigStruct.clockSource = kADC12_ClockSourceAlt0;
87 adc12ConfigStruct.resolution = kADC12_Resolution12Bit;
88 ADC12_Init(ADC0, &adc12ConfigStruct);
90 ADC12_EnableHardwareTrigger(ADC0,
false);
92 if (kStatus_Success != ADC12_DoAutoCalibration(ADC0))
94 PRINTF(
"ADC calibration failed!\r\n");
106 uint16_t pressurePascals;
113 PRINTF(
"\r\n MPXV5004DP ADC based Interrupt Example\r\n");
136 PRINTF(
"\r\n Differential Pressure Value: %dPa\r\n", pressurePascals);
#define ASK_USER_TO_RESUME(x)
volatile uint32_t gAdcConversionValue
#define MPXV5004DP_PRESSURE_FROM_ADC_VALUE(x)
#define adc12_irq_callback
Access structure of the GPIO Driver.
#define MPXVDP5004_ADC12_CHANNEL
int main(void)
Main function.
adc12_channel_config_t gAdcChannelConfigStruct
#define MPXVDP5004_ADC12_CHANNEL_GROUP
#define dp5004_odr_callback
#define BOARD_BootClockRUN
void KE15Z_LPTMR0_ADC0_Initialize(void)
GENERIC_DRIVER_GPIO Driver_GPIO_KSDK
void(* toggle_pin)(pinID_t aPinId)
status_t SMC_SetPowerModeWait(void *arg)
Configures the system to WAIT power mode. API name used from Kinetis family to maintain compatibility...
void(* pin_init)(pinID_t aPinId, gpio_direction_t dir, void *apPinConfig, gpio_isr_handler_t aIsrHandler, void *apUserData)
gpioHandleKSDK_t GREEN_LED
void BOARD_InitDebugConsole(void)
volatile bool bAdcCompletedFlag
void BOARD_InitPins(void)
Configures pin routing and optionally pin electrical features.
#define MPXV5004DR_ODR_ms