Lines Matching +full:row +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)));
161 SCROLL_SPEED, "%s", select->choice[select_idx].str); in pong_select()
168 select_idx = (select_idx + 1) % select->choice_count; in pong_select_change()
170 SCROLL_SPEED, "%s", select->choice[select_idx].str); in pong_select_change()
176 void (*complete)(int val) = select->complete; in pong_select_complete()
177 int val = select->choice[select_idx].val; in pong_select_complete()
192 ball_pos.y = -1; in game_init()
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()
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()
529 printk("%s: device not ready.\n", pwm.dev->name); in main()
548 img.row[PADDLE_ROW] = (BIT(paddle_x) | BIT(paddle_x + 1)); in main()
551 img.row[VIRT_TO_REAL(ball_pos.y)] = in main()