Lines Matching +full:disp +full:- +full:gpios
4 * SPDX-License-Identifier: Apache-2.0
21 /* The micro:bit has a 5x5 LED display, using (x, y) notation the top-left
22 * corner has coordinates (0, 0) and the bottom-right has (4, 4). To make
24 * system where top-left is (0, 0) and bottom-right is (49, 49).
37 #define BALL_VEL_Y_START -4 /* Default ball vertical speed */
52 /* Ball starting position (just to the left of the paddle mid-point) */
120 static const struct gpio_dt_spec sw0_gpio = GPIO_DT_SPEC_GET(DT_ALIAS(sw0), gpios);
121 static const struct gpio_dt_spec sw1_gpio = GPIO_DT_SPEC_GET(DT_ALIAS(sw1), gpios);
124 BUILD_ASSERT(DT_SAME_NODE(DT_GPIO_CTLR(DT_ALIAS(sw0), gpios), DT_GPIO_CTLR(DT_ALIAS(sw1), gpios)));
150 struct mb_display *disp = mb_display_get(); in pong_select() local
160 mb_display_print(disp, MB_DISPLAY_MODE_DEFAULT | MB_DISPLAY_FLAG_LOOP, in pong_select()
161 SCROLL_SPEED, "%s", select->choice[select_idx].str); in pong_select()
166 struct mb_display *disp = mb_display_get(); in pong_select_change() local
168 select_idx = (select_idx + 1) % select->choice_count; in pong_select_change()
169 mb_display_print(disp, MB_DISPLAY_MODE_DEFAULT | MB_DISPLAY_FLAG_LOOP, in pong_select_change()
170 SCROLL_SPEED, "%s", select->choice[select_idx].str); in pong_select_change()
175 struct mb_display *disp = mb_display_get(); in pong_select_complete() local
176 void (*complete)(int val) = select->complete; in pong_select_complete()
177 int val = select->choice[select_idx].val; in pong_select_complete()
179 mb_display_stop(disp); in pong_select_complete()
192 ball_pos.y = -1; in game_init()
203 struct mb_display *disp = mb_display_get(); in mode_selected() local
214 mb_display_print(disp, in mode_selected()
245 delta = a_timestamp - b_timestamp; in check_start()
247 delta = b_timestamp - a_timestamp; in check_start()
264 ball_vel.x = -2 - rnd; in check_start()
274 struct mb_display *disp = mb_display_get(); in game_ended() local
290 mb_display_image(disp, MB_DISPLAY_MODE_SINGLE, in game_ended()
299 mb_display_image(disp, MB_DISPLAY_MODE_SINGLE, in game_ended()
342 ball_pos.y = -ball_pos.y; in game_refresh()
343 ball_vel.y = -ball_vel.y; in game_refresh()
346 ble_send_ball(BALL_POS_X_MAX - ball_pos.x, ball_pos.y, in game_refresh()
347 -ball_vel.x, -ball_vel.y); in game_refresh()
353 /* Check for side-wall collision */ in game_refresh()
355 ball_pos.x = -ball_pos.x; in game_refresh()
356 ball_vel.x = -ball_vel.x; in game_refresh()
359 ball_pos.x = (2 * BALL_POS_X_MAX) - ball_pos.x; in game_refresh()
360 ball_vel.x = -ball_vel.x; in game_refresh()
375 ball_pos.y = (2 * BALL_POS_Y_MAX) - ball_pos.y; in game_refresh()
382 ball_vel.y = -ball_vel.y; in game_refresh()
421 if (ended && (k_uptime_get() - ended) > RESTART_THRESHOLD) { in button_pressed()
425 printk("WARNING: Data-race (work and event)\n"); in button_pressed()
451 paddle_x--; in button_pressed()
453 ball_pos.x -= PIXEL_SIZE; in button_pressed()
504 printk("%s: device not ready.\n", sw0_gpio.port->name); in configure_buttons()
522 struct mb_display *disp = mb_display_get(); in main() local
529 printk("%s: device not ready.\n", pwm.dev->name); in main()
555 mb_display_image(disp, MB_DISPLAY_MODE_SINGLE, in main()