Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of MyLib by
Diff: PS3/PS3.cpp
- Revision:
- 9:1c0640c61fce
- Parent:
- 1:c75100913a65
diff -r dd476889a42e -r 1c0640c61fce PS3/PS3.cpp
--- a/PS3/PS3.cpp Thu May 11 10:58:25 2017 +0000
+++ b/PS3/PS3.cpp Thu May 11 11:04:30 2017 +0000
@@ -87,29 +87,29 @@
int8_t PS3::analogLX()
{
if(PS3Data[3] == 0)
- PS3Data[3]=1;
- return PS3Data[3]-64;
+ PS3Data[3] = 1;
+ return PS3Data[3] - 64;
}
int8_t PS3::analogLY()
{
if(PS3Data[4] == 0)
- PS3Data[4]=1;
- return (PS3Data[4]-64)*(-1);
+ PS3Data[4] = 1;
+ return (PS3Data[4] - 64) * (-1);
}
int8_t PS3::analogRX()
{
if(PS3Data[5] == 0)
- PS3Data[5]=1;
- return PS3Data[5]-64;
+ PS3Data[5] = 1;
+ return PS3Data[5] - 64;
}
int8_t PS3::analogRY()
{
if(PS3Data[6] == 0)
- PS3Data[6]=1;
- return (PS3Data[6]-64)*(-1);
+ PS3Data[6] = 1;
+ return (PS3Data[6] - 64) * (-1);
}
@@ -119,25 +119,25 @@
while(Serial::getc() != 128)
{
}
- for(int i = 1;i < 8;i++)
+ for(int i = 1; i < 8; i++)
{
GetData[i] = Serial::getc();
}
sum = GetData[1] + GetData[2];
- for(int i = 3;i < 7;i++)
+ for(int i = 3; i < 7; i++)
{
sum += GetData[i] - 64;
}
if(sum < 0)
- sum+=128;
+ sum += 128;
if(sum == GetData[7])
{
- for(int i = 0;i < 8;i++)
+ for(int i = 0; i < 8; i++)
{
- PS3Data[i]=GetData[i];
+ PS3Data[i] = GetData[i];
}
}
}
\ No newline at end of file
