File tree 2 files changed +11
-0
lines changed
2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -375,6 +375,16 @@ int microbit_hal_display_read_light_level(void) {
375
375
return uBit.display .readLightLevel ();
376
376
}
377
377
378
+ void microbit_hal_display_rotate (unsigned int rotation) {
379
+ static DisplayRotation angle_map[4 ] = {
380
+ MATRIX_DISPLAY_ROTATION_0,
381
+ MATRIX_DISPLAY_ROTATION_90,
382
+ MATRIX_DISPLAY_ROTATION_180,
383
+ MATRIX_DISPLAY_ROTATION_270,
384
+ };
385
+ uBit.display .rotateTo (angle_map[rotation & 3 ]);
386
+ }
387
+
378
388
void microbit_hal_accelerometer_get_sample (int axis[3 ]) {
379
389
Sample3D sample = uBit.accelerometer .getSample ();
380
390
axis[0 ] = sample.x ;
Original file line number Diff line number Diff line change @@ -150,6 +150,7 @@ void microbit_hal_display_enable(int value);
150
150
int microbit_hal_display_get_pixel (int x , int y );
151
151
void microbit_hal_display_set_pixel (int x , int y , int bright );
152
152
int microbit_hal_display_read_light_level (void );
153
+ void microbit_hal_display_rotate (unsigned int rotation );
153
154
154
155
void microbit_hal_accelerometer_get_sample (int axis [3 ]);
155
156
int microbit_hal_accelerometer_get_gesture (void );
You can’t perform that action at this time.
0 commit comments