mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 05:43:35 +08:00
STM32 drivers: move to 0 based index
This commit is contained in:
@@ -144,7 +144,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
ADC::ADC(uint32_t channels) :
|
ADC::ADC(uint32_t channels) :
|
||||||
CDev("adc", ADC_DEVICE_PATH),
|
CDev("adc", ADC0_DEVICE_PATH),
|
||||||
_sample_perf(perf_alloc(PC_ELAPSED, "adc_samples")),
|
_sample_perf(perf_alloc(PC_ELAPSED, "adc_samples")),
|
||||||
_channel_count(0),
|
_channel_count(0),
|
||||||
_samples(nullptr),
|
_samples(nullptr),
|
||||||
@@ -381,7 +381,7 @@ void
|
|||||||
test(void)
|
test(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
int fd = open(ADC_DEVICE_PATH, O_RDONLY);
|
int fd = open(ADC0_DEVICE_PATH, O_RDONLY);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
err(1, "can't open ADC device");
|
err(1, "can't open ADC device");
|
||||||
|
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ extern "C" __EXPORT int tone_alarm_main(int argc, char *argv[]);
|
|||||||
|
|
||||||
|
|
||||||
ToneAlarm::ToneAlarm() :
|
ToneAlarm::ToneAlarm() :
|
||||||
CDev("tone_alarm", TONEALARM_DEVICE_PATH),
|
CDev("tone_alarm", TONEALARM0_DEVICE_PATH),
|
||||||
_default_tune_number(0),
|
_default_tune_number(0),
|
||||||
_user_tune(nullptr),
|
_user_tune(nullptr),
|
||||||
_tune(nullptr),
|
_tune(nullptr),
|
||||||
@@ -830,10 +830,10 @@ play_tune(unsigned tune)
|
|||||||
{
|
{
|
||||||
int fd, ret;
|
int fd, ret;
|
||||||
|
|
||||||
fd = open(TONEALARM_DEVICE_PATH, 0);
|
fd = open(TONEALARM0_DEVICE_PATH, 0);
|
||||||
|
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
err(1, TONEALARM_DEVICE_PATH);
|
err(1, TONEALARM0_DEVICE_PATH);
|
||||||
|
|
||||||
ret = ioctl(fd, TONE_SET_ALARM, tune);
|
ret = ioctl(fd, TONE_SET_ALARM, tune);
|
||||||
close(fd);
|
close(fd);
|
||||||
@@ -849,10 +849,10 @@ play_string(const char *str, bool free_buffer)
|
|||||||
{
|
{
|
||||||
int fd, ret;
|
int fd, ret;
|
||||||
|
|
||||||
fd = open(TONEALARM_DEVICE_PATH, O_WRONLY);
|
fd = open(TONEALARM0_DEVICE_PATH, O_WRONLY);
|
||||||
|
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
err(1, TONEALARM_DEVICE_PATH);
|
err(1, TONEALARM0_DEVICE_PATH);
|
||||||
|
|
||||||
ret = write(fd, str, strlen(str) + 1);
|
ret = write(fd, str, strlen(str) + 1);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|||||||
Reference in New Issue
Block a user