Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
dshot_erps.h File Reference
#include <ch.h>
#include <hal.h>
+ Include dependency graph for dshot_erps.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

union  DshotEPeriodPacket
 ERPS classic rpm frame. More...
 
union  DshotEPeriodTelemetry
 ERPS telemetry frame. More...
 
struct  DshotErps
 ERPS complete frame, raw and decoded. More...
 
struct  DshotEPeriodPacket.__unnamed2__
 
struct  DshotEPeriodTelemetry.__unnamed4__
 

Enumerations

enum  EdtType {
  EDT_NOTEDT =0x0 , EDT_TEMP =0x2 , EDT_VOLT =0x4 , EDT_CURRENT =0x6 ,
  EDT_DBG1 =0x8 , EDT_DBG2 =0xA , EDT_STRESS =0xC , EDT_STATUS =0xE
}
 ERPS telemetry type. More...
 
enum  EdtStatus { EDT_STATUS_ALERT = 1<<7 , EDT_STATUS_WARNING = 1<<6 , EDT_STATUS_ERROR = 1<<5 }
 

Functions

const DshotErpsDshotErpsSetFromFrame (DshotErps *derpsp, uint32_t frame)
 initialise from GCR encoded frame
 
const DshotErpsDshotErpsSetFromRpm (DshotErps *derpsp, uint32_t rpm)
 initialise from rpm value
 
uint32_t DshotErpsGetEperiod (const DshotErps *derpsp)
 return eperiod from mantisse and exponent
 
uint32_t DshotErpsGetRpm (const DshotErps *derpsp)
 calculate and return rpm
 
bool DshotErpsCheckCrc4 (const DshotErps *derpsp)
 check packed validity
 
static uint32_t DshotErpsGetFrame (const DshotErps *derpsp)
 return encoded frame
 
static bool DshotErpsIsEdt (const DshotErps *derpsp)
 return true if current frame is a telemetry frame
 
static EdtType DshotErpsEdtType (const DshotErps *derpsp)
 return type of a telemetry frame
 
static uint8_t DshotErpsEdtTempCentigrade (const DshotErps *derpsp)
 return temperature for a temperature telemetry frame
 
static uint16_t DshotErpsEdtCentiVolts (const DshotErps *derpsp)
 return voltage for a voltage telemetry frame
 
static uint16_t DshotErpsEdtCurrentAmp (const DshotErps *derpsp)
 return current intensity for a current telemetry frame
 
static uint16_t DshotErpsEdtStress (const DshotErps *derpsp)
 return stress value
 
static uint16_t DshotErpsEdtStatus (const DshotErps *derpsp)
 return status value
 

Data Structure Documentation

◆ DshotEPeriodPacket

union DshotEPeriodPacket

ERPS classic rpm frame.

Definition at line 30 of file dshot_erps.h.

+ Collaboration diagram for DshotEPeriodPacket:
Data Fields
struct DshotEPeriodPacket.__unnamed2__ __unnamed__
uint16_t rawFrame

◆ DshotEPeriodTelemetry

union DshotEPeriodTelemetry

ERPS telemetry frame.

Definition at line 42 of file dshot_erps.h.

+ Collaboration diagram for DshotEPeriodTelemetry:
Data Fields
struct DshotEPeriodTelemetry.__unnamed4__ __unnamed__
uint16_t rawFrame

◆ DshotErps

struct DshotErps

ERPS complete frame, raw and decoded.

Definition at line 58 of file dshot_erps.h.

+ Collaboration diagram for DshotErps:
Data Fields
uint32_t ef
DshotEPeriodPacket ep

◆ DshotEPeriodPacket.__unnamed2__

struct DshotEPeriodPacket.__unnamed2__

Definition at line 31 of file dshot_erps.h.

Data Fields
uint16_t crc:4
uint16_t exponent:3
uint16_t mantisse:9

◆ DshotEPeriodTelemetry.__unnamed4__

struct DshotEPeriodTelemetry.__unnamed4__

Definition at line 43 of file dshot_erps.h.

Data Fields
uint16_t crc:4
EdtType edt_type:4
uint16_t edt_value:8

Enumeration Type Documentation

◆ EdtStatus

Enumerator
EDT_STATUS_ALERT 
EDT_STATUS_WARNING 
EDT_STATUS_ERROR 

Definition at line 21 of file dshot_erps.h.

◆ EdtType

ERPS telemetry type.

Note
last (as of mid 2022) addition to the dshot bidir protocol
Enumerator
EDT_NOTEDT 
EDT_TEMP 
EDT_VOLT 
EDT_CURRENT 
EDT_DBG1 
EDT_DBG2 
EDT_STRESS 
EDT_STATUS 

Definition at line 14 of file dshot_erps.h.

Function Documentation

◆ DshotErpsCheckCrc4()

bool DshotErpsCheckCrc4 ( const DshotErps derpsp)

check packed validity

Parameters
[in]derpsppointer to the DshotErps object
Returns
true if CRC is OK @api

Definition at line 99 of file dshot_erps.c.

References crc4(), and foo.

+ Here is the call graph for this function:

◆ DshotErpsEdtCentiVolts()

static uint16_t DshotErpsEdtCentiVolts ( const DshotErps derpsp)
inlinestatic

return voltage for a voltage telemetry frame

Parameters
[in]derpsppointer to the DshotErps object @api

Definition at line 115 of file dshot_erps.h.

References foo.

◆ DshotErpsEdtCurrentAmp()

static uint16_t DshotErpsEdtCurrentAmp ( const DshotErps derpsp)
inlinestatic

return current intensity for a current telemetry frame

Parameters
[in]derpsppointer to the DshotErps object @api

Definition at line 124 of file dshot_erps.h.

References foo.

◆ DshotErpsEdtStatus()

static uint16_t DshotErpsEdtStatus ( const DshotErps derpsp)
inlinestatic

return status value

Parameters
[in]derpsppointer to the DshotErps object @api

Definition at line 144 of file dshot_erps.h.

References foo.

◆ DshotErpsEdtStress()

static uint16_t DshotErpsEdtStress ( const DshotErps derpsp)
inlinestatic

return stress value

Parameters
[in]derpsppointer to the DshotErps object @api

Definition at line 134 of file dshot_erps.h.

References foo.

◆ DshotErpsEdtTempCentigrade()

static uint8_t DshotErpsEdtTempCentigrade ( const DshotErps derpsp)
inlinestatic

return temperature for a temperature telemetry frame

Parameters
[in]derpsppointer to the DshotErps object @api

Definition at line 106 of file dshot_erps.h.

References foo.

◆ DshotErpsEdtType()

static EdtType DshotErpsEdtType ( const DshotErps derpsp)
inlinestatic

return type of a telemetry frame

Parameters
[in]derpsppointer to the DshotErps object @api

Definition at line 97 of file dshot_erps.h.

References foo.

◆ DshotErpsGetEperiod()

uint32_t DshotErpsGetEperiod ( const DshotErps derpsp)

return eperiod from mantisse and exponent

Parameters
[in]derpsppointer to the DshotErps object
Returns
eperiod in microseconds
Note
getEperiod avoid a division and is more cpu friendly than getRpm

Definition at line 72 of file dshot_erps.c.

References foo.

Referenced by DshotErpsGetRpm().

+ Here is the caller graph for this function:

◆ DshotErpsGetFrame()

static uint32_t DshotErpsGetFrame ( const DshotErps derpsp)
inlinestatic

return encoded frame

Parameters
[in]derpsppointer to the DshotErps object @api

Definition at line 77 of file dshot_erps.h.

References foo.

◆ DshotErpsGetRpm()

uint32_t DshotErpsGetRpm ( const DshotErps derpsp)

calculate and return rpm

Parameters
[in]derpsppointer to the DshotErps object
Returns
rotational speed in RPM
Note
involve a division, which is a cpu cycle hog, If you can use getEperiod instead, it will be less calculus intensive @api

Definition at line 87 of file dshot_erps.c.

References DshotErpsGetEperiod(), and foo.

+ Here is the call graph for this function:

◆ DshotErpsIsEdt()

static bool DshotErpsIsEdt ( const DshotErps derpsp)
inlinestatic

return true if current frame is a telemetry frame

Parameters
[in]derpsppointer to the DshotErps object @api

Definition at line 84 of file dshot_erps.h.

References foo, and DshotEPeriodTelemetry::rawFrame.

◆ DshotErpsSetFromFrame()

const DshotErps * DshotErpsSetFromFrame ( DshotErps derpsp,
uint32_t  frame 
)

initialise from GCR encoded frame

Parameters
[in]derpsppointer to the DshotErps object @api

Definition at line 44 of file dshot_erps.c.

References DshotErps::ef, foo, frame, and frameToPacket().

+ Here is the call graph for this function:

◆ DshotErpsSetFromRpm()

const DshotErps * DshotErpsSetFromRpm ( DshotErps derpsp,
uint32_t  rpm 
)

initialise from rpm value

Parameters
[in]derpsppointer to the DshotErps object @api

Definition at line 57 of file dshot_erps.c.

References foo, rpm, and setFromEperiod().

+ Here is the call graph for this function: