cc1101:
  id: transceiver
  cs_pin: ${cs_pin}
  gdo0_pin: ${gdo0_pin}
  frequency: 433.92MHz
  if_frequency: 153kHz
  filter_bandwidth: 203kHz
  channel: 0
  channel_spacing: 200kHz
  symbol_rate: 4800
  modulation_type: GFSK
  packet_mode: true
  packet_length: 8
  crc_enable: true
  whitening: false
  sync_mode: "16/16"
  sync0: 0x91
  sync1: 0xD3
  num_preamble: 2
  on_packet:
    then:
      - lambda: |-
          ESP_LOGD("cc1101", "packet %s freq_offset %.0f Hz rssi %.1f dBm lqi %u", format_hex(x).c_str(), freq_offset, rssi, lqi);

button:
  - platform: template
    name: "CC1101 Button"
    on_press:
      then:
        - cc1101.begin_tx: transceiver
        - cc1101.begin_rx: transceiver
        - cc1101.set_idle: transceiver
        - cc1101.reset: transceiver
        - cc1101.send_packet:
            data: [0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef]
        - cc1101.send_packet: !lambda |-
            return {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};

        - cc1101.set_frequency: !lambda |-
            return 433.91e6;
        - cc1101.set_frequency:
            value: "433.91MHz"
        - cc1101.set_frequency:
            value: 433911000
        - cc1101.set_frequency: 433912000

        - cc1101.set_output_power: !lambda |-
            return -29.9;
        - cc1101.set_output_power:
            value: "-28"
        - cc1101.set_output_power:
            value: 10
        - cc1101.set_output_power: 11

        - cc1101.set_modulation_type: !lambda |-
            return cc1101::Modulation::MODULATION_2_FSK;
        - cc1101.set_modulation_type:
            value: "4-FSK"
        - cc1101.set_modulation_type: "GFSK"

        - cc1101.set_symbol_rate: !lambda |-
            return 6000.0;
        - cc1101.set_symbol_rate:
            value: "7000.0"
        - cc1101.set_symbol_rate:
            value: 8000.0
        - cc1101.set_symbol_rate: 9000

        - cc1101.set_rx_attenuation: !lambda |-
            return cc1101::RxAttenuation::RX_ATTENUATION_0DB;
        - cc1101.set_rx_attenuation:
            value: "6dB"
        - cc1101.set_rx_attenuation: "12dB"

        - cc1101.set_dc_blocking_filter: !lambda |-
            return false;
        - cc1101.set_dc_blocking_filter:
            value: true
        - cc1101.set_dc_blocking_filter: false

        - cc1101.set_manchester: !lambda |-
            return false;
        - cc1101.set_manchester:
            value: true
        - cc1101.set_manchester: false

        - cc1101.set_filter_bandwidth: !lambda |-
            return 58e3;
        - cc1101.set_filter_bandwidth:
            value: "59kHz"
        - cc1101.set_filter_bandwidth:
            value: 60000
        - cc1101.set_filter_bandwidth: "61kHz"

        - cc1101.set_fsk_deviation: !lambda |-
            return 1.5e3;
        - cc1101.set_fsk_deviation:
            value: "1.6kHz"
        - cc1101.set_fsk_deviation:
            value: 1700
        - cc1101.set_fsk_deviation: "1.8kHz"

        - cc1101.set_msk_deviation: !lambda |-
            return 1;
        - cc1101.set_msk_deviation:
            value: "2"
        - cc1101.set_msk_deviation:
            value: 3
        - cc1101.set_msk_deviation: "4"

        - cc1101.set_channel: !lambda |-
            return 0;
        - cc1101.set_channel:
            value: "1"
        - cc1101.set_channel:
            value: 3
        - cc1101.set_channel: 3

        - cc1101.set_channel_spacing: !lambda |-
            return 25e3;
        - cc1101.set_channel_spacing:
            value: "26kHz"
        - cc1101.set_channel_spacing:
            value: 27000
        - cc1101.set_channel_spacing: "28kHz"

        - cc1101.set_if_frequency: !lambda |-
            return 25e3;
        - cc1101.set_if_frequency:
            value: "26kHz"
        - cc1101.set_if_frequency:
            value: 27000
        - cc1101.set_if_frequency: "28kHz"
