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

Method write

libraries/AP_HAL_ChibiOS/GPIO.cpp:252–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250}
251
252void GPIO::write(uint8_t pin, uint8_t value)
253{
254 struct gpio_entry *g = gpio_by_pin_num(pin);
255 if (g) {
256 if (g->is_input) {
257 // control pullup/pulldown
258 g->mode = value==1?PAL_MODE_INPUT_PULLUP:PAL_MODE_INPUT_PULLDOWN;
259 palSetLineMode(g->pal_line, g->mode);
260 } else if (value == PAL_LOW) {
261 palClearLine(g->pal_line);
262 } else {
263 palSetLine(g->pal_line);
264 }
265 return;
266 }
267#if HAL_WITH_IO_MCU
268 if (AP_BoardConfig::io_enabled() && iomcu.valid_GPIO_pin(pin)) {
269 iomcu.write_GPIO(pin, value);
270 }
271#endif
272}
273
274void GPIO::toggle(uint8_t pin)
275{

Callers 15

flash_bootloaderMethod · 0.45
rxbuff_full_irqMethod · 0.45
_writeMethod · 0.45
_rx_timer_tickMethod · 0.45
set_optionsMethod · 0.45
_storage_openMethod · 0.45
_save_backupMethod · 0.45
_timer_tickMethod · 0.45
_flash_writeMethod · 0.45
_flash_write_dataMethod · 0.45
write_dma_headerFunction · 0.45
dma_parse.pyFile · 0.45

Calls 3

valid_GPIO_pinMethod · 0.80
write_GPIOMethod · 0.80
gpio_by_pin_numFunction · 0.70

Tested by

no test coverage detected