MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / init

Method init

libraries/AP_HAL_Linux/RCInput_PRU.cpp:27–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25using namespace Linux;
26
27void RCInput_PRU::init()
28{
29 int mem_fd = open("/dev/mem", O_RDWR|O_SYNC|O_CLOEXEC);
30 if (mem_fd == -1) {
31 AP_HAL::panic("Unable to open /dev/mem");
32 }
33 ring_buffer = (volatile struct ring_buffer*) mmap(0, 0x1000, PROT_READ|PROT_WRITE,
34 MAP_SHARED, mem_fd, RCIN_PRUSS_SHAREDRAM_BASE);
35 close(mem_fd);
36 ring_buffer->ring_head = 0;
37 _s0_time = 0;
38
39 // enable the spektrum RC input power
40 hal.gpio->pinMode(BBB_P8_17, HAL_GPIO_OUTPUT);
41 hal.gpio->write(BBB_P8_17, 1);
42}
43
44/*
45 called at 1kHz to check for new pulse capture data from the PRU

Callers

nothing calls this directly

Calls 3

panicFunction · 0.70
pinModeMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected