Control remoto universal con gestos
Dependencies: RemoteIR X_NUCLEO_IKS01A2 mbed
Fork of 6DOrientation_IKS01A2 by
Diff: main.cpp
- Revision:
- 7:d598eeaedcbd
- Parent:
- 6:f215defe10e4
- Child:
- 8:459b84a5287b
diff -r f215defe10e4 -r d598eeaedcbd main.cpp --- a/main.cpp Wed Nov 23 16:44:59 2016 +0000 +++ b/main.cpp Thu Nov 24 16:44:18 2016 +0000 @@ -49,19 +49,19 @@ InterruptIn mybutton(USER_BUTTON); DigitalOut myled(LED1); -volatile int orientation = 0; +volatile int mems_event = 0; volatile int send_orientation_request = 0; -void pressed(); -void orientation_cb(); -void sendOrientation( void ); +void pressed_cb(); +void INT1_cb(); +void sendOrientation(); /* Simple main function */ int main() { /* Attach callback to User button press */ - mybutton.fall(&pressed); + mybutton.fall(&pressed_cb); /* Attach callback to LSM6DSL INT1 */ - acc_gyro->AttachINT1IRQ(&orientation_cb); + acc_gyro->AttachINT1IRQ(&INT1_cb); /* Enable LSM6DSL accelerometer */ acc_gyro->Enable_X(); @@ -71,8 +71,8 @@ printf("\r\n--- Starting new run ---\r\n"); while(1) { - if (orientation) { - orientation = 0; + if (mems_event) { + mems_event = 0; LSM6DSL_Event_Status_t status; acc_gyro->Get_Event_Status(&status); if (status.D6DOrientationStatus) { @@ -93,15 +93,15 @@ } } -void pressed() { +void pressed_cb() { send_orientation_request = 1; } -void orientation_cb() { - orientation = 1; +void INT1_cb() { + mems_event = 1; } -void sendOrientation( void ) { +void sendOrientation() { uint8_t xl = 0; uint8_t xh = 0; uint8_t yl = 0;