Hardware Abstraction Layer for FreeRTOS
adc_test.h
Go to the documentation of this file.
1 #ifndef ADC_TEST_H_
2 #define ADC_TEST_H_
3 
4 #include <adc.h>
5 #define ADC_PRV
6 #include <adc_prv.h>
7 #include <FreeRTOS.h>
8 #include <task.h>
9 extern const struct adc_ops test_ops;
10 struct adc_test {
11  struct adc_generic gen;
12  bool running;
13  uint32_t ticks;
14  uint32_t bits;
15  uint32_t channelID;
16  OS_DEFINE_TASK(task, 500);
17  bool (*callback)(struct adc *adc, uint32_t channel, int32_t value, void *data);
18  void *data;
19 
20  int32_t (*test_callback)(struct adc *adc, uint32_t channel, void *data);
21  void *test_data;
22 };
24 int32_t adc_test_connect(struct adc *adc, int32_t callback(struct adc *adc, uint32_t channel, void *data), void *data);
25 #define ADD_ADC_TEST(_channelID) \
26  struct adc_test test_##_channelID = { \
27  ADC_INIT_DEV(test) \
28  HAL_NAME("Test ADC Channel " #_channelID) \
29  .channelID = _channelID, \
30  };\
31  ADC_ADDDEV(test, test_##_channelID)
32 #define TEST_ID(_channelID) HAL_GET_ID(adc, test, test_##_channelID)
33 #endif
adc.h
adc_prv.h
OS_DEFINE_TASK
#define OS_DEFINE_TASK(name, stackSize)
Definition: os.h:52
adc_test_connect
int32_t adc_test_connect(struct adc *adc, int32_t callback(struct adc *adc, uint32_t channel, void *data), void *data)
adc_generic
Definition: adc.h:45