From f81fa883c4bd2fbebf3a49459808863e4eeae27a Mon Sep 17 00:00:00 2001 From: lonkaars Date: Mon, 29 May 2023 16:25:30 +0200 Subject: add controller test and swap p1 and p2 --- src/demo.c | 79 ++++++++++-------------------------------------------- src/stm32/consts.h | 32 +++++++++++----------- 2 files changed, 30 insertions(+), 81 deletions(-) (limited to 'src') diff --git a/src/demo.c b/src/demo.c index dbaf2ca..5ab796d 100644 --- a/src/demo.c +++ b/src/demo.c @@ -56,103 +56,52 @@ void hh_demo_loop(unsigned long frame) { g_hh_demo_balls[i].position_y = HH_PPU_SCREEN_HEIGHT/2 - HH_PPU_SPRITE_HEIGHT/2 + (int)(30 * (double)sin(2*((double)frame + 3*(double) i) / 10)); hh_ppu_update_foreground(i+16, g_hh_demo_balls[i]); } - return; - /* hh_ppu_update_foreground(32, (hh_s_ppu_loc_fam_entry) { .horizontal_flip = false, .vertical_flip = false, .palette_index = g_hh_controller_p1.dpad_up * 2, - .tilemap_index = 0, - .position_x = 0, + .tilemap_index = 1, + .position_x = 16, .position_y = 0, }); hh_ppu_update_foreground(33, (hh_s_ppu_loc_fam_entry) { .horizontal_flip = false, .vertical_flip = false, .palette_index = g_hh_controller_p1.dpad_down * 2, - .tilemap_index = 0, + .tilemap_index = 1, .position_x = 16, - .position_y = 0, + .position_y = 32, }); hh_ppu_update_foreground(34, (hh_s_ppu_loc_fam_entry) { .horizontal_flip = false, .vertical_flip = false, .palette_index = g_hh_controller_p1.dpad_left * 2, - .tilemap_index = 0, - .position_x = 32, - .position_y = 0, + .tilemap_index = 1, + .position_x = 0, + .position_y = 16, }); hh_ppu_update_foreground(35, (hh_s_ppu_loc_fam_entry) { .horizontal_flip = false, .vertical_flip = false, .palette_index = g_hh_controller_p1.dpad_right * 2, - .tilemap_index = 0, - .position_x = 48, - .position_y = 0, + .tilemap_index = 1, + .position_x = 32, + .position_y = 16, }); hh_ppu_update_foreground(36, (hh_s_ppu_loc_fam_entry) { .horizontal_flip = false, .vertical_flip = false, .palette_index = g_hh_controller_p1.button_primary * 2, - .tilemap_index = 0, - .position_x = 64, - .position_y = 0, + .tilemap_index = 1, + .position_x = 88, + .position_y = 16, }); hh_ppu_update_foreground(37, (hh_s_ppu_loc_fam_entry) { .horizontal_flip = false, .vertical_flip = false, .palette_index = g_hh_controller_p1.button_secondary * 2, - .tilemap_index = 0, - .position_x = 80, - .position_y = 0, - }); - hh_ppu_update_foreground(40, (hh_s_ppu_loc_fam_entry) { - .horizontal_flip = false, - .vertical_flip = false, - .palette_index = g_hh_controller_p2.dpad_up * 2, - .tilemap_index = 0, - .position_x = 0, - .position_y = 16, - }); - hh_ppu_update_foreground(41, (hh_s_ppu_loc_fam_entry) { - .horizontal_flip = false, - .vertical_flip = false, - .palette_index = g_hh_controller_p2.dpad_down * 2, - .tilemap_index = 0, - .position_x = 16, - .position_y = 16, - }); - hh_ppu_update_foreground(42, (hh_s_ppu_loc_fam_entry) { - .horizontal_flip = false, - .vertical_flip = false, - .palette_index = g_hh_controller_p2.dpad_left * 2, - .tilemap_index = 0, - .position_x = 32, - .position_y = 16, - }); - hh_ppu_update_foreground(43, (hh_s_ppu_loc_fam_entry) { - .horizontal_flip = false, - .vertical_flip = false, - .palette_index = g_hh_controller_p2.dpad_right * 2, - .tilemap_index = 0, - .position_x = 48, - .position_y = 16, - }); - hh_ppu_update_foreground(44, (hh_s_ppu_loc_fam_entry) { - .horizontal_flip = false, - .vertical_flip = false, - .palette_index = g_hh_controller_p2.button_primary * 2, - .tilemap_index = 0, + .tilemap_index = 1, .position_x = 64, .position_y = 16, }); - hh_ppu_update_foreground(45, (hh_s_ppu_loc_fam_entry) { - .horizontal_flip = false, - .vertical_flip = false, - .palette_index = g_hh_controller_p2.button_secondary * 2, - .tilemap_index = 0, - .position_x = 80, - .position_y = 16, - }); - */ } diff --git a/src/stm32/consts.h b/src/stm32/consts.h index 16d8da2..795be6f 100644 --- a/src/stm32/consts.h +++ b/src/stm32/consts.h @@ -21,29 +21,29 @@ #define HH_IO_PPU_VBLANK_PORT GPIOC #define HH_IO_PPU_VBLANK_PIN GPIO_PIN_7 -#define HH_IO_GP1_UP_PORT GPIOB -#define HH_IO_GP1_UP_PIN GPIO_PIN_5 +#define HH_IO_GP1_UP_PORT GPIOC +#define HH_IO_GP1_UP_PIN GPIO_PIN_1 #define HH_IO_GP1_DOWN_PORT GPIOA -#define HH_IO_GP1_DOWN_PIN GPIO_PIN_3 +#define HH_IO_GP1_DOWN_PIN GPIO_PIN_0 #define HH_IO_GP1_LEFT_PORT GPIOB -#define HH_IO_GP1_LEFT_PIN GPIO_PIN_3 -#define HH_IO_GP1_RIGHT_PORT GPIOB -#define HH_IO_GP1_RIGHT_PIN GPIO_PIN_4 +#define HH_IO_GP1_LEFT_PIN GPIO_PIN_0 #define HH_IO_GP1_PRIMARY_PORT GPIOA -#define HH_IO_GP1_PRIMARY_PIN GPIO_PIN_10 +#define HH_IO_GP1_PRIMARY_PIN GPIO_PIN_4 +#define HH_IO_GP1_RIGHT_PORT GPIOC +#define HH_IO_GP1_RIGHT_PIN GPIO_PIN_0 #define HH_IO_GP1_SECONDARY_PORT GPIOA -#define HH_IO_GP1_SECONDARY_PIN GPIO_PIN_2 +#define HH_IO_GP1_SECONDARY_PIN GPIO_PIN_1 -#define HH_IO_GP2_UP_PORT GPIOC -#define HH_IO_GP2_UP_PIN GPIO_PIN_1 +#define HH_IO_GP2_UP_PORT GPIOB +#define HH_IO_GP2_UP_PIN GPIO_PIN_5 #define HH_IO_GP2_DOWN_PORT GPIOA -#define HH_IO_GP2_DOWN_PIN GPIO_PIN_0 +#define HH_IO_GP2_DOWN_PIN GPIO_PIN_3 #define HH_IO_GP2_LEFT_PORT GPIOB -#define HH_IO_GP2_LEFT_PIN GPIO_PIN_0 -#define HH_IO_GP2_PRIMARY_PORT GPIOC -#define HH_IO_GP2_PRIMARY_PIN GPIO_PIN_0 -#define HH_IO_GP2_RIGHT_PORT GPIOA +#define HH_IO_GP2_LEFT_PIN GPIO_PIN_3 +#define HH_IO_GP2_RIGHT_PORT GPIOB #define HH_IO_GP2_RIGHT_PIN GPIO_PIN_4 +#define HH_IO_GP2_PRIMARY_PORT GPIOA +#define HH_IO_GP2_PRIMARY_PIN GPIO_PIN_10 #define HH_IO_GP2_SECONDARY_PORT GPIOA -#define HH_IO_GP2_SECONDARY_PIN GPIO_PIN_1 +#define HH_IO_GP2_SECONDARY_PIN GPIO_PIN_2 -- cgit v1.2.3