@betaflight/api
Version:
A high-level API to read data from betaflight flight controllers
70 lines (69 loc) • 5.57 kB
TypeScript
/// <reference types="node" />
import { ImuData, Axes3D, Status, ExtendedStatus, RCTuning, RCDeadband, AnalogValues, RawGpsData, BoardInfo, RebootTypes, AdvancedConfig, BeeperConfig, Sensors, RxConfig, Features, ChannelMap, GpsConfig, RssiConfig, BlackboxConfig, DataFlashSummary, SdCardSummary } from "./types";
export * from "./osd";
export * from "./power";
export * from "./pid";
export * from "./motors";
export * from "./serial";
export * from "./modes";
export * from "./vtx";
export * from "./types";
export { apiVersion, open, close, isOpen, bytesRead, bytesWritten, packetErrors, ports, baudRate, initialiseSerialBackend, } from "@betaflight/msp";
export { escProtocols, serialRxProviders, spiRxProtocols, rcInterpolations, rcSmoothingChannels, rcSmoothingTypes, rcSmoothingInputTypes, rcSmoothingDerivativeTypes, MCU_GROUPS, mcuGroupFromId, MIXER_LIST, availableFeatures, channelLetters, gpsProtocols, blackboxDevices, } from "./features";
export { mergeDeep } from "./utils";
export declare const readBoardInfo: (port: string) => Promise<BoardInfo>;
export declare const readFcVariant: (port: string) => Promise<string>;
export declare const readName: (port: string) => Promise<string>;
export declare const writeName: (port: string, name: string) => Promise<void>;
export declare const readUID: (port: string) => Promise<string>;
export declare const readAnalogValues: (port: string) => Promise<AnalogValues>;
export declare const readRawGPS: (port: string) => Promise<RawGpsData>;
export declare const readIMUData: (port: string) => Promise<ImuData>;
export declare const readAttitude: (port: string) => Promise<Axes3D>;
export declare const readStatus: (port: string) => Promise<Status>;
export declare const readExtendedStatus: (port: string) => Promise<ExtendedStatus>;
export declare const readEnabledFeatures: (port: string) => Promise<Features[]>;
export declare const writeEnabledFeatures: (port: string, features: Features[]) => Promise<void>;
export declare const readRcValues: (port: string) => Promise<number[]>;
export declare const readRCTuning: (port: string) => Promise<RCTuning>;
export declare const readRCDeadband: (port: string) => Promise<RCDeadband>;
export declare const writeArming: (port: string, { armingDisabled, runawayTakeoffPreventionDisabled, }: {
armingDisabled: boolean;
runawayTakeoffPreventionDisabled: boolean;
}) => Promise<void>;
export declare const calibrateAccelerometer: (port: string) => Promise<void>;
export declare const resetConfig: (port: string) => Promise<void>;
/**
* Set the device to reboot, returning true if successful
*/
export declare const reboot: (port: string, type?: RebootTypes | undefined) => Promise<boolean>;
export declare const commit: (port: string) => Promise<void>;
export declare const readBoardAlignmentConfig: (port: string) => Promise<Axes3D>;
export declare const writeBoardAlignmentConfig: (port: string, { roll, pitch, yaw }: Axes3D) => Promise<void>;
export declare const readAdvancedConfig: (port: string) => Promise<AdvancedConfig>;
export declare const writeAdvancedConfig: (port: string, config: AdvancedConfig) => Promise<void>;
export declare const writePartialAdvancedConfig: (port: string, config: import("./utils").RecursivePartial<AdvancedConfig>) => Promise<void>;
export declare const readBeeperConfig: (port: string) => Promise<BeeperConfig>;
export declare const writeBeeperConfig: (port: string, config: BeeperConfig) => Promise<void>;
export declare const writePartialBeeperConfig: (port: string, config: import("./utils").RecursivePartial<BeeperConfig>) => Promise<void>;
export declare const readDisabledSensors: (port: string) => Promise<Sensors[]>;
export declare const writeDisabledSensors: (port: string, disabledSensors: Sensors[]) => Promise<void>;
export declare const readRxConfig: (port: string) => Promise<RxConfig>;
export declare const writeRxConfig: (port: string, config: RxConfig) => Promise<void>;
export declare const writePartialRxConfig: (port: string, config: import("./utils").RecursivePartial<RxConfig>) => Promise<void>;
export declare const readRxMap: (port: string) => Promise<ChannelMap>;
export declare const writeRxMap: (port: string, map: [import("./types").ChannelLetter, import("./types").ChannelLetter, import("./types").ChannelLetter, import("./types").ChannelLetter, import("./types").ChannelLetter, import("./types").ChannelLetter, import("./types").ChannelLetter, import("./types").ChannelLetter]) => Promise<void>;
export declare const readRssiConfig: (port: string) => Promise<RssiConfig>;
export declare const writeRssiConfig: (port: string, config: RssiConfig) => Promise<void>;
export declare const readGpsConfig: (port: string) => Promise<GpsConfig>;
export declare const writeGpsConfig: (port: string, config: GpsConfig) => Promise<void>;
export declare const readBlackboxConfig: (port: string) => Promise<BlackboxConfig>;
export declare const writeBlackboxConfig: (port: string, config: Omit<BlackboxConfig, "supported">) => Promise<void>;
export declare const writePartialBlackboxConfig: (port: string, config: import("./utils").RecursivePartial<BlackboxConfig>) => Promise<void>;
/**
* Return the base 64 encoded result of the blackbox config
*/
export declare const readDataFlashChunk: (port: string, address: number, blockSize: number) => Promise<Buffer>;
export declare const readDataFlashSummary: (port: string) => Promise<DataFlashSummary>;
export declare const readSdCardSummary: (port: string) => Promise<SdCardSummary>;
export declare const eraseDataFlash: (port: string) => Promise<void>;