PX4 Firmware
PX4 Autopilot Software http://px4.io
|
Public Member Functions | |
ADC (uint32_t base_address, uint32_t channels) | |
~ADC () | |
virtual int | init () |
virtual int | ioctl (file *filp, int cmd, unsigned long arg) |
virtual ssize_t | read (file *filp, char *buffer, size_t len) |
Public Member Functions inherited from cdev::CDev | |
CDev (const char *devname) | |
Constructor. More... | |
CDev (const CDev &)=delete | |
CDev & | operator= (const CDev &)=delete |
CDev (CDev &&)=delete | |
CDev & | operator= (CDev &&)=delete |
virtual | ~CDev () |
virtual int | open (file_t *filep) |
Handle an open of the device. More... | |
virtual int | close (file_t *filep) |
Handle a close of the device. More... | |
virtual ssize_t | read (file_t *filep, char *buffer, size_t buflen) |
Perform a read from the device. More... | |
virtual ssize_t | write (file_t *filep, const char *buffer, size_t buflen) |
Perform a write to the device. More... | |
virtual off_t | seek (file_t *filep, off_t offset, int whence) |
Perform a logical seek operation on the device. More... | |
virtual int | ioctl (file_t *filep, int cmd, unsigned long arg) |
Perform an ioctl operation on the device. More... | |
virtual int | poll (file_t *filep, px4_pollfd_struct_t *fds, bool setup) |
Perform a poll setup/teardown operation. More... | |
const char * | get_devname () const |
Get the device name. More... | |
Protected Member Functions | |
virtual int | open_first (struct file *filp) |
virtual int | close_last (struct file *filp) |
Protected Member Functions inherited from cdev::CDev | |
virtual pollevent_t | poll_state (file_t *filep) |
Check the current state of the device for poll events from the perspective of the file. More... | |
virtual void | poll_notify (pollevent_t events) |
Report new poll events. More... | |
virtual void | poll_notify_one (px4_pollfd_struct_t *fds, pollevent_t events) |
Internal implementation of poll_notify. More... | |
virtual int | open_first (file_t *filep) |
Notification of the first open. More... | |
virtual int | close_last (file_t *filep) |
Notification of the last close. More... | |
virtual int | register_class_devname (const char *class_devname) |
Register a class device name, automatically adding device class instance suffix if need be. More... | |
virtual int | unregister_class_devname (const char *class_devname, unsigned class_instance) |
Register a class device name, automatically adding device class instance suffix if need be. More... | |
void | lock () |
Take the driver lock. More... | |
void | unlock () |
Release the driver lock. More... | |
int | unregister_driver_and_memory () |
First, unregisters the driver. More... | |
Private Member Functions | |
void | Run () override |
uint32_t | sample (unsigned channel) |
Sample a single channel and return the measured value. More... | |
void | update_adc_report (hrt_abstime now) |
void | update_system_power (hrt_abstime now) |
Private Attributes | |
perf_counter_t | _sample_perf |
unsigned | _channel_count {0} |
const uint32_t | _base_address |
px4_adc_msg_t * | _samples {nullptr} |
sample buffer More... | |
uORB::Publication< adc_report_s > | _to_adc_report {ORB_ID(adc_report)} |
uORB::Publication< system_power_s > | _to_system_power {ORB_ID(system_power)} |
Static Private Attributes | |
static const hrt_abstime | kINTERVAL {10_ms} |
100Hz base rate More... | |
Additional Inherited Members | |
Protected Attributes inherited from cdev::CDev | |
px4_sem_t | _lock |
lock to protect access to all class members (also for derived classes) More... | |
Static Protected Attributes inherited from cdev::CDev | |
static const px4_file_operations_t | fops = {} |
Pointer to the default cdev file operations table; useful for registering clone devices etc. More... | |
ADC::ADC | ( | uint32_t | base_address, |
uint32_t | channels | ||
) |
Definition at line 105 of file adc.cpp.
References _channel_count, _samples, ADC_TOTAL_CHANNELS, px4_adc_msg_t, px4_arch_adc_temp_sensor_mask(), and PX4_MAX_ADC_CHANNELS.
Referenced by adc_main().
ADC::~ADC | ( | ) |
Definition at line 141 of file adc.cpp.
References _base_address, _sample_perf, _samples, perf_free(), and px4_arch_adc_uninit().
|
virtual |
Reimplemented from cdev::CDev.
Definition at line 152 of file adc.cpp.
References _base_address, ToneAlarmInterface::init(), and px4_arch_adc_init().
|
virtual |
|
protectedvirtual |
|
virtual |
Definition at line 172 of file adc.cpp.
References _channel_count, _samples, and px4_adc_msg_t.
Referenced by sample().
|
overrideprivate |
Definition at line 209 of file adc.cpp.
References _channel_count, _samples, hrt_absolute_time(), hrt_abstime, sample(), update_adc_report(), and update_system_power().
Referenced by open_first().
|
private |
Sample a single channel and return the measured value.
channel | The channel to sample. |
Definition at line 328 of file adc.cpp.
References _base_address, _sample_perf, ADC0_DEVICE_PATH, adc_main(), ADC_TOTAL_CHANNELS, data, fd, cdev::CDev::open(), perf_begin(), perf_end(), px4_adc_msg_t, px4_arch_adc_sample(), read(), and lps25h::test().
Referenced by Run().
|
private |
Definition at line 223 of file adc.cpp.
References _channel_count, _samples, _to_adc_report, adc_report_s::channel_id, adc_report_s::channel_value, uORB::Publication< T >::publish(), px4_arch_adc_dn_fullcount(), and adc_report_s::timestamp.
Referenced by Run().
|
private |
Definition at line 244 of file adc.cpp.
References _channel_count, _samples, _to_system_power, uORB::Publication< T >::publish(), px4_arch_adc_dn_fullcount(), and system_power_s::timestamp.
Referenced by Run().
|
private |
|
private |
Definition at line 97 of file adc.cpp.
Referenced by ADC(), read(), Run(), update_adc_report(), and update_system_power().
|
private |
|
private |
sample buffer
Definition at line 99 of file adc.cpp.
Referenced by ADC(), read(), Run(), update_adc_report(), update_system_power(), and ~ADC().
|
private |
Definition at line 101 of file adc.cpp.
Referenced by update_adc_report().
|
private |
Definition at line 102 of file adc.cpp.
Referenced by update_system_power().
|
staticprivate |