6
6
#error Please use lvgl >= 8.1
7
7
#endif
8
8
9
+ #include " mbed.h"
10
+
9
11
void my_print ( const char * dsc )
10
12
{
11
13
Serial.println (dsc);
12
14
}
13
15
16
+ using namespace std ::chrono_literals;
17
+
14
18
bool BraccioClass::begin (voidFuncPtr customMenu) {
15
19
16
20
Wire.begin ();
@@ -22,7 +26,7 @@ bool BraccioClass::begin(voidFuncPtr customMenu) {
22
26
static rtos::Thread th (osPriorityHigh);
23
27
th.start (mbed::callback (this , &BraccioClass::pd_thread));
24
28
attachInterrupt (PIN_FUSB302_INT, mbed::callback (this , &BraccioClass::unlock_pd_semaphore_irq), FALLING);
25
- pd_timer.attach (mbed::callback (this , &BraccioClass::unlock_pd_semaphore), 0 . 01f );
29
+ pd_timer.attach (mbed::callback (this , &BraccioClass::unlock_pd_semaphore), 10ms );
26
30
#endif
27
31
28
32
PD_UFP.init_PPS (PPS_V (7.2 ), PPS_A (2.0 ));
@@ -139,6 +143,8 @@ bool BraccioClass::begin(voidFuncPtr customMenu) {
139
143
static rtos::Thread connected_th;
140
144
connected_th.start (mbed::callback (this , &BraccioClass::motors_connected_thread));
141
145
#endif
146
+
147
+ return true ;
142
148
}
143
149
144
150
void BraccioClass::connectJoystickTo (lv_obj_t * obj) {
@@ -152,11 +158,11 @@ void BraccioClass::pd_thread() {
152
158
auto ret = pd_events.wait_any (0xFF );
153
159
if ((ret & 1 ) && (millis () - start_pd_burst > 1000 )) {
154
160
pd_timer.detach ();
155
- pd_timer.attach (mbed::callback (this , &BraccioClass::unlock_pd_semaphore), 1 . 0f );
161
+ pd_timer.attach (mbed::callback (this , &BraccioClass::unlock_pd_semaphore), 1s );
156
162
}
157
163
if (ret & 2 ) {
158
164
pd_timer.detach ();
159
- pd_timer.attach (mbed::callback (this , &BraccioClass::unlock_pd_semaphore), 0 . 05f );
165
+ pd_timer.attach (mbed::callback (this , &BraccioClass::unlock_pd_semaphore), 50ms );
160
166
}
161
167
i2c_mutex.lock ();
162
168
PD_UFP.run ();
0 commit comments