The project is not done yet

Dependencies:   USBHost USBHostXpad mbed-rtos mbed

Fork of Totaleprogramma by jordy morsinkhof

Committer:
juliandekker
Date:
Mon Mar 02 10:58:30 2015 +0000
Revision:
1:da390b3b1330
Parent:
0:345f76c72b9a
xbox controller robot

Who changed what in which revision?

UserRevisionLine numberNew contents of line
347467 0:345f76c72b9a 1 #include "utils.h"
347467 0:345f76c72b9a 2
347467 0:345f76c72b9a 3 double ghettoFloor(double d){
347467 0:345f76c72b9a 4 return double((long long)d);
347467 0:345f76c72b9a 5 }
347467 0:345f76c72b9a 6 double round(double d)
347467 0:345f76c72b9a 7 {
347467 0:345f76c72b9a 8 return ghettoFloor(d + 0.5);
347467 0:345f76c72b9a 9 }
347467 0:345f76c72b9a 10
347467 0:345f76c72b9a 11 float xpadNormalizeAnalog(int x){
347467 0:345f76c72b9a 12 float res = 0;
347467 0:345f76c72b9a 13 if(x > 0){
347467 0:345f76c72b9a 14 res = (float)x/32767.0;
347467 0:345f76c72b9a 15 }else{
347467 0:345f76c72b9a 16 res = (float)x/32768.0;
347467 0:345f76c72b9a 17 }
347467 0:345f76c72b9a 18 return res;
347467 0:345f76c72b9a 19 }
347467 0:345f76c72b9a 20 float xpadNormalizeTrigger(int x){
347467 0:345f76c72b9a 21 float res = (float)x / (float)0xff;
347467 0:345f76c72b9a 22 return res;
347467 0:345f76c72b9a 23 }