Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
#include "modules/actuators/dshot_erps.h"
Go to the source code of this file.
Functions | |
static uint8_t | crc4 (uint16_t val) |
calculate crc4 More... | |
static DshotEPeriodPacket | eperiodToPacked (const uint32_t eperiod) |
encode packet from eperiod More... | |
static uint32_t | greyEncode (uint32_t num) |
get grey binary value from natural binary More... | |
static uint32_t | greyDecode (const uint32_t num) |
get natural binary value from grey binary More... | |
static uint32_t | gcrEncode (uint32_t from) |
encode 16 bit value to 20 bits GCR More... | |
static uint32_t | gcrDecode (uint32_t from) |
decode 20 bits GCR value to 16 bits natural More... | |
static uint32_t | eperiodEncode (const uint16_t eperiod) |
encode eperiod to 20 bits GCR of grey value More... | |
static uint32_t | eperiodDecode (const uint32_t frame) |
decode 20 bits GCR of grey value to eperiod More... | |
static void | setFromEperiod (DshotErps *derpsp, uint32_t eperiod) |
initialize from eperiod in microseconds More... | |
static void | frameToPacket (DshotErps *derpsp) |
decode eperiod More... | |
static void | packetToFrame (DshotErps *derpsp) |
encode eperiod More... | |
const DshotErps * | DshotErpsSetFromFrame (DshotErps *derpsp, uint32_t frame) |
initialise from GCR encoded frame More... | |
const DshotErps * | DshotErpsSetFromRpm (DshotErps *derpsp, uint32_t rpm) |
initialise from rpm value More... | |
uint32_t | DshotErpsGetEperiod (const DshotErps *derpsp) |
return eperiod from mantisse and exponent More... | |
uint32_t | DshotErpsGetRpm (const DshotErps *derpsp) |
calculate and return rpm More... | |
bool | DshotErpsCheckCrc4 (const DshotErps *derpsp) |
check packed validity More... | |
Variables | |
static const uint8_t | gcrNibble [16] |
IBM GCR encoding lookup table. More... | |
static const uint8_t | gcrNibbleInv [32] |
IBM GCR decoding lookup table. More... | |
calculate crc4
[in] | val |
Definition at line 111 of file dshot_erps.c.
References val.
Referenced by DshotErpsCheckCrc4(), and eperiodToPacked().
bool DshotErpsCheckCrc4 | ( | const DshotErps * | derpsp | ) |
check packed validity
[in] | derpsp | pointer to the DshotErps object |
Definition at line 99 of file dshot_erps.c.
References crc4(), DshotErps::ep, and DshotEPeriodPacket::rawFrame.
return eperiod from mantisse and exponent
[in] | derpsp | pointer to the DshotErps object |
Definition at line 72 of file dshot_erps.c.
References DshotErps::ep.
Referenced by DshotErpsGetRpm().
calculate and return rpm
[in] | derpsp | pointer to the DshotErps object |
Definition at line 87 of file dshot_erps.c.
References DshotErpsGetEperiod().
initialise from GCR encoded frame
[in] | derpsp | pointer to the DshotErps object @api |
Definition at line 44 of file dshot_erps.c.
References DshotErps::ef, frame, and frameToPacket().
initialise from rpm value
[in] | derpsp | pointer to the DshotErps object @api |
Definition at line 57 of file dshot_erps.c.
References rpm, and setFromEperiod().
decode 20 bits GCR of grey value to eperiod
[in] | GCR(0,2) | encoded value received from ESC |
Definition at line 230 of file dshot_erps.c.
References frame, gcrDecode(), and greyDecode().
Referenced by frameToPacket().
encode eperiod to 20 bits GCR of grey value
[in] | eperiod | in microseconds |
Definition at line 218 of file dshot_erps.c.
References gcrEncode(), and greyEncode().
Referenced by packetToFrame().
|
static |
encode packet from eperiod
[in] | eperiod | in microseconds |
Definition at line 124 of file dshot_erps.c.
Referenced by setFromEperiod().
|
static |
decode eperiod
[in,out] | derpsp | pointer to the DshotErps object |
Definition at line 254 of file dshot_erps.c.
References DshotErps::ef, DshotErps::ep, eperiodDecode(), and DshotEPeriodPacket::rawFrame.
Referenced by DshotErpsSetFromFrame().
decode 20 bits GCR value to 16 bits natural
[in] | GCR(0,2) | encoded value |
Definition at line 194 of file dshot_erps.c.
References gcrNibbleInv.
Referenced by eperiodDecode().
encode 16 bit value to 20 bits GCR
[in] | binary | value |
Definition at line 175 of file dshot_erps.c.
References gcrNibble.
Referenced by eperiodEncode().
get natural binary value from grey binary
[in] | grey | encoded value |
Definition at line 163 of file dshot_erps.c.
Referenced by eperiodDecode().
get grey binary value from natural binary
[in] | num | natural binary value |
Definition at line 146 of file dshot_erps.c.
Referenced by eperiodEncode().
|
static |
encode eperiod
[in,out] | derpsp | pointer to the DshotErps object |
Definition at line 266 of file dshot_erps.c.
References DshotErps::ef, DshotErps::ep, eperiodEncode(), and DshotEPeriodPacket::rawFrame.
Referenced by setFromEperiod().
initialize from eperiod in microseconds
[in] | derpsp | pointer to the DshotErps object |
[in] | eperiod | in microseconds |
Definition at line 242 of file dshot_erps.c.
References DshotErps::ep, eperiodToPacked(), and packetToFrame().
Referenced by DshotErpsSetFromRpm().
|
static |
IBM GCR encoding lookup table.
Definition at line 8 of file dshot_erps.c.
Referenced by gcrEncode().
|
static |
IBM GCR decoding lookup table.
Definition at line 15 of file dshot_erps.c.
Referenced by gcrDecode().