Update repo
This commit is contained in:
1 parent
0afe39c8fe
commit
d229fd964d
6 files changed
+9
-28
No files matched your search
@@ -6,7 +6,6 @@
|
||||
#include <zephyr/drivers/uart.h>
|
||||
#include <zephyr/drivers/adc.h>
|
||||
|
||||
|
||||
#define ADC_NODE DT_NODELABEL(adc1)
|
||||
#define ADC_SAMPLE_PERIOD K_MSEC(50)
|
||||
|
||||
@@ -25,10 +24,8 @@ static enum adc_action adc_cb(const struct device *dev,
|
||||
|
||||
static K_WORK_DELAYABLE_DEFINE(adc_sample_work, adc_sample_work_handler);
|
||||
|
||||
|
||||
static uint16_t sample;
|
||||
|
||||
|
||||
static struct adc_sequence_options seq_opts = {
|
||||
.interval_us = 0, // Let driver decide
|
||||
.extra_samplings = 0, // One-shot, resubmit work continuously
|
||||
@@ -37,7 +34,6 @@ static struct adc_sequence_options seq_opts = {
|
||||
|
||||
};
|
||||
|
||||
|
||||
// Channel Configuration
|
||||
static struct adc_channel_cfg ch1_cfg = {
|
||||
.gain = ADC_GAIN_1,
|
||||
@@ -47,7 +43,7 @@ static struct adc_channel_cfg ch1_cfg = {
|
||||
.differential = 0,
|
||||
};
|
||||
|
||||
|
||||
// Sequence Configuration
|
||||
static struct adc_sequence seq = {
|
||||
.channels = BIT(1), // Channel bitmap
|
||||
.buffer = &sample,
|
||||
@@ -56,7 +52,6 @@ static struct adc_sequence seq = {
|
||||
.options = &seq_opts
|
||||
};
|
||||
|
||||
|
||||
static enum adc_action adc_cb(const struct device *dev,
|
||||
const struct adc_sequence *sequence,
|
||||
uint16_t sampling_index)
|
||||
@@ -69,7 +64,6 @@ static enum adc_action adc_cb(const struct device *dev,
|
||||
return ADC_ACTION_FINISH;
|
||||
}
|
||||
|
||||
|
||||
static void adc_sample_work_handler(struct k_work *work)
|
||||
{
|
||||
ARG_UNUSED(work);
|
||||
@@ -86,9 +80,8 @@ static void adc_sample_work_handler(struct k_work *work)
|
||||
(void)k_work_reschedule(&adc_sample_work, ADC_SAMPLE_PERIOD);
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
|
||||
int main(void)
|
||||
{
|
||||
if(!device_is_ready(adc_dev)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user