crtpNRF51.h
Go to the documentation of this file.
00001 #pragma once
00002 #include <cstdint>
00003 
00004 // Header
00005 struct crtpNrf51Header
00006 {
00007   constexpr crtpNrf51Header(
00008     uint8_t target,
00009     uint8_t cmd)
00010     : header(0xFF)
00011     , target(target)
00012     , cmd(cmd)
00013   {
00014   }
00015 
00016   uint8_t header;
00017   uint8_t target;
00018   uint8_t cmd;
00019 } __attribute__((packed));
00020 
00021 // RESET_INIT
00022 
00023 struct crtpNrf51ResetInitRequest
00024 {
00025   crtpNrf51ResetInitRequest()
00026     : header(0xFE, 0xFF)
00027   {
00028   }
00029 
00030   crtpNrf51Header header;
00031 } __attribute__((packed));
00032 
00033 struct crtpNrf51ResetInitResponse
00034 {
00035   crtpNrf51ResetInitRequest request;
00036   uint8_t addr[6];
00037 } __attribute__((packed));
00038 
00039 // RESET
00040 
00041 struct crtpNrf51ResetRequest
00042 {
00043   crtpNrf51ResetRequest(
00044     uint8_t bootToFirmware)
00045     : header(0xFE, 0xF0)
00046     , bootToFirmware(bootToFirmware)
00047   {
00048   }
00049 
00050   crtpNrf51Header header;
00051   uint8_t bootToFirmware; //0=boot to bootloader; otherwise: boot to firmware
00052 } __attribute__((packed));
00053 
00054 /* no response sent */
00055 
00056 // ALLOFF
00057 
00058 struct crtpNrf51AllOffRequest
00059 {
00060   crtpNrf51AllOffRequest()
00061     : header(0xFE, 0x01)
00062   {
00063   }
00064 
00065   crtpNrf51Header header;
00066 } __attribute__((packed));
00067 
00068 /* no response sent */
00069 
00070 // SYSOFF
00071 
00072 struct crtpNrf51SysOffRequest
00073 {
00074   crtpNrf51SysOffRequest()
00075     : header(0xFE, 0x02)
00076   {
00077   }
00078 
00079   crtpNrf51Header header;
00080 } __attribute__((packed));
00081 
00082 /* no response sent */
00083 
00084 // SYSON
00085 
00086 struct crtpNrf51SysOnRequest
00087 {
00088   crtpNrf51SysOnRequest()
00089     : header(0xFE, 0x03)
00090   {
00091   }
00092 
00093   crtpNrf51Header header;
00094 } __attribute__((packed));
00095 
00096 /* no response sent */
00097 
00098 // GETVBAT
00099 
00100 struct crtpNrf51GetVBatRequest
00101 {
00102   crtpNrf51GetVBatRequest()
00103     : header(0xFE, 0x04)
00104   {
00105   }
00106 
00107   crtpNrf51Header header;
00108 } __attribute__((packed));
00109 
00110 struct crtpNrf51GetVBatResponse
00111 {
00112   crtpNrf51GetVBatRequest request;
00113   float vbat;
00114 } __attribute__((packed));
00115 
00117 
00118 struct crtpNrf51SetSafelinkRequest
00119 {
00120 
00121   crtpNrf51SetSafelinkRequest(
00122     uint8_t hasSafelink)
00123     : hasSafelink(hasSafelink)
00124   {
00125   }
00126 
00127   const uint8_t header1 = 0xFF;
00128   const uint8_t header2 = 0x05;
00129   uint8_t hasSafelink;
00130 } __attribute__((packed));


crazyflie_cpp
Author(s): Wolfgang Hoenig
autogenerated on Wed Jun 12 2019 19:20:44