retroclash-lib-0.1.2.2: Code shared across the code samples in the book "Retrocomputing with Clash"
Safe HaskellSafe-Inferred
LanguageHaskell2010

RetroClash.Keypad

Documentation

type Matrix rows cols a = Vec rows (Vec cols a) Source #

type KeyStates rows cols = Matrix rows cols Bool Source #

data KeyEvent Source #

Constructors

Pressed 
Released 

Instances

Instances details
Generic KeyEvent Source # 
Instance details

Defined in RetroClash.Keypad

Associated Types

type Rep KeyEvent :: Type -> Type #

Methods

from :: KeyEvent -> Rep KeyEvent x #

to :: Rep KeyEvent x -> KeyEvent #

Show KeyEvent Source # 
Instance details

Defined in RetroClash.Keypad

NFDataX KeyEvent Source # 
Instance details

Defined in RetroClash.Keypad

Eq KeyEvent Source # 
Instance details

Defined in RetroClash.Keypad

type Rep KeyEvent Source # 
Instance details

Defined in RetroClash.Keypad

type Rep KeyEvent = D1 ('MetaData "KeyEvent" "RetroClash.Keypad" "retroclash-lib-0.1.2.2-8zTx05WshYzIbWBY4X0pgW" 'False) (C1 ('MetaCons "Pressed" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Released" 'PrefixI 'False) (U1 :: Type -> Type))

type KeyEvents rows cols = Matrix rows cols (Maybe KeyEvent) Source #

scanKeypad :: (KnownNat rows, KnownNat cols, IsActive rowAct, IsActive colAct, HiddenClockResetEnable dom) => Signal dom (Vec rows (Active rowAct)) -> (Signal dom (Vec cols (Active colAct)), Signal dom (KeyStates rows cols)) Source #

keypadEvents :: (KnownNat rows, KnownNat cols, HiddenClockResetEnable dom) => Signal dom (KeyStates rows cols) -> Signal dom (KeyEvents rows cols) Source #

pressedKeys :: Matrix rows cols a -> KeyEvents rows cols -> Matrix rows cols (Maybe a) Source #

firstJust2D :: (KnownNat rows, KnownNat cols) => Matrix (rows + 1) (cols + 1) (Maybe a) -> Maybe a Source #

inputKeypad :: (KnownNat rows, KnownNat cols, IsActive rowAct, IsActive colAct) => (HiddenClockResetEnable dom, KnownNat (ClockDivider dom (Milliseconds 5))) => Matrix (rows + 1) (cols + 1) a -> Signal dom (Vec (rows + 1) (Active rowAct)) -> (Signal dom (Vec (cols + 1) (Active colAct)), Signal dom (Maybe a)) Source #