Code formatting

This commit is contained in:
Eiren Rain
2021-01-05 16:31:43 +03:00
parent 6d79d60a09
commit 5d15c18fba
3 changed files with 10 additions and 11 deletions

View File

@@ -14,23 +14,22 @@ configRecievedCallback fp_configCallback;
commandRecievedCallback fp_commandCallback;
template <typename T>
unsigned char *convert_to_chars(T src, unsigned char *target)
unsigned char * convert_to_chars(T src, unsigned char * target)
{
union
union uwunion
{
unsigned char c[sizeof(T)];
T v;
} un;
un.v = src;
};
for (int i = 0; i < sizeof(T); i++)
{
target[i] = un.c[sizeof(T) - i - 1];
target[i] = ((uwunion *) &src)->c[sizeof(T) - i - 1];
}
return target;
}
template <typename T>
T convert_chars(unsigned char *const src)
T convert_chars(unsigned char * const src)
{
union
{

View File

@@ -25,8 +25,8 @@
#define COMMAND_SEND_CONFIG 2
#define COMMAND_BLINK 3
typedef void (* configRecievedCallback)(DeviceConfig const);
typedef void (* commandRecievedCallback)(int, void * const, int);
typedef void (* configRecievedCallback)(DeviceConfig const newConfig);
typedef void (* commandRecievedCallback)(int command, void * const commandData, int commandDataLength);
void connectClient();
void clientUpdate();

View File

@@ -75,7 +75,7 @@ unsigned long blinkStart = 0;
static float q[4] = {1.0, 0.0, 0.0, 0.0};
static const Quat rotationQuat = Quat(Vector3(0, 0, 1), PI / 2.0); // Adjust rotation to match Android rotations
void get_MPU_scaled(void);
void get_MPU_scaled();
void MahonyQuaternionUpdate(float ax, float ay, float az, float gx, float gy, float gz, float mx, float my, float mz, float deltat);
void setConfig(DeviceConfig newConfig)
@@ -84,7 +84,7 @@ void setConfig(DeviceConfig newConfig)
saveConfig(&config);
}
void commandRecieved(int command, void *const data, int dataLength)
void commandRecieved(int command, void * const commandData, int commandDataLength)
{
switch (command)
{
@@ -187,7 +187,7 @@ void loop()
}
}
void get_MPU_scaled(void)
void get_MPU_scaled()
{
float temp[3];
int i;