Niet van mijzelf

Dependencies:   USBHost USBHostXpad mbed-rtos mbed

Fork of x4180_Tank by C K

Committer:
347467
Date:
Wed Feb 25 08:38:37 2015 +0000
Revision:
10:7e3987c8fa37
Parent:
3:c1620db50a75
Xboxcontroller;

Who changed what in which revision?

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