diff --git a/gb/src/main.rs b/gb/src/main.rs index 1e64e47e..339d130d 100644 --- a/gb/src/main.rs +++ b/gb/src/main.rs @@ -55,13 +55,15 @@ cfg_if::cfg_if! {if #[cfg(feature = "apu")]{ #[cfg(feature = "sdl")] use sdl2::sys::*; -const SCREEN_SCALE:usize = 4; const TURBO_MUL:u8 = 1; cfg_if::cfg_if!{ if #[cfg(feature = "rpi")]{ + const RESET_PIN_BCM:u8 = 14; + const DC_PIN_BCM:u8 = 15; + const LED_PIN_BCM:u8 = 25; use crate::rpi_gpio::gpio_joypad_provider::*; - fn buttons_mapper(button:&Button)->GpioPin{ + fn buttons_mapper(button:&Button)->GpioBcmPin{ match button{ Button::A => 18, Button::B => 17, @@ -75,6 +77,7 @@ cfg_if::cfg_if!{ } } else{ + const SCREEN_SCALE:usize = 4; use sdl2::sys::SDL_Scancode; fn buttons_mapper(button:Button)->SDL_Scancode{ match button{ @@ -179,10 +182,7 @@ fn main() { } cfg_if::cfg_if!{ if #[cfg(feature = "rpi")]{ - let reset_pin = 14; - let dc_pin = 15; - let led_pin = 25; - let mut gfx_device:rpi_gpio::ili9341_controller::Ili9341GfxDevice = rpi_gpio::ili9341_controller::Ili9341GfxDevice::new(reset_pin, dc_pin, led_pin, TURBO_MUL, 0); + let mut gfx_device:rpi_gpio::ili9341_controller::Ili9341GfxDevice = rpi_gpio::ili9341_controller::Ili9341GfxDevice::new(RESET_PIN_BCM, DC_PIN_BCM, LED_PIN_BCM, TURBO_MUL, 0); }else{ let mut gfx_device = sdl::sdl_gfx_device::SdlGfxDevice::new("MagenBoy", SCREEN_SCALE, TURBO_MUL, check_for_terminal_feature_flag(&args, "--no-vsync"), check_for_terminal_feature_flag(&args, "--full-screen")); diff --git a/gb/src/rpi_gpio/gpio_joypad_provider.rs b/gb/src/rpi_gpio/gpio_joypad_provider.rs index 06035ebf..4b63f1b3 100644 --- a/gb/src/rpi_gpio/gpio_joypad_provider.rs +++ b/gb/src/rpi_gpio/gpio_joypad_provider.rs @@ -2,14 +2,14 @@ use lib_gb::keypad::{joypad::{Joypad, NUM_OF_KEYS},joypad_provider::JoypadProvid use lib_gb::utils::create_array; use rppal::gpio::{Gpio, InputPin}; -pub type GpioPin = u8; +pub type GpioBcmPin = u8; pub struct GpioJoypadProvider{ input_pins:[InputPin;NUM_OF_KEYS] } impl GpioJoypadProvider{ - pub fn newGpioPin>(mapper:F)->Self{ + pub fn newGpioBcmPin>(mapper:F)->Self{ let gpio = Gpio::new().unwrap(); let buttons = [Button::A,Button::B,Button::Start,Button::Select,Button::Up,Button::Down,Button::Right,Button::Left]; let mut counter = 0;