18 #include "clock_config.h" 20 #include "fsl_lptmr.h" 21 #include "fsl_adc12.h" 22 #include "fsl_debug_console.h" 27 #include "issdk_hal.h" 28 #include "gpio_driver.h" 34 #define pa7250_odr_callback PWT_LPTMR0_IRQHandler 36 #define adc12_irq_callback ADC0_IRQHandler 39 #define FXPS7250A4_ODR_ms 1000U 61 LPTMR_ClearStatusFlags(LPTMR0, kLPTMR_TimerCompareFlag);
76 lptmr_config_t lptmrConfig;
77 adc12_config_t adc12ConfigStruct;
80 LPTMR_GetDefaultConfig(&lptmrConfig);
81 LPTMR_Init(LPTMR0, &lptmrConfig);
82 LPTMR_SetTimerPeriod(LPTMR0, MSEC_TO_COUNT(
FXPS7250A4_ODR_ms, CLOCK_GetFreq(kCLOCK_LpoClk)));
83 LPTMR_EnableInterrupts(LPTMR0, kLPTMR_TimerInterruptEnable);
84 EnableIRQ(PWT_LPTMR0_IRQn);
85 LPTMR_StartTimer(LPTMR0);
89 CLOCK_SetIpSrc(kCLOCK_Adc0, kCLOCK_IpSrcSircAsync);
91 ADC12_GetDefaultConfig(&adc12ConfigStruct);
92 adc12ConfigStruct.clockSource = kADC12_ClockSourceAlt0;
93 adc12ConfigStruct.resolution = kADC12_Resolution12Bit;
94 ADC12_Init(ADC0, &adc12ConfigStruct);
96 ADC12_EnableHardwareTrigger(ADC0,
false);
98 if (kStatus_Success != ADC12_DoAutoCalibration(ADC0))
100 PRINTF(
"ADC calibration failed!\r\n");
109 float pressure = 0.0;
121 float pressurekPa = 0.0;
129 PRINTF(
"\r\n FXPS7250A4 ADC based Interrupt Example\r\n");
154 PRINTF(
"\r\n Calculated Voltage Value: %0.2f Volts", outVolt);
155 PRINTF(
"\r\n Analog Pressure Value: %0.2f kPa \n", pressurekPa);
#define FXPS7250A4_ADC12_CHANNEL_GROUP
void KE15Z_LPTMR0_ADC0_Initialize(void)
#define ASK_USER_TO_RESUME(x)
Access structure of the GPIO Driver.
volatile bool bAdcCompletedFlag
#define BOARD_BootClockRUN
GENERIC_DRIVER_GPIO Driver_GPIO_KSDK
#define FXPS7250A4_OFFSET
#define pa7250_odr_callback
#define FXPS7250A4_ODR_ms
adc12_channel_config_t gAdcChannelConfigStruct
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...
int main(void)
Main function.
void(* pin_init)(pinID_t aPinId, gpio_direction_t dir, void *apPinConfig, gpio_isr_handler_t aIsrHandler, void *apUserData)
volatile uint32_t gAdcConversionValue
#define FXPS7250A4_ADC12_CHANNEL
float analog_output_transfer_fn(float volt)
gpioHandleKSDK_t GREEN_LED
#define adc12_irq_callback
void BOARD_InitDebugConsole(void)
void BOARD_InitPins(void)
Configures pin routing and optionally pin electrical features.