LCOV - code coverage report
Current view: top level - AP_HAL_SITL - RCOutput.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 8 8 100.0 %
Date: 2026-09-09 11:02:08 Functions: 4 4 100.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include <AP_HAL/AP_HAL.h>
       4             : #if CONFIG_HAL_BOARD == HAL_BOARD_SITL
       5             : #include "AP_HAL_SITL.h"
       6             : #include <AP_ESC_Telem/AP_ESC_Telem_SITL.h>
       7             : 
       8             : class HALSITL::RCOutput : public AP_HAL::RCOutput {
       9             : public:
      10        2145 :     explicit RCOutput(SITL_State *sitlState): _sitlState(sitlState), _freq_hz(50) {}
      11             :     void init() override;
      12             :     void set_freq(uint32_t chmask, uint16_t freq_hz) override;
      13             :     uint16_t get_freq(uint8_t ch) override;
      14             :     void enable_ch(uint8_t ch) override;
      15             :     void disable_ch(uint8_t ch) override;
      16             :     void write(uint8_t ch, uint16_t period_us) override;
      17             :     uint16_t read(uint8_t ch) override;
      18             :     void read(uint16_t* period_us, uint8_t len) override;
      19             :     void cork(void) override;
      20             :     void push(void) override;
      21             : 
      22             :     /*
      23             :       force the safety switch on, disabling PWM output from the IO board
      24             :      */
      25        1648 :     bool force_safety_on(void) override {
      26        1648 :         safety_state = AP_HAL::Util::SAFETY_DISARMED;
      27        1648 :         return true;
      28             :     }
      29             :     /*
      30             :       force the safety switch off, enabling PWM output from the IO board
      31             :      */
      32        2095 :     void force_safety_off(void) override {
      33        2095 :         safety_state = AP_HAL::Util::SAFETY_ARMED;
      34        2095 :     }
      35             : 
      36             :     /*
      37             :       get safety switch state, used by Util.cpp
      38             :     */
      39    41698406 :     AP_HAL::Util::safety_state _safety_switch_state(void) { return safety_state; }
      40             : 
      41             :     /*
      42             :       Serial LED emulation
      43             :      */
      44             :     bool set_serial_led_num_LEDs(const uint16_t chan, uint8_t num_leds, output_mode mode = MODE_PWM_NONE, uint32_t clock_mask = 0) override;
      45             :     bool set_serial_led_rgb_data(const uint16_t chan, int8_t led, uint8_t red, uint8_t green, uint8_t blue) override;
      46             :     bool serial_led_send(const uint16_t chan) override;
      47             :     
      48             : private:
      49             :     SITL_State *_sitlState;
      50             :     AP_ESC_Telem_SITL *esc_telem;
      51             : 
      52             :     uint16_t _freq_hz;
      53             :     uint32_t _enable_mask;
      54             :     bool _corked;
      55             :     uint16_t _pending[SITL_NUM_CHANNELS];
      56             : 
      57             :     AP_HAL::Util::safety_state safety_state = AP_HAL::Util::safety_state::SAFETY_DISARMED;
      58             : };
      59             : 
      60             : #endif

Generated by: LCOV version 1.14