parent
21fd0810ff
commit
18efb18c08
@ -1 +0,0 @@ |
||||
1 |
@ -1,69 +0,0 @@ |
||||
# class, midinote, name, shortname, pitch, pan, vol_max, vol_min, reverb_send, filename |
||||
DRUM_HIHAT, 210, SQBass, B, 0.0, 0.0, 0.8, 0.0, 0.0, I_SQBass.wav |
||||
DRUM_MIDTOM, 211, CALLIOP, B, 0.0, 0.0, 0.8, 0.0, 0.0, I_CALLIOP.wav |
||||
DRUM_CRASH, 212, CALLIOP, B, 0.0, 0.0, 0.8, 0.0, 0.0, I_CALLIOP.wav |
||||
DRUM_RIDE, 213, ARR1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_I_ARR1.wav |
||||
DRUM_BASS, 214, FVoice, B, 0.0, 0.0, 0.8, 0.0, 0.0, I_FVoicG2.wav |
||||
DRUM_BASS, MIDI_A2, Clap808, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_kick_1.wav |
||||
DRUM_BASS, MIDI_B2, S_kick_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_kick_1.wav |
||||
DRUM_BASS, MIDI_C3, S_kick2_8, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_kick2_8.wav |
||||
DRUM_PERCUSSION, MIDI_CIS3, S_Stick_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_snareStick_1.wav |
||||
DRUM_SNARE, MIDI_D3, S_snare_Ghost_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_snare_Ghost_1.wav |
||||
DRUM_SNARE, MIDI_DIS3, S_snare2_Ghost_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_snare2_Ghost_1.wav |
||||
DRUM_SNARE, MIDI_E3, S_snare_2, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_snare_2.wav |
||||
DRUM_BASS, MIDI_F3, S_loTom_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_loTom_1.wav |
||||
DRUM_BASS, MIDI_FIS3, S_hhClosed_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_hhClosed_1.wav |
||||
DRUM_LOWTOM, MIDI_G3, S_loTom_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_loTom_1.wav |
||||
DRUM_BASS, MIDI_GIS3, S_hh_o_1_2, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_hh_o_1_2.wav |
||||
DRUM_HIGHTOM, MIDI_A3, S_hiTom_5, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_hiTom_5.wav |
||||
DRUM_BASS, MIDI_AIS3, S_hh_o_5_4 , B, 0.0, 0.0, 0.8, 0.0, 0.0, S_hh_o_5_4.wav |
||||
DRUM_HIGHTOM, MIDI_B3, S_hiTom_5, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_hiTom_5.wav |
||||
DRUM_HIGHTOM, MIDI_C4, S_hiTom_5, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_hiTom_5.wav |
||||
DRUM_BASS, MIDI_CIS4, S_splash1_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_splash1_1.wav |
||||
DRUM_HIGHTOM, MIDI_D4, S_hiTom_5, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_hiTom_5.wav |
||||
DRUM_CRASH, MIDI_DIS4, S_china1_4, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_china1_4.wav |
||||
DRUM_CRASH, MIDI_E4, S_china2_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_china2_1.wav |
||||
DRUM_RIDE, MIDI_F4, S_ride1Bell_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_ride1Bell_1.wav |
||||
DRUM_RIDE, MIDI_FIS4, S_ride1Bell_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_ride1Bell_1.wav |
||||
DRUM_CRASH, MIDI_G4, S_crash1_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_crash1_1.wav |
||||
DRUM_BASS, MIDI_GIS4, S_cowbell_2, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_cowbell_2.wav |
||||
DRUM_RIDE, MIDI_A4, S_ride2Crash_2, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_ride2Crash_2.wav |
||||
DRUM_RIDE, MIDI_AIS4, S_ride2_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_ride2_1.wav |
||||
DRUM_BASS, MIDI_B4, 808Kick, B, 0.0, 0.0, 0.8, 0.0, 0.0, Kick808.wav |
||||
DRUM_BASS, MIDI_C5, phkick1, B, 0.0, 0.0, 1.0, 0.0, 0.0, phKick1.wav |
||||
DRUM_SNARE, MIDI_CIS5, rims1, R, 0.0, -0.2, 0.7, 0.0, 0.0, Rim808.wav |
||||
DRUM_SNARE, MIDI_D5, Shaker, R, 0.0, -0.2, 0.5, 0.0, 0.0, Shaker.wav |
||||
DRUM_HANDCLAP, MIDI_DIS5, LNclap1, C, 0.0, 0.1, 0.9, 0.0, 0.1, LnClap.wav |
||||
DRUM_SNARE, MIDI_E5, LNsnare1, S, 0.0, 0.0, 0.9, 0.0, 0.0, LnSnare1.wav |
||||
DRUM_BASS, MIDI_F5, Bdtrancy, B, 0.0, 0.0, 0.9, 0.0, 0.0, BDTrancy.wav |
||||
DRUM_HIHAT, MIDI_FIS5, hhcl1, H, 0.0, 1.0, 0.6, 0.0, 0.0, HhCL1-808.wav |
||||
DRUM_BASS, MIDI_G5, Belltree, B, 0.0, 0.0, 0.7, 0.0, 0.0, Belltree.wav |
||||
DRUM_BASS, MIDI_GIS5, Bongo16, B, 0.0, 0.0, 0.9, 0.0, 0.0, Bongo16.wav |
||||
DRUM_BASS, MIDI_A5, Bongo27, B, 0.0, 0.0, 0.9, 0.0, 0.0, Bongo27.wav |
||||
DRUM_BASS, MIDI_AIS5, Casta, B, 0.0, 0.0, 0.9, 0.0, 0.0, Casta.wav |
||||
DRUM_BASS, MIDI_B5, Cr78kick, B, 0.0, 0.0, 1.0, 0.0, 0.0, CR78Kick.wav |
||||
DRUM_HIHAT, MIDI_C6, Cr78tmb1, B, 0.0, 0.0, 0.8, 0.0, 0.0, CR78Tmb1.wav |
||||
DRUM_HIHAT, MIDI_CIS6, Cr78tmb2, B, 0.0, 0.0, 0.8, 0.0, 0.0, CR78Tmb2.wav |
||||
DRUM_BASS, MIDI_D6, Crash1, B, 0.0, 0.0, 0.9, 0.0, 0.0, Crash1.wav |
||||
DRUM_BASS, MIDI_DIS6, Dmpop, B, 0.0, 0.0, 0.9, 0.0, 0.0, DMpop.wav |
||||
DRUM_BASS, MIDI_E6, Electr1, B, 0.0, 0.0, 0.9, 0.0, 0.0, Electr1.wav |
||||
DRUM_BASS, MIDI_F6, Excow, B, 0.0, 0.0, 0.9, 0.0, 0.0, EXcow.wav |
||||
DRUM_PERCUSSION, MIDI_FIS6, Tamb, T, 0.0, -0.2, 0.6, 0.0, 0.0, Tamb.wav |
||||
DRUM_PERCUSSION, MIDI_GIS6, Cowbell, S, 0.0, 0.2, 0.6, 0.0, 0.0, CowBell.wav |
||||
DRUM_HIHAT, MIDI_G6, 660HatC1, T, 0.0, 0.0, 0.6, 0.0, 0.0, HatC660.wav |
||||
DRUM_HIHAT, MIDI_A6, Hhopen1, S, 0.0, 0.0, 0.6, 0.0, 0.0, HHopen1.wav |
||||
DRUM_PERCUSSION, MIDI_AIS6, Histicks, S, 0.0, 0.0, 0.6, 0.0, 0.0, HiSticks.wav |
||||
DRUM_PERCUSSION, MIDI_B6, Hr16snr2, S, 0.0, 0.0, 0.6, 0.0, 0.0, HR16Snr2.wav |
||||
DRUM_HIGHTOM, MIDI_C7, Xrhitom, B, 0.0, 0.0, 0.8, 0.0, 0.0, XRHiTom.wav |
||||
DRUM_PERCUSSION, MIDI_CIS7, Tick1, S, 0.0, 0.0, 0.9, 0.0, 0.0, Tick1.wav |
||||
DRUM_PERCUSSION, MIDI_D7, M1-18, S, 0.0, 0.0, 0.9, 0.0, 0.0, M1-18.wav |
||||
DRUM_PERCUSSION, MIDI_DIS7, Md16_clp, S, 0.0, 0.0, 0.9, 0.0, 0.0, MD16_CLP.wav |
||||
DRUM_HIHAT, MIDI_E7, Ohhwav, S, 0.0, 0.0, 0.9, 0.0, 0.0, OHH909.wav |
||||
DRUM_PERCUSSION, MIDI_F7, Quijada, S, 0.0, 0.0, 0.9, 0.0, 0.0, Quijada.wav |
||||
DRUM_PERCUSSION, MIDI_FIS7, tabla1, S, 0.0, 0.0, 0.9, 0.0, 0.0, R8Tabla1.wav |
||||
DRUM_PERCUSSION, MIDI_G7, Ride808, S, 0.0, 0.0, 0.9, 0.0, 0.0, Ride808.wav |
||||
DRUM_PERCUSSION, MIDI_GIS7, Scratch1, S, 0.0, 0.0, 0.7, 0.0, 0.0, scratch1.wav |
||||
DRUM_PERCUSSION, MIDI_A7, Tomlow, S, 0.0, 0.0, 0.9, 0.0, 0.0, TomLow.wav |
||||
DRUM_PERCUSSION, MIDI_AIS7, Tom808, S, 0.0, 0.0, 0.9, 0.0, 0.0, Tom808.wav |
||||
DRUM_BASS, MIDI_B7, Vl1lbeep, B, 0.0, 0.0, 0.8, 0.0, 0.0, vl1-Lbeep.wav |
||||
DRUM_BASS, MIDI_C8, Vl1hbeep, B, 0.0, 0.0, 0.8, 0.0, 0.0, vl1-Hbeep.wav |
@ -1,50 +1,69 @@ |
||||
# class, midinote, name, shortname, pitch, pan, vol_max, vol_min, reverb_send, filename |
||||
DRUM_BASS, MIDI_A2, Xrhitom, B, 0.0, 0.0, 0.8, 0.0, 0.0, bd01.wav |
||||
DRUM_BASS, MIDI_AIS2, Vl1lbeep, B, 0.0, 0.0, 0.8, 0.0, 0.0, bd01.wav |
||||
DRUM_BASS, MIDI_B2, Vl1hbeep, B, 0.0, 0.0, 0.8, 0.0, 0.0, bd01.wav |
||||
DRUM_BASS, MIDI_C3, bd01, B, 0.0, 0.0, 0.8, 0.0, 0.0, bd01.wav |
||||
DRUM_HANDCLAP, MIDI_CIS3, cp02l, C, 0.0, -1.0, 0.6, 0.0, 0.1, bd01.wav |
||||
DRUM_HANDCLAP, MIDI_DIS3, cp02r, C, 0.0, 1.0, 0.6, 0.0, 0.2, bd01.wav |
||||
DRUM_SNARE, MIDI_D3, sd15, S, 0.0, 0.2, 0.6, 0.2, 0.0, bd01.wav |
||||
DRUM_HIHAT, MIDI_FIS3, hh01, h, 0.0, 0.8, 0.8, 0.3, 0.0, bd01.wav |
||||
DRUM_HIHAT, MIDI_GIS3, hh02, h, 0.0, 0.8, 0.8, 0.3, 0.0, bd01.wav |
||||
DRUM_HIHAT, MIDI_AIS3, oh02, H, 0.0, 0.8, 0.8, 0.3, 0.0, bd01.wav |
||||
DRUM_LOWTOM, MIDI_G3, lt01, T, 0.0, -0.7, 0.8, 0.0, 0.0, bd01.wav |
||||
DRUM_HIGHTOM, MIDI_A3, ht01, T, 0.0, -0.5, 0.8, 0.0, 0.0, bd01.wav |
||||
DRUM_RIDE, MIDI_CIS4, rd01, R, 0.0, -0.6, 0.3, 0.0, 0.0, bd01.wav |
||||
DRUM_RIDE, MIDI_DIS4, rd02, R, 0.0, -0.6, 0.3, 0.0, 0.0, bd01.wav |
||||
DRUM_BASS, MIDI_B4, 808Kick, B, 0.0, 0.0, 0.8, 0.0, 0.0, bd01.wav |
||||
DRUM_BASS, MIDI_C5, phkick1, B, 0.0, 0.0, 1.0, 0.0, 0.0, bd01.wav |
||||
DRUM_SNARE, MIDI_CIS5, rims1, R, 0.0, -0.2, 0.7, 0.0, 0.0, bd01.wav |
||||
DRUM_SNARE, MIDI_D5, Shaker, R, 0.0, -0.2, 0.5, 0.0, 0.0, bd01.wav |
||||
DRUM_SNARE, MIDI_E5, LNsnare1, S, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav |
||||
DRUM_HANDCLAP, MIDI_DIS5, LNclap1, C, 0.0, 0.1, 0.9, 0.0, 0.1, bd01.wav |
||||
DRUM_BASS, MIDI_F5, Bdtrancy, B, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav |
||||
DRUM_HIHAT, MIDI_FIS5, hhcl1, H, 0.0, 1.0, 0.6, 0.0, 0.0, bd01.wav |
||||
DRUM_BASS, MIDI_G5, Belltree, B, 0.0, 0.0, 0.7, 0.0, 0.0, bd01.wav |
||||
DRUM_BASS, MIDI_GIS5, Bongo16, B, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav |
||||
DRUM_BASS, MIDI_A5, Bongo27, B, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav |
||||
DRUM_BASS, MIDI_AIS5, Casta, B, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav |
||||
DRUM_BASS, MIDI_B5, Cr78kick, B, 0.0, 0.0, 1.0, 0.0, 0.0, bd01.wav |
||||
DRUM_HIHAT, MIDI_C6, Cr78tmb1, B, 0.0, 0.0, 0.8, 0.0, 0.0, bd01.wav |
||||
DRUM_HIHAT, MIDI_CIS6, Cr78tmb2, B, 0.0, 0.0, 0.8, 0.0, 0.0, bd01.wav |
||||
DRUM_BASS, MIDI_D6, Crash1, B, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav |
||||
DRUM_BASS, MIDI_DIS6, Dmpop, B, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav |
||||
DRUM_BASS, MIDI_E6, Electr1, B, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav |
||||
DRUM_BASS, MIDI_F6, Excow, B, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav |
||||
DRUM_PERCUSSION, MIDI_FIS6, Tamb, T, 0.0, -0.2, 0.6, 0.0, 0.0, bd01.wav |
||||
DRUM_PERCUSSION, MIDI_GIS6, Cowbell, S, 0.0, 0.2, 0.6, 0.0, 0.0, bd01.wav |
||||
DRUM_HIHAT, MIDI_G6, 660HatC1, T, 0.0, 0.0, 0.6, 0.0, 0.0, bd01.wav |
||||
DRUM_HIHAT, MIDI_A6, Hhopen1, S, 0.0, 0.0, 0.6, 0.0, 0.0, bd01.wav |
||||
DRUM_PERCUSSION, MIDI_AIS6, Histicks, S, 0.0, 0.0, 0.6, 0.0, 0.0, bd01.wav |
||||
DRUM_PERCUSSION, MIDI_B6, Hr16snr2, S, 0.0, 0.0, 0.6, 0.0, 0.0, bd01.wav |
||||
DRUM_PERCUSSION, MIDI_CIS7, Tick1, S, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav |
||||
DRUM_PERCUSSION, MIDI_D7, M118w, S, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav |
||||
DRUM_PERCUSSION, MIDI_DIS7, Md16_clp, S, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav |
||||
DRUM_HIHAT, MIDI_E7, Ohhwav, S, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav |
||||
DRUM_PERCUSSION, MIDI_F7, Quijada, S, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav |
||||
DRUM_PERCUSSION, MIDI_FIS7, tabla1, S, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav |
||||
DRUM_PERCUSSION, MIDI_GIS7, Ridewav, S, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav |
||||
DRUM_PERCUSSION, MIDI_A7, Scratch1, S, 0.0, 0.0, 0.7, 0.0, 0.0, bd01.wav |
||||
DRUM_PERCUSSION, MIDI_B7, Tomlow, S, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav |
||||
DRUM_PERCUSSION, MIDI_C8, Tomwav, S, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav |
||||
# class, midinote, name, shortname, pitch, p_offset, pan, vol_max, vol_min, reverb_send, filename |
||||
DRUM_HIHAT, 210, SQBass, B, 0.0,0.0, 0.0, 0.8, 0.0, 0.0, I_SQBass.wav |
||||
DRUM_MIDTOM, 211, CALLIOP, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, I_CALLIOP.wav |
||||
DRUM_CRASH, 212, CALLIOP, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, I_CALLIOP.wav |
||||
DRUM_RIDE, 213, ARR1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_I_ARR1.wav |
||||
DRUM_BASS, 214, FVoice, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, I_FVoicG2.wav |
||||
DRUM_BASS, MIDI_A2, Clap808, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_kick_1.wav |
||||
DRUM_BASS, MIDI_B2, S_kick_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_kick_1.wav |
||||
DRUM_BASS, MIDI_C3, S_kick2_8, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_kick2_8.wav |
||||
DRUM_PERCUSSION, MIDI_CIS3, S_Stick_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_snareStick_1.wav |
||||
DRUM_SNARE, MIDI_D3, S_snare_Ghost_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_snare_Ghost_1.wav |
||||
DRUM_SNARE, MIDI_DIS3, S_snare2_Ghost_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_snare2_Ghost_1.wav |
||||
DRUM_SNARE, MIDI_E3, S_snare_2, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_snare_2.wav |
||||
DRUM_BASS, MIDI_F3, S_loTom_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_loTom_1.wav |
||||
DRUM_BASS, MIDI_FIS3, S_hhClosed_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_hhClosed_1.wav |
||||
DRUM_LOWTOM, MIDI_G3, S_loTom_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_loTom_1.wav |
||||
DRUM_BASS, MIDI_GIS3, S_hh_o_1_2, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_hh_o_1_2.wav |
||||
DRUM_HIGHTOM, MIDI_A3, S_hiTom_5, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_hiTom_5.wav |
||||
DRUM_BASS, MIDI_AIS3, S_hh_o_5_4 , B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_hh_o_5_4.wav |
||||
DRUM_HIGHTOM, MIDI_B3, S_hiTom_5, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_hiTom_5.wav |
||||
DRUM_HIGHTOM, MIDI_C4, S_hiTom_5, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_hiTom_5.wav |
||||
DRUM_BASS, MIDI_CIS4, S_splash1_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_splash1_1.wav |
||||
DRUM_HIGHTOM, MIDI_D4, S_hiTom_5, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_hiTom_5.wav |
||||
DRUM_CRASH, MIDI_DIS4, S_china1_4, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_china1_4.wav |
||||
DRUM_CRASH, MIDI_E4, S_china2_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_china2_1.wav |
||||
DRUM_RIDE, MIDI_F4, S_ride1Bell_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_ride1Bell_1.wav |
||||
DRUM_RIDE, MIDI_FIS4, S_ride1Bell_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_ride1Bell_1.wav |
||||
DRUM_CRASH, MIDI_G4, S_crash1_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_crash1_1.wav |
||||
DRUM_BASS, MIDI_GIS4, S_cowbell_2, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_cowbell_2.wav |
||||
DRUM_RIDE, MIDI_A4, S_ride2Crash_2, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_ride2Crash_2.wav |
||||
DRUM_RIDE, MIDI_AIS4, S_ride2_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_ride2_1.wav |
||||
DRUM_BASS, MIDI_B4, 808Kick, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, Kick808.wav |
||||
DRUM_BASS, MIDI_C5, phkick1, B, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, phKick1.wav |
||||
DRUM_SNARE, MIDI_CIS5, rims1, R, 0.0, 0.0, -0.2, 0.7, 0.0, 0.0, Rim808.wav |
||||
DRUM_SNARE, MIDI_D5, Shaker, R, 0.0, 0.0, -0.2, 0.5, 0.0, 0.0, Shaker.wav |
||||
DRUM_HANDCLAP, MIDI_DIS5, LNclap1, C, 0.0, 0.0, 0.1, 0.9, 0.0, 0.1, LnClap.wav |
||||
DRUM_SNARE, MIDI_E5, LNsnare1, S, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, LnSnare1.wav |
||||
DRUM_BASS, MIDI_F5, Bdtrancy, B, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, BDTrancy.wav |
||||
DRUM_HIHAT, MIDI_FIS5, hhcl1, H, 0.0, 0.0, 1.0, 0.6, 0.0, 0.0, HhCL1-808.wav |
||||
DRUM_BASS, MIDI_G5, Belltree, B, 0.0, 0.0, 0.0, 0.7, 0.0, 0.0, Belltree.wav |
||||
DRUM_BASS, MIDI_GIS5, Bongo16, B, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, Bongo16.wav |
||||
DRUM_BASS, MIDI_A5, Bongo27, B, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, Bongo27.wav |
||||
DRUM_BASS, MIDI_AIS5, Casta, B, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, Casta.wav |
||||
DRUM_BASS, MIDI_B5, Cr78kick, B, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, CR78Kick.wav |
||||
DRUM_HIHAT, MIDI_C6, Cr78tmb1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, CR78Tmb1.wav |
||||
DRUM_HIHAT, MIDI_CIS6, Cr78tmb2, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, CR78Tmb2.wav |
||||
DRUM_BASS, MIDI_D6, Crash1, B, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, Crash1.wav |
||||
DRUM_BASS, MIDI_DIS6, Dmpop, B, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, DMpop.wav |
||||
DRUM_BASS, MIDI_E6, Electr1, B, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, Electr1.wav |
||||
DRUM_BASS, MIDI_F6, Excow, B, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, EXcow.wav |
||||
DRUM_PERCUSSION, MIDI_FIS6, Tamb, T, 0.0, 0.0, -0.2, 0.6, 0.0, 0.0, Tamb.wav |
||||
DRUM_PERCUSSION, MIDI_GIS6, Cowbell, S, 0.0, 0.0, 0.2, 0.6, 0.0, 0.0, CowBell.wav |
||||
DRUM_HIHAT, MIDI_G6, 660HatC1, T, 0.0, 0.0, 0.0, 0.6, 0.0, 0.0, HatC660.wav |
||||
DRUM_HIHAT, MIDI_A6, Hhopen1, S, 0.0, 0.0, 0.0, 0.6, 0.0, 0.0, HHopen1.wav |
||||
DRUM_PERCUSSION, MIDI_AIS6, Histicks, S, 0.0, 0.0, 0.0, 0.6, 0.0, 0.0, HiSticks.wav |
||||
DRUM_PERCUSSION, MIDI_B6, Hr16snr2, S, 0.0, 0.0, 0.0, 0.6, 0.0, 0.0, HR16Snr2.wav |
||||
DRUM_HIGHTOM, MIDI_C7, Xrhitom, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, XRHiTom.wav |
||||
DRUM_PERCUSSION, MIDI_CIS7, Tick1, S, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, Tick1.wav |
||||
DRUM_PERCUSSION, MIDI_D7, M1-18, S, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, M1-18.wav |
||||
DRUM_PERCUSSION, MIDI_DIS7, Md16_clp, S, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, MD16_CLP.wav |
||||
DRUM_HIHAT, MIDI_E7, Ohhwav, S, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, OHH909.wav |
||||
DRUM_PERCUSSION, MIDI_F7, Quijada, S, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, Quijada.wav |
||||
DRUM_PERCUSSION, MIDI_FIS7, tabla1, S, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, R8Tabla1.wav |
||||
DRUM_PERCUSSION, MIDI_G7, Ride808, S, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, Ride808.wav |
||||
DRUM_PERCUSSION, MIDI_GIS7, Scratch1, S, 0.0, 0.0, 0.0, 0.7, 0.0, 0.0, scratch1.wav |
||||
DRUM_PERCUSSION, MIDI_A7, Tomlow, S, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, TomLow.wav |
||||
DRUM_PERCUSSION, MIDI_AIS7, Tom808, S, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, Tom808.wav |
||||
DRUM_BASS, MIDI_B7, Vl1lbeep, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, vl1-Lbeep.wav |
||||
DRUM_BASS, MIDI_C8, Vl1hbeep, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, vl1-Hbeep.wav |
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,646 @@ |
||||
// =====================================================================
|
||||
//
|
||||
// CONTROL v2.2.0
|
||||
//
|
||||
// =====================================================================
|
||||
// *********************************************************************
|
||||
// Features
|
||||
// - max 6 Buttons with special names (enter, quit, up, down, left, right)
|
||||
// new Features on v2.2.0
|
||||
// - max 64 Events, this could be a button ore something (Counter 0 - 63)
|
||||
// - standard buttons and events can be used at the same time
|
||||
// - Event 0 - 3 can be used with a menu callback function (when set this event, the function is called)
|
||||
// - The range from 0 - 3 can be changed in LCDMenuLib2.h
|
||||
// Attention!!
|
||||
// - events have to be reset manual over LCDML.CE_reset(number) ore LCDML.CE_resetAll();
|
||||
// - they will not be reseted from the menu library
|
||||
// *********************************************************************
|
||||
// content:
|
||||
// (0) Control over serial interface with asdw_e_q
|
||||
// (1) Control over one analog input
|
||||
// (2) Control over 4 - 6 digital input pins (internal pullups enabled)
|
||||
// (3) Control over encoder [third party lib] (Download: https://github.com/PaulStoffregen/Encoder)
|
||||
// (4) Control with Keypad [third party lib] (Download: http://playground.arduino.cc/Main/KeypadTutorial )
|
||||
// (5) Control with an IRMP remote [third party lib] (Download: https://github.com/ukw100/IRMP )
|
||||
// (6) Control with a joystick
|
||||
// (7) Control over I2C PCF8574
|
||||
// *********************************************************************
|
||||
|
||||
#define _LCDML_CONTROL_cfg 0 |
||||
|
||||
// theory:
|
||||
// "#if" is a preprocessor directive and no error, look here:
|
||||
// (English) https://en.wikipedia.org/wiki/C_preprocessor
|
||||
// (German) https://de.wikipedia.org/wiki/C-Pr%C3%A4prozessor
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (0) CONTROL OVER SERIAL INTERFACE *******************
|
||||
// *********************************************************************
|
||||
#if(_LCDML_CONTROL_cfg == 0) |
||||
// settings
|
||||
# define _LCDML_CONTROL_serial_enter 'e' |
||||
# define _LCDML_CONTROL_serial_up 'w' |
||||
# define _LCDML_CONTROL_serial_down 's' |
||||
# define _LCDML_CONTROL_serial_left 'a' |
||||
# define _LCDML_CONTROL_serial_right 'd' |
||||
# define _LCDML_CONTROL_serial_quit 'q' |
||||
|
||||
// example for the useage of events (not needed everywhere)
|
||||
// this defines are only for examples and can be renamed
|
||||
# define _LCDML_EVENT_command 'c' |
||||
# define _LCDML_EVENT_char_0 '0' |
||||
# define _LCDML_EVENT_char_1 '1' |
||||
# define _LCDML_EVENT_char_2 '2' |
||||
# define _LCDML_EVENT_char_3 '3' |
||||
# define _LCDML_EVENT_char_4 '4' |
||||
# define _LCDML_EVENT_char_5 '5' |
||||
# define _LCDML_EVENT_char_6 '6' |
||||
# define _LCDML_EVENT_char_7 '7' |
||||
# define _LCDML_EVENT_char_8 '8' |
||||
# define _LCDML_EVENT_char_9 '9' |
||||
// *********************************************************************
|
||||
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
} |
||||
|
||||
if(LCDML.CE_setup()) { |
||||
// runs only once
|
||||
} |
||||
|
||||
// check if new serial input is available
|
||||
if (Serial.available()) { |
||||
// read one char from input buffer
|
||||
switch (Serial.read()) |
||||
{ |
||||
case _LCDML_CONTROL_serial_enter: LCDML.BT_enter(); break; |
||||
case _LCDML_CONTROL_serial_up: LCDML.BT_up(); break; |
||||
case _LCDML_CONTROL_serial_down: LCDML.BT_down(); break; |
||||
case _LCDML_CONTROL_serial_left: LCDML.BT_left(); break; |
||||
case _LCDML_CONTROL_serial_right: LCDML.BT_right(); break; |
||||
case _LCDML_CONTROL_serial_quit: LCDML.BT_quit(); break; |
||||
// example for event handling
|
||||
// custom event handling
|
||||
// is is also possible to enable more the one event on the same time
|
||||
// but when more then one events with callback functions are active
|
||||
// only the first callback function is called. (first = by number)
|
||||
case _LCDML_EVENT_command: LCDML.CE_set(0); break; |
||||
case _LCDML_EVENT_char_0: LCDML.CE_set(1); break; |
||||
case _LCDML_EVENT_char_1: LCDML.CE_set(2); break; |
||||
case _LCDML_EVENT_char_2: LCDML.CE_set(3); break; |
||||
case _LCDML_EVENT_char_3: LCDML.CE_set(4); break; |
||||
case _LCDML_EVENT_char_4: LCDML.CE_set(5); break; |
||||
case _LCDML_EVENT_char_5: LCDML.CE_set(6); break; |
||||
case _LCDML_EVENT_char_6: LCDML.CE_set(7); break; |
||||
case _LCDML_EVENT_char_7: LCDML.CE_set(8); break; |
||||
case _LCDML_EVENT_char_8: LCDML.CE_set(9); break; |
||||
case _LCDML_EVENT_char_9: LCDML.CE_set(10); break; |
||||
default: break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (1) CONTROL OVER ONE ANALOG PIN *********************
|
||||
// *********************************************************************
|
||||
#elif(_LCDML_CONTROL_cfg == 1) |
||||
|
||||
unsigned long g_LCDML_DISP_press_time = 0; |
||||
// settings
|
||||
#define _LCDML_CONTROL_analog_pin 0 |
||||
// when you did not use a button set the value to zero
|
||||
#define _LCDML_CONTROL_analog_enter_min 850 // Button Enter
|
||||
#define _LCDML_CONTROL_analog_enter_max 920 |
||||
#define _LCDML_CONTROL_analog_up_min 520 // Button Up
|
||||
#define _LCDML_CONTROL_analog_up_max 590 |
||||
#define _LCDML_CONTROL_analog_down_min 700 // Button Down
|
||||
#define _LCDML_CONTROL_analog_down_max 770 |
||||
#define _LCDML_CONTROL_analog_back_min 950 // Button Back
|
||||
#define _LCDML_CONTROL_analog_back_max 1020 |
||||
#define _LCDML_CONTROL_analog_left_min 430 // Button Left
|
||||
#define _LCDML_CONTROL_analog_left_max 500 |
||||
#define _LCDML_CONTROL_analog_right_min 610 // Button Right
|
||||
#define _LCDML_CONTROL_analog_right_max 680 |
||||
// *********************************************************************
|
||||
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
} |
||||
// check debounce timer
|
||||
if((millis() - g_LCDML_DISP_press_time) >= 200) { |
||||
g_LCDML_DISP_press_time = millis(); // reset debounce timer
|
||||
|
||||
uint16_t value = analogRead(_LCDML_CONTROL_analog_pin); // analog pin for keypad
|
||||
|
||||
if (value >= _LCDML_CONTROL_analog_enter_min && value <= _LCDML_CONTROL_analog_enter_max) { LCDML.BT_enter(); } |
||||
if (value >= _LCDML_CONTROL_analog_up_min && value <= _LCDML_CONTROL_analog_up_max) { LCDML.BT_up(); } |
||||
if (value >= _LCDML_CONTROL_analog_down_min && value <= _LCDML_CONTROL_analog_down_max) { LCDML.BT_down(); } |
||||
if (value >= _LCDML_CONTROL_analog_left_min && value <= _LCDML_CONTROL_analog_left_max) { LCDML.BT_left(); } |
||||
if (value >= _LCDML_CONTROL_analog_right_min && value <= _LCDML_CONTROL_analog_right_max) { LCDML.BT_right(); } |
||||
if (value >= _LCDML_CONTROL_analog_back_min && value <= _LCDML_CONTROL_analog_back_max) { LCDML.BT_quit(); } |
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (2) CONTROL OVER DIGITAL PINS ***********************
|
||||
// *********************************************************************
|
||||
#elif(_LCDML_CONTROL_cfg == 2) |
||||
// settings
|
||||
unsigned long g_LCDML_DISP_press_time = 0; |
||||
|
||||
#define _LCDML_CONTROL_digital_low_active 0 // 0 = high active (pulldown) button, 1 = low active (pullup)
|
||||
// http://playground.arduino.cc/CommonTopics/PullUpDownResistor
|
||||
#define _LCDML_CONTROL_digital_enable_quit 1 |
||||
#define _LCDML_CONTROL_digital_enable_lr 1 |
||||
#define _LCDML_CONTROL_digital_enter 8 |
||||
#define _LCDML_CONTROL_digital_up 9 |
||||
#define _LCDML_CONTROL_digital_down 10 |
||||
#define _LCDML_CONTROL_digital_quit 11 |
||||
#define _LCDML_CONTROL_digital_left 12 |
||||
#define _LCDML_CONTROL_digital_right 13 |
||||
// *********************************************************************
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
// init buttons
|
||||
pinMode(_LCDML_CONTROL_digital_enter , INPUT_PULLUP); |
||||
pinMode(_LCDML_CONTROL_digital_up , INPUT_PULLUP); |
||||
pinMode(_LCDML_CONTROL_digital_down , INPUT_PULLUP); |
||||
# if(_LCDML_CONTROL_digital_enable_quit == 1) |
||||
pinMode(_LCDML_CONTROL_digital_quit , INPUT_PULLUP); |
||||
# endif |
||||
# if(_LCDML_CONTROL_digital_enable_lr == 1) |
||||
pinMode(_LCDML_CONTROL_digital_left , INPUT_PULLUP); |
||||
pinMode(_LCDML_CONTROL_digital_right , INPUT_PULLUP); |
||||
# endif |
||||
} |
||||
|
||||
#if(_LCDML_CONTROL_digital_low_active == 1) |
||||
# define _LCDML_CONTROL_digital_a ! |
||||
#else |
||||
# define _LCDML_CONTROL_digital_a |
||||
#endif |
||||
|
||||
uint8_t but_stat = 0x00; |
||||
|
||||
bitWrite(but_stat, 0, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_enter))); |
||||
bitWrite(but_stat, 1, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_up))); |
||||
bitWrite(but_stat, 2, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_down))); |
||||
#if(_LCDML_CONTROL_digital_enable_quit == 1) |
||||
bitWrite(but_stat, 3, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_quit))); |
||||
#endif |
||||
#if(_LCDML_CONTROL_digital_enable_lr == 1) |
||||
bitWrite(but_stat, 4, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_left))); |
||||
bitWrite(but_stat, 5, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_right))); |
||||
#endif |
||||
|
||||
if (but_stat > 0) { |
||||
if((millis() - g_LCDML_DISP_press_time) >= 200) { |
||||
g_LCDML_DISP_press_time = millis(); // reset press time
|
||||
|
||||
if (bitRead(but_stat, 0)) { LCDML.BT_enter(); } |
||||
if (bitRead(but_stat, 1)) { LCDML.BT_up(); } |
||||
if (bitRead(but_stat, 2)) { LCDML.BT_down(); } |
||||
if (bitRead(but_stat, 3)) { LCDML.BT_quit(); } |
||||
if (bitRead(but_stat, 4)) { LCDML.BT_left(); } |
||||
if (bitRead(but_stat, 5)) { LCDML.BT_right(); } |
||||
} |
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (3) CONTROL WITH ENCODER ****************************
|
||||
// *********************************************************************
|
||||
#elif(_LCDML_CONTROL_cfg == 3) |
||||
/*
|
||||
* Thanks to "MuchMore" (Arduino forum) to add this encoder functionality |
||||
* |
||||
* rotate left = Up |
||||
* rotate right = Down |
||||
* push = Enter |
||||
* push long = Quit |
||||
* push + rotate left = Left |
||||
* push + rotate right = Right |
||||
*/ |
||||
|
||||
/* encoder connection
|
||||
* button * (do not use an external resistor, the internal pullup resistor is used) |
||||
* .-------o Arduino Pin |
||||
* | |
||||
* | |
||||
* o / |
||||
* / |
||||
* / |
||||
* o |
||||
* | |
||||
* '-------o GND |
||||
* |
||||
* encoder * (do not use an external resistor, the internal pullup resistors are used) |
||||
* |
||||
* .---------------o Arduino Pin A |
||||
* | .------o Arduino Pin B |
||||
* | | |
||||
* o / o / |
||||
* / / |
||||
* / / |
||||
* o o |
||||
* | | |
||||
* '--------o----o GND (common pin) |
||||
*/ |
||||
|
||||
// global defines
|
||||
#define encoder_A_pin 20 // physical pin has to be 2 or 3 to use interrupts (on mega e.g. 20 or 21), use internal pullups
|
||||
#define encoder_B_pin 21 // physical pin has to be 2 or 3 to use interrupts (on mega e.g. 20 or 21), use internal pullups
|
||||
#define encoder_button_pin 49 // physical pin , use internal pullup
|
||||
|
||||
#define g_LCDML_CONTROL_button_long_press 800 // ms
|
||||
#define g_LCDML_CONTROL_button_short_press 120 // ms
|
||||
|
||||
#define ENCODER_OPTIMIZE_INTERRUPTS //Only when using pin2/3 (or 20/21 on mega)
|
||||
#include <Encoder.h> //for Encoder Download: https://github.com/PaulStoffregen/Encoder |
||||
|
||||
Encoder ENCODER(encoder_A_pin, encoder_B_pin); |
||||
|
||||
unsigned long g_LCDML_CONTROL_button_press_time = millis(); |
||||
bool g_LCDML_CONTROL_button_prev = HIGH; |
||||
|
||||
// *********************************************************************
|
||||
void lcdml_menu_control(void) |
||||
// *********************************************************************
|
||||
{ |
||||
// declare variable for this function
|
||||
int32_t g_LCDML_CONTROL_Encoder_position = ENCODER.read(); |
||||
bool g_LCDML_button = digitalRead(encoder_button_pin); |
||||
|
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) |
||||
{ |
||||
// runs only once
|
||||
|
||||
// init pins, enable pullups
|
||||
pinMode(encoder_A_pin , INPUT_PULLUP); |
||||
pinMode(encoder_B_pin , INPUT_PULLUP); |
||||
pinMode(encoder_button_pin , INPUT_PULLUP); |
||||
} |
||||
|
||||
// check if encoder is rotated on direction A
|
||||
if(g_LCDML_CONTROL_Encoder_position <= -3)
|
||||
{ |
||||
// check if the button is pressed and the encoder is rotated
|
||||
// the button is low active
|
||||
if(g_LCDML_button == LOW) |
||||
{ |
||||
// button is pressed
|
||||
LCDML.BT_left();
|
||||
|
||||
// reset button press time for next detection
|
||||
g_LCDML_CONTROL_button_prev = HIGH; |
||||
} |
||||
else |
||||
{ |
||||
LCDML.BT_down(); |
||||
}
|
||||
|
||||
// init encoder for the next step
|
||||
ENCODER.write(g_LCDML_CONTROL_Encoder_position+4); |
||||
} |
||||
|
||||
// check if encoder is rotated on direction B
|
||||
else if(g_LCDML_CONTROL_Encoder_position >= 3) |
||||
{
|
||||
// check if the button is pressed and the encoder is rotated
|
||||
// the button is low active
|
||||
if(g_LCDML_button == LOW) |
||||
{ |
||||
// button is pressed
|
||||
LCDML.BT_right();
|
||||
|
||||
// reset button press time for next detection
|
||||
g_LCDML_CONTROL_button_prev = HIGH; |
||||
} |
||||
else |
||||
{ |
||||
LCDML.BT_up(); |
||||
}
|
||||
|
||||
// init encoder for the next step
|
||||
ENCODER.write(g_LCDML_CONTROL_Encoder_position-4); |
||||
} |
||||
else |
||||
{ |
||||
// check if the button was pressed for a shortly time or a long time
|
||||
|
||||
//falling edge, button pressed, no action
|
||||
if(g_LCDML_button == LOW && g_LCDML_CONTROL_button_prev == HIGH)
|
||||
{ |
||||
g_LCDML_CONTROL_button_prev = LOW; |
||||
g_LCDML_CONTROL_button_press_time = millis(); |
||||
} |
||||
|
||||
// rising edge, button not pressed, check how long was it pressed
|
||||
else if(g_LCDML_button == HIGH && g_LCDML_CONTROL_button_prev == LOW)
|
||||
{ |
||||
g_LCDML_CONTROL_button_prev = HIGH; |
||||
|
||||
// check how long was the button pressed and detect a long press or a short press
|
||||
|
||||
// check long press situation
|
||||
if((millis() - g_LCDML_CONTROL_button_press_time) >= g_LCDML_CONTROL_button_long_press) |
||||
{ |
||||
// long press detected
|
||||
LCDML.BT_quit(); |
||||
} |
||||
// check short press situation
|
||||
else if((millis() - g_LCDML_CONTROL_button_press_time) >= g_LCDML_CONTROL_button_short_press) |
||||
{ |
||||
// short press detected
|
||||
LCDML.BT_enter(); |
||||
} |
||||
} |
||||
|
||||
// do nothing
|
||||
else
|
||||
{ |
||||
// do nothing
|
||||
} |
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (4) CONTROL WITH A KEYPAD ***************************
|
||||
// *********************************************************************
|
||||
#elif(_LCDML_CONTROL_cfg == 4) |
||||
// include
|
||||
// more information under http://playground.arduino.cc/Main/KeypadTutorial
|
||||
#include <Keypad.h> |
||||
// settings
|
||||
#define _LCDML_CONTROL_keypad_rows 4 // Four rows
|
||||
#define _LCDML_CONTROL_keypad_cols 3 // Three columns
|
||||
// global vars
|
||||
char keys[_LCDML_CONTROL_keypad_rows][_LCDML_CONTROL_keypad_cols] = { |
||||
{'1','2','3'}, |
||||
{'4','5','6'}, |
||||
{'7','8','9'}, |
||||
{'#','0','*'} |
||||
}; |
||||
byte rowPins[_LCDML_CONTROL_keypad_rows] = { 9, 8, 7, 6 }; // Connect keypad COL0, COL1 and COL2 to these Arduino pins.
|
||||
byte colPins[_LCDML_CONTROL_keypad_cols] = { 12, 11, 10 }; // Create the Keypad
|
||||
// objects
|
||||
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, _LCDML_CONTROL_keypad_rows, _LCDML_CONTROL_keypad_cols ); |
||||
// *********************************************************************
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
} |
||||
char key = kpd.getKey(); |
||||
if(key) // Check for a valid key.
|
||||
{ |
||||
switch (key) |
||||
{ |
||||
// this is the default configuration
|
||||
case '#': LCDML.BT_enter(); break; |
||||
case '2': LCDML.BT_up(); break; |
||||
case '8': LCDML.BT_down(); break; |
||||
case '4': LCDML.BT_left(); break; |
||||
case '6': LCDML.BT_right(); break; |
||||
case '*': LCDML.BT_quit(); break; |
||||
|
||||
// when you want to use all characters you have to use the CE_ functionality
|
||||
// CE stands for "custom event" and you can define 64 evetns
|
||||
// the following code is only an example
|
||||
/*
|
||||
case '1': LCDML.CE_set(2); break; |
||||
case '2': LCDML.CE_set(3); LCDML.BT_up(); break; |
||||
case '3': LCDML.CE_set(4); break;
|
||||
case '4': LCDML.CE_set(5); LCDML.BT_left(); break; |
||||
case '5': LCDML.CE_set(6); break;
|
||||
case '6': LCDML.CE_set(7); LCDML.BT_right(); break; |
||||
case '7': LCDML.CE_set(8); break;
|
||||
case '8': LCDML.CE_set(9); LCDML.BT_down(); break; |
||||
case '9': LCDML.CE_set(10); break;
|
||||
case '0': LCDML.CE_set(1); break;
|
||||
case '#': LCDML.CE_set(12); LCDML.BT_enter(); break; |
||||
case '*': LCDML.CE_set(11); LCDML.BT_quit(); break; |
||||
*/
|
||||
default: break; |
||||
} |
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (5) CONTROL WITH IR REMOTE ***************************
|
||||
// *********************************************************************
|
||||
#elif(_LCDML_CONTROL_cfg == 5) |
||||
// IR include (this lib have to be installed)
|
||||
// Download path: https://github.com/ukw100/IRMP
|
||||
#define IRMP_INPUT_PIN PA0 |
||||
#define IRMP_PROTOCOL_NAMES 1 // Enable protocol number mapping to protocol strings - needs some FLASH. Must before #include <irmp*>
|
||||
#include <irmpSelectMain15Protocols.h> // This enables 15 main protocols |
||||
|
||||
#include <irmp.c.h> |
||||
|
||||
IRMP_DATA irmp_data[1]; |
||||
|
||||
#define STR_HELPER(x) #x |
||||
#define STR(x) STR_HELPER(x) |
||||
|
||||
void handleReceivedIRData(); |
||||
|
||||
// *********************************************************************
|
||||
// change in this function the IR values to your values
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
irmp_init(); |
||||
} |
||||
|
||||
if (irmp_get_data(&irmp_data[0])) |
||||
{ |
||||
// comment this line out, to check the correct code
|
||||
//Serial.println(results.value, HEX);
|
||||
|
||||
// in this switch case you have to change the value 0x...1 to the correct IR code
|
||||
switch (irmp_data[0].command) |
||||
{ |
||||
case 0x52: LCDML.BT_enter(); break; |
||||
case 0x50: LCDML.BT_up(); break; |
||||
case 0x51: LCDML.BT_down(); break; |
||||
case 0x55: LCDML.BT_left(); break; |
||||
case 0x56: LCDML.BT_right(); break; |
||||
case 0x23: LCDML.BT_quit(); break; |
||||
default: break; |
||||
} |
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (6) CONTROL OVER JOYSTICK ***************************
|
||||
// *********************************************************************
|
||||
#elif(_LCDML_CONTROL_cfg == 6) |
||||
unsigned long g_LCDML_DISP_press_time = 0; |
||||
// settings
|
||||
#define _LCDML_CONTROL_analog_pinx A0 |
||||
#define _LCDML_CONTROL_analog_piny A1 |
||||
#define _LCDML_CONTROL_digitalread 33 //don't work with u8glib
|
||||
|
||||
// when you did not use a button set the value to zero
|
||||
#define _LCDML_CONTROL_analog_up_min 612 // Button Up
|
||||
#define _LCDML_CONTROL_analog_up_max 1023 |
||||
#define _LCDML_CONTROL_analog_down_min 0 // Button Down
|
||||
#define _LCDML_CONTROL_analog_down_max 412 |
||||
#define _LCDML_CONTROL_analog_left_min 612 // Button Left
|
||||
#define _LCDML_CONTROL_analog_left_max 1023 |
||||
#define _LCDML_CONTROL_analog_right_min 0 // Button Right
|
||||
#define _LCDML_CONTROL_analog_right_max 412 |
||||
// *********************************************************************
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
pinMode (_LCDML_CONTROL_digitalread, INPUT); |
||||
} |
||||
// check debounce timer
|
||||
if((millis() - g_LCDML_DISP_press_time) >= 200) { |
||||
g_LCDML_DISP_press_time = millis(); // reset debounce timer
|
||||
|
||||
uint16_t valuex = analogRead(_LCDML_CONTROL_analog_pinx); // analogpinx
|
||||
uint16_t valuey = analogRead(_LCDML_CONTROL_analog_piny); // analogpinx
|
||||
uint16_t valuee = digitalRead(_LCDML_CONTROL_digitalread); //digitalpinenter
|
||||
|
||||
|
||||
if (valuey >= _LCDML_CONTROL_analog_up_min && valuey <= _LCDML_CONTROL_analog_up_max) { LCDML.BT_up(); } // up
|
||||
if (valuey >= _LCDML_CONTROL_analog_down_min && valuey <= _LCDML_CONTROL_analog_down_max) { LCDML.BT_down(); } // down
|
||||
if (valuex >= _LCDML_CONTROL_analog_left_min && valuex <= _LCDML_CONTROL_analog_left_max) { LCDML.BT_left(); } // left
|
||||
if (valuex >= _LCDML_CONTROL_analog_right_min && valuex <= _LCDML_CONTROL_analog_right_max) { LCDML.BT_right(); } // right
|
||||
|
||||
if(valuee == true) {LCDML.BT_enter();} // enter
|
||||
|
||||
// back buttons have to be included as menu item
|
||||
// lock at the example LCDML_back_button
|
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (7) CONTROL OVER PCF8574 ****************************
|
||||
// *********************************************************************
|
||||
|
||||
#elif(_LCDML_CONTROL_cfg == 7) |
||||
unsigned long g_LCDML_DISP_press_time = 0; |
||||
#define PCF8574_1 0x26 // I2C address for the buttons
|
||||
|
||||
#define PCF8574_Pin0 254 |
||||
#define PCF8574_Pin1 253 |
||||
#define PCF8574_Pin2 251 |
||||
#define PCF8574_Pin3 247 |
||||
#define PCF8574_Pin4 239 |
||||
#define PCF8574_Pin5 223 |
||||
#define PCF8574_Pin6 191 |
||||
#define PCF8574_Pin7 127 |
||||
|
||||
// Specify the PCF8574 pins here
|
||||
#define _LCDML_CONTROL_PCF8574_enable_quit 0 |
||||
#define _LCDML_CONTROL_PCF8574_enable_lr 0 |
||||
|
||||
#define _LCDML_CONTROL_PCF8574_enter PCF8574_Pin0 |
||||
#define _LCDML_CONTROL_PCF8574_up PCF8574_Pin1 |
||||
#define _LCDML_CONTROL_PCF8574_down PCF8574_Pin2 |
||||
#define _LCDML_CONTROL_PCF8574_left PCF8574_Pin3 |
||||
#define _LCDML_CONTROL_PCF8574_right PCF8574_Pin4 |
||||
#define _LCDML_CONTROL_PCF8574_quit PCF8574_Pin5 |
||||
// **********************************************************
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
} |
||||
|
||||
if((millis() - g_LCDML_DISP_press_time) >= 200) { |
||||
g_LCDML_DISP_press_time = millis(); // reset press time
|
||||
|
||||
Wire.write(0xff); // All pins as input?
|
||||
Wire.requestFrom(PCF8574_1, 1); |
||||
if (Wire.available()) { |
||||
switch (Wire.read()) |
||||
{ |
||||
case _LCDML_CONTROL_PCF8574_enter: LCDML.BT_enter(); break; |
||||
case _LCDML_CONTROL_PCF8574_up: LCDML.BT_up(); break; |
||||
case _LCDML_CONTROL_PCF8574_down: LCDML.BT_down(); break; |
||||
#if(_LCDML_CONTROL_PCF8574_enable_quit == 1) |
||||
case _LCDML_CONTROL_PCF8574_quit: LCDML.BT_quit(); break; |
||||
#endif |
||||
|
||||
#if(_LCDML_CONTROL_PCF8574_enable_lr == 1) |
||||
case _LCDML_CONTROL_PCF8574_left: LCDML.BT_left(); break; |
||||
case _LCDML_CONTROL_PCF8574_right: LCDML.BT_right(); break; |
||||
#endif |
||||
|
||||
default: break; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
#else |
||||
#error _LCDML_CONTROL_cfg is not defined or not in range |
||||
#endif |
@ -0,0 +1,646 @@ |
||||
// =====================================================================
|
||||
//
|
||||
// CONTROL v2.2.0
|
||||
//
|
||||
// =====================================================================
|
||||
// *********************************************************************
|
||||
// Features
|
||||
// - max 6 Buttons with special names (enter, quit, up, down, left, right)
|
||||
// new Features on v2.2.0
|
||||
// - max 64 Events, this could be a button ore something (Counter 0 - 63)
|
||||
// - standard buttons and events can be used at the same time
|
||||
// - Event 0 - 3 can be used with a menu callback function (when set this event, the function is called)
|
||||
// - The range from 0 - 3 can be changed in LCDMenuLib2.h
|
||||
// Attention!!
|
||||
// - events have to be reset manual over LCDML.CE_reset(number) ore LCDML.CE_resetAll();
|
||||
// - they will not be reseted from the menu library
|
||||
// *********************************************************************
|
||||
// content:
|
||||
// (0) Control over serial interface with asdw_e_q
|
||||
// (1) Control over one analog input
|
||||
// (2) Control over 4 - 6 digital input pins (internal pullups enabled)
|
||||
// (3) Control over encoder [third party lib] (Download: https://github.com/PaulStoffregen/Encoder)
|
||||
// (4) Control with Keypad [third party lib] (Download: http://playground.arduino.cc/Main/KeypadTutorial )
|
||||
// (5) Control with an IRMP remote [third party lib] (Download: https://github.com/ukw100/IRMP )
|
||||
// (6) Control with a joystick
|
||||
// (7) Control over I2C PCF8574
|
||||
// *********************************************************************
|
||||
|
||||
#define _LCDML_CONTROL_cfg 0 |
||||
|
||||
// theory:
|
||||
// "#if" is a preprocessor directive and no error, look here:
|
||||
// (English) https://en.wikipedia.org/wiki/C_preprocessor
|
||||
// (German) https://de.wikipedia.org/wiki/C-Pr%C3%A4prozessor
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (0) CONTROL OVER SERIAL INTERFACE *******************
|
||||
// *********************************************************************
|
||||
#if(_LCDML_CONTROL_cfg == 0) |
||||
// settings
|
||||
# define _LCDML_CONTROL_serial_enter 'e' |
||||
# define _LCDML_CONTROL_serial_up 'w' |
||||
# define _LCDML_CONTROL_serial_down 's' |
||||
# define _LCDML_CONTROL_serial_left 'a' |
||||
# define _LCDML_CONTROL_serial_right 'd' |
||||
# define _LCDML_CONTROL_serial_quit 'q' |
||||
|
||||
// example for the useage of events (not needed everywhere)
|
||||
// this defines are only for examples and can be renamed
|
||||
# define _LCDML_EVENT_command 'c' |
||||
# define _LCDML_EVENT_char_0 '0' |
||||
# define _LCDML_EVENT_char_1 '1' |
||||
# define _LCDML_EVENT_char_2 '2' |
||||
# define _LCDML_EVENT_char_3 '3' |
||||
# define _LCDML_EVENT_char_4 '4' |
||||
# define _LCDML_EVENT_char_5 '5' |
||||
# define _LCDML_EVENT_char_6 '6' |
||||
# define _LCDML_EVENT_char_7 '7' |
||||
# define _LCDML_EVENT_char_8 '8' |
||||
# define _LCDML_EVENT_char_9 '9' |
||||
// *********************************************************************
|
||||
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
} |
||||
|
||||
if(LCDML.CE_setup()) { |
||||
// runs only once
|
||||
} |
||||
|
||||
// check if new serial input is available
|
||||
if (Serial.available()) { |
||||
// read one char from input buffer
|
||||
switch (Serial.read()) |
||||
{ |
||||
case _LCDML_CONTROL_serial_enter: LCDML.BT_enter(); break; |
||||
case _LCDML_CONTROL_serial_up: LCDML.BT_up(); break; |
||||
case _LCDML_CONTROL_serial_down: LCDML.BT_down(); break; |
||||
case _LCDML_CONTROL_serial_left: LCDML.BT_left(); break; |
||||
case _LCDML_CONTROL_serial_right: LCDML.BT_right(); break; |
||||
case _LCDML_CONTROL_serial_quit: LCDML.BT_quit(); break; |
||||
// example for event handling
|
||||
// custom event handling
|
||||
// is is also possible to enable more the one event on the same time
|
||||
// but when more then one events with callback functions are active
|
||||
// only the first callback function is called. (first = by number)
|
||||
case _LCDML_EVENT_command: LCDML.CE_set(0); break; |
||||
case _LCDML_EVENT_char_0: LCDML.CE_set(1); break; |
||||
case _LCDML_EVENT_char_1: LCDML.CE_set(2); break; |
||||
case _LCDML_EVENT_char_2: LCDML.CE_set(3); break; |
||||
case _LCDML_EVENT_char_3: LCDML.CE_set(4); break; |
||||
case _LCDML_EVENT_char_4: LCDML.CE_set(5); break; |
||||
case _LCDML_EVENT_char_5: LCDML.CE_set(6); break; |
||||
case _LCDML_EVENT_char_6: LCDML.CE_set(7); break; |
||||
case _LCDML_EVENT_char_7: LCDML.CE_set(8); break; |
||||
case _LCDML_EVENT_char_8: LCDML.CE_set(9); break; |
||||
case _LCDML_EVENT_char_9: LCDML.CE_set(10); break; |
||||
default: break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (1) CONTROL OVER ONE ANALOG PIN *********************
|
||||
// *********************************************************************
|
||||
#elif(_LCDML_CONTROL_cfg == 1) |
||||
|
||||
unsigned long g_LCDML_DISP_press_time = 0; |
||||
// settings
|
||||
#define _LCDML_CONTROL_analog_pin 0 |
||||
// when you did not use a button set the value to zero
|
||||
#define _LCDML_CONTROL_analog_enter_min 850 // Button Enter
|
||||
#define _LCDML_CONTROL_analog_enter_max 920 |
||||
#define _LCDML_CONTROL_analog_up_min 520 // Button Up
|
||||
#define _LCDML_CONTROL_analog_up_max 590 |
||||
#define _LCDML_CONTROL_analog_down_min 700 // Button Down
|
||||
#define _LCDML_CONTROL_analog_down_max 770 |
||||
#define _LCDML_CONTROL_analog_back_min 950 // Button Back
|
||||
#define _LCDML_CONTROL_analog_back_max 1020 |
||||
#define _LCDML_CONTROL_analog_left_min 430 // Button Left
|
||||
#define _LCDML_CONTROL_analog_left_max 500 |
||||
#define _LCDML_CONTROL_analog_right_min 610 // Button Right
|
||||
#define _LCDML_CONTROL_analog_right_max 680 |
||||
// *********************************************************************
|
||||
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
} |
||||
// check debounce timer
|
||||
if((millis() - g_LCDML_DISP_press_time) >= 200) { |
||||
g_LCDML_DISP_press_time = millis(); // reset debounce timer
|
||||
|
||||
uint16_t value = analogRead(_LCDML_CONTROL_analog_pin); // analog pin for keypad
|
||||
|
||||
if (value >= _LCDML_CONTROL_analog_enter_min && value <= _LCDML_CONTROL_analog_enter_max) { LCDML.BT_enter(); } |
||||
if (value >= _LCDML_CONTROL_analog_up_min && value <= _LCDML_CONTROL_analog_up_max) { LCDML.BT_up(); } |
||||
if (value >= _LCDML_CONTROL_analog_down_min && value <= _LCDML_CONTROL_analog_down_max) { LCDML.BT_down(); } |
||||
if (value >= _LCDML_CONTROL_analog_left_min && value <= _LCDML_CONTROL_analog_left_max) { LCDML.BT_left(); } |
||||
if (value >= _LCDML_CONTROL_analog_right_min && value <= _LCDML_CONTROL_analog_right_max) { LCDML.BT_right(); } |
||||
if (value >= _LCDML_CONTROL_analog_back_min && value <= _LCDML_CONTROL_analog_back_max) { LCDML.BT_quit(); } |
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (2) CONTROL OVER DIGITAL PINS ***********************
|
||||
// *********************************************************************
|
||||
#elif(_LCDML_CONTROL_cfg == 2) |
||||
// settings
|
||||
unsigned long g_LCDML_DISP_press_time = 0; |
||||
|
||||
#define _LCDML_CONTROL_digital_low_active 0 // 0 = high active (pulldown) button, 1 = low active (pullup)
|
||||
// http://playground.arduino.cc/CommonTopics/PullUpDownResistor
|
||||
#define _LCDML_CONTROL_digital_enable_quit 1 |
||||
#define _LCDML_CONTROL_digital_enable_lr 1 |
||||
#define _LCDML_CONTROL_digital_enter 8 |
||||
#define _LCDML_CONTROL_digital_up 9 |
||||
#define _LCDML_CONTROL_digital_down 10 |
||||
#define _LCDML_CONTROL_digital_quit 11 |
||||
#define _LCDML_CONTROL_digital_left 12 |
||||
#define _LCDML_CONTROL_digital_right 13 |
||||
// *********************************************************************
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
// init buttons
|
||||
pinMode(_LCDML_CONTROL_digital_enter , INPUT_PULLUP); |
||||
pinMode(_LCDML_CONTROL_digital_up , INPUT_PULLUP); |
||||
pinMode(_LCDML_CONTROL_digital_down , INPUT_PULLUP); |
||||
# if(_LCDML_CONTROL_digital_enable_quit == 1) |
||||
pinMode(_LCDML_CONTROL_digital_quit , INPUT_PULLUP); |
||||
# endif |
||||
# if(_LCDML_CONTROL_digital_enable_lr == 1) |
||||
pinMode(_LCDML_CONTROL_digital_left , INPUT_PULLUP); |
||||
pinMode(_LCDML_CONTROL_digital_right , INPUT_PULLUP); |
||||
# endif |
||||
} |
||||
|
||||
#if(_LCDML_CONTROL_digital_low_active == 1) |
||||
# define _LCDML_CONTROL_digital_a ! |
||||
#else |
||||
# define _LCDML_CONTROL_digital_a |
||||
#endif |
||||
|
||||
uint8_t but_stat = 0x00; |
||||
|
||||
bitWrite(but_stat, 0, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_enter))); |
||||
bitWrite(but_stat, 1, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_up))); |
||||
bitWrite(but_stat, 2, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_down))); |
||||
#if(_LCDML_CONTROL_digital_enable_quit == 1) |
||||
bitWrite(but_stat, 3, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_quit))); |
||||
#endif |
||||
#if(_LCDML_CONTROL_digital_enable_lr == 1) |
||||
bitWrite(but_stat, 4, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_left))); |
||||
bitWrite(but_stat, 5, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_right))); |
||||
#endif |
||||
|
||||
if (but_stat > 0) { |
||||
if((millis() - g_LCDML_DISP_press_time) >= 200) { |
||||
g_LCDML_DISP_press_time = millis(); // reset press time
|
||||
|
||||
if (bitRead(but_stat, 0)) { LCDML.BT_enter(); } |
||||
if (bitRead(but_stat, 1)) { LCDML.BT_up(); } |
||||
if (bitRead(but_stat, 2)) { LCDML.BT_down(); } |
||||
if (bitRead(but_stat, 3)) { LCDML.BT_quit(); } |
||||
if (bitRead(but_stat, 4)) { LCDML.BT_left(); } |
||||
if (bitRead(but_stat, 5)) { LCDML.BT_right(); } |
||||
} |
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (3) CONTROL WITH ENCODER ****************************
|
||||
// *********************************************************************
|
||||
#elif(_LCDML_CONTROL_cfg == 3) |
||||
/*
|
||||
* Thanks to "MuchMore" (Arduino forum) to add this encoder functionality |
||||
* |
||||
* rotate left = Up |
||||
* rotate right = Down |
||||
* push = Enter |
||||
* push long = Quit |
||||
* push + rotate left = Left |
||||
* push + rotate right = Right |
||||
*/ |
||||
|
||||
/* encoder connection
|
||||
* button * (do not use an external resistor, the internal pullup resistor is used) |
||||
* .-------o Arduino Pin |
||||
* | |
||||
* | |
||||
* o / |
||||
* / |
||||
* / |
||||
* o |
||||
* | |
||||
* '-------o GND |
||||
* |
||||
* encoder * (do not use an external resistor, the internal pullup resistors are used) |
||||
* |
||||
* .---------------o Arduino Pin A |
||||
* | .------o Arduino Pin B |
||||
* | | |
||||
* o / o / |
||||
* / / |
||||
* / / |
||||
* o o |
||||
* | | |
||||
* '--------o----o GND (common pin) |
||||
*/ |
||||
|
||||
// global defines
|
||||
#define encoder_A_pin 20 // physical pin has to be 2 or 3 to use interrupts (on mega e.g. 20 or 21), use internal pullups
|
||||
#define encoder_B_pin 21 // physical pin has to be 2 or 3 to use interrupts (on mega e.g. 20 or 21), use internal pullups
|
||||
#define encoder_button_pin 49 // physical pin , use internal pullup
|
||||
|
||||
#define g_LCDML_CONTROL_button_long_press 800 // ms
|
||||
#define g_LCDML_CONTROL_button_short_press 120 // ms
|
||||
|
||||
#define ENCODER_OPTIMIZE_INTERRUPTS //Only when using pin2/3 (or 20/21 on mega)
|
||||
#include <Encoder.h> //for Encoder Download: https://github.com/PaulStoffregen/Encoder |
||||
|
||||
Encoder ENCODER(encoder_A_pin, encoder_B_pin); |
||||
|
||||
unsigned long g_LCDML_CONTROL_button_press_time = millis(); |
||||
bool g_LCDML_CONTROL_button_prev = HIGH; |
||||
|
||||
// *********************************************************************
|
||||
void lcdml_menu_control(void) |
||||
// *********************************************************************
|
||||
{ |
||||
// declare variable for this function
|
||||
int32_t g_LCDML_CONTROL_Encoder_position = ENCODER.read(); |
||||
bool g_LCDML_button = digitalRead(encoder_button_pin); |
||||
|
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) |
||||
{ |
||||
// runs only once
|
||||
|
||||
// init pins, enable pullups
|
||||
pinMode(encoder_A_pin , INPUT_PULLUP); |
||||
pinMode(encoder_B_pin , INPUT_PULLUP); |
||||
pinMode(encoder_button_pin , INPUT_PULLUP); |
||||
} |
||||
|
||||
// check if encoder is rotated on direction A
|
||||
if(g_LCDML_CONTROL_Encoder_position <= -3)
|
||||
{ |
||||
// check if the button is pressed and the encoder is rotated
|
||||
// the button is low active
|
||||
if(g_LCDML_button == LOW) |
||||
{ |
||||
// button is pressed
|
||||
LCDML.BT_left();
|
||||
|
||||
// reset button press time for next detection
|
||||
g_LCDML_CONTROL_button_prev = HIGH; |
||||
} |
||||
else |
||||
{ |
||||
LCDML.BT_down(); |
||||
}
|
||||
|
||||
// init encoder for the next step
|
||||
ENCODER.write(g_LCDML_CONTROL_Encoder_position+4); |
||||
} |
||||
|
||||
// check if encoder is rotated on direction B
|
||||
else if(g_LCDML_CONTROL_Encoder_position >= 3) |
||||
{
|
||||
// check if the button is pressed and the encoder is rotated
|
||||
// the button is low active
|
||||
if(g_LCDML_button == LOW) |
||||
{ |
||||
// button is pressed
|
||||
LCDML.BT_right();
|
||||
|
||||
// reset button press time for next detection
|
||||
g_LCDML_CONTROL_button_prev = HIGH; |
||||
} |
||||
else |
||||
{ |
||||
LCDML.BT_up(); |
||||
}
|
||||
|
||||
// init encoder for the next step
|
||||
ENCODER.write(g_LCDML_CONTROL_Encoder_position-4); |
||||
} |
||||
else |
||||
{ |
||||
// check if the button was pressed for a shortly time or a long time
|
||||
|
||||
//falling edge, button pressed, no action
|
||||
if(g_LCDML_button == LOW && g_LCDML_CONTROL_button_prev == HIGH)
|
||||
{ |
||||
g_LCDML_CONTROL_button_prev = LOW; |
||||
g_LCDML_CONTROL_button_press_time = millis(); |
||||
} |
||||
|
||||
// rising edge, button not pressed, check how long was it pressed
|
||||
else if(g_LCDML_button == HIGH && g_LCDML_CONTROL_button_prev == LOW)
|
||||
{ |
||||
g_LCDML_CONTROL_button_prev = HIGH; |
||||
|
||||
// check how long was the button pressed and detect a long press or a short press
|
||||
|
||||
// check long press situation
|
||||
if((millis() - g_LCDML_CONTROL_button_press_time) >= g_LCDML_CONTROL_button_long_press) |
||||
{ |
||||
// long press detected
|
||||
LCDML.BT_quit(); |
||||
} |
||||
// check short press situation
|
||||
else if((millis() - g_LCDML_CONTROL_button_press_time) >= g_LCDML_CONTROL_button_short_press) |
||||
{ |
||||
// short press detected
|
||||
LCDML.BT_enter(); |
||||
} |
||||
} |
||||
|
||||
// do nothing
|
||||
else
|
||||
{ |
||||
// do nothing
|
||||
} |
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (4) CONTROL WITH A KEYPAD ***************************
|
||||
// *********************************************************************
|
||||
#elif(_LCDML_CONTROL_cfg == 4) |
||||
// include
|
||||
// more information under http://playground.arduino.cc/Main/KeypadTutorial
|
||||
#include <Keypad.h> |
||||
// settings
|
||||
#define _LCDML_CONTROL_keypad_rows 4 // Four rows
|
||||
#define _LCDML_CONTROL_keypad_cols 3 // Three columns
|
||||
// global vars
|
||||
char keys[_LCDML_CONTROL_keypad_rows][_LCDML_CONTROL_keypad_cols] = { |
||||
{'1','2','3'}, |
||||
{'4','5','6'}, |
||||
{'7','8','9'}, |
||||
{'#','0','*'} |
||||
}; |
||||
byte rowPins[_LCDML_CONTROL_keypad_rows] = { 9, 8, 7, 6 }; // Connect keypad COL0, COL1 and COL2 to these Arduino pins.
|
||||
byte colPins[_LCDML_CONTROL_keypad_cols] = { 12, 11, 10 }; // Create the Keypad
|
||||
// objects
|
||||
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, _LCDML_CONTROL_keypad_rows, _LCDML_CONTROL_keypad_cols ); |
||||
// *********************************************************************
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
} |
||||
char key = kpd.getKey(); |
||||
if(key) // Check for a valid key.
|
||||
{ |
||||
switch (key) |
||||
{ |
||||
// this is the default configuration
|
||||
case '#': LCDML.BT_enter(); break; |
||||
case '2': LCDML.BT_up(); break; |
||||
case '8': LCDML.BT_down(); break; |
||||
case '4': LCDML.BT_left(); break; |
||||
case '6': LCDML.BT_right(); break; |
||||
case '*': LCDML.BT_quit(); break; |
||||
|
||||
// when you want to use all characters you have to use the CE_ functionality
|
||||
// CE stands for "custom event" and you can define 64 evetns
|
||||
// the following code is only an example
|
||||
/*
|
||||
case '1': LCDML.CE_set(2); break; |
||||
case '2': LCDML.CE_set(3); LCDML.BT_up(); break; |
||||
case '3': LCDML.CE_set(4); break;
|
||||
case '4': LCDML.CE_set(5); LCDML.BT_left(); break; |
||||
case '5': LCDML.CE_set(6); break;
|
||||
case '6': LCDML.CE_set(7); LCDML.BT_right(); break; |
||||
case '7': LCDML.CE_set(8); break;
|
||||
case '8': LCDML.CE_set(9); LCDML.BT_down(); break; |
||||
case '9': LCDML.CE_set(10); break;
|
||||
case '0': LCDML.CE_set(1); break;
|
||||
case '#': LCDML.CE_set(12); LCDML.BT_enter(); break; |
||||
case '*': LCDML.CE_set(11); LCDML.BT_quit(); break; |
||||
*/
|
||||
default: break; |
||||
} |
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (5) CONTROL WITH IR REMOTE ***************************
|
||||
// *********************************************************************
|
||||
#elif(_LCDML_CONTROL_cfg == 5) |
||||
// IR include (this lib have to be installed)
|
||||
// Download path: https://github.com/ukw100/IRMP
|
||||
#define IRMP_INPUT_PIN PA0 |
||||
#define IRMP_PROTOCOL_NAMES 1 // Enable protocol number mapping to protocol strings - needs some FLASH. Must before #include <irmp*>
|
||||
#include <irmpSelectMain15Protocols.h> // This enables 15 main protocols |
||||
|
||||
#include <irmp.c.h> |
||||
|
||||
IRMP_DATA irmp_data[1]; |
||||
|
||||
#define STR_HELPER(x) #x |
||||
#define STR(x) STR_HELPER(x) |
||||
|
||||
void handleReceivedIRData(); |
||||
|
||||
// *********************************************************************
|
||||
// change in this function the IR values to your values
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
irmp_init(); |
||||
} |
||||
|
||||
if (irmp_get_data(&irmp_data[0])) |
||||
{ |
||||
// comment this line out, to check the correct code
|
||||
//Serial.println(results.value, HEX);
|
||||
|
||||
// in this switch case you have to change the value 0x...1 to the correct IR code
|
||||
switch (irmp_data[0].command) |
||||
{ |
||||
case 0x52: LCDML.BT_enter(); break; |
||||
case 0x50: LCDML.BT_up(); break; |
||||
case 0x51: LCDML.BT_down(); break; |
||||
case 0x55: LCDML.BT_left(); break; |
||||
case 0x56: LCDML.BT_right(); break; |
||||
case 0x23: LCDML.BT_quit(); break; |
||||
default: break; |
||||
} |
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (6) CONTROL OVER JOYSTICK ***************************
|
||||
// *********************************************************************
|
||||
#elif(_LCDML_CONTROL_cfg == 6) |
||||
unsigned long g_LCDML_DISP_press_time = 0; |
||||
// settings
|
||||
#define _LCDML_CONTROL_analog_pinx A0 |
||||
#define _LCDML_CONTROL_analog_piny A1 |
||||
#define _LCDML_CONTROL_digitalread 33 //don't work with u8glib
|
||||
|
||||
// when you did not use a button set the value to zero
|
||||
#define _LCDML_CONTROL_analog_up_min 612 // Button Up
|
||||
#define _LCDML_CONTROL_analog_up_max 1023 |
||||
#define _LCDML_CONTROL_analog_down_min 0 // Button Down
|
||||
#define _LCDML_CONTROL_analog_down_max 412 |
||||
#define _LCDML_CONTROL_analog_left_min 612 // Button Left
|
||||
#define _LCDML_CONTROL_analog_left_max 1023 |
||||
#define _LCDML_CONTROL_analog_right_min 0 // Button Right
|
||||
#define _LCDML_CONTROL_analog_right_max 412 |
||||
// *********************************************************************
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
pinMode (_LCDML_CONTROL_digitalread, INPUT); |
||||
} |
||||
// check debounce timer
|
||||
if((millis() - g_LCDML_DISP_press_time) >= 200) { |
||||
g_LCDML_DISP_press_time = millis(); // reset debounce timer
|
||||
|
||||
uint16_t valuex = analogRead(_LCDML_CONTROL_analog_pinx); // analogpinx
|
||||
uint16_t valuey = analogRead(_LCDML_CONTROL_analog_piny); // analogpinx
|
||||
uint16_t valuee = digitalRead(_LCDML_CONTROL_digitalread); //digitalpinenter
|
||||
|
||||
|
||||
if (valuey >= _LCDML_CONTROL_analog_up_min && valuey <= _LCDML_CONTROL_analog_up_max) { LCDML.BT_up(); } // up
|
||||
if (valuey >= _LCDML_CONTROL_analog_down_min && valuey <= _LCDML_CONTROL_analog_down_max) { LCDML.BT_down(); } // down
|
||||
if (valuex >= _LCDML_CONTROL_analog_left_min && valuex <= _LCDML_CONTROL_analog_left_max) { LCDML.BT_left(); } // left
|
||||
if (valuex >= _LCDML_CONTROL_analog_right_min && valuex <= _LCDML_CONTROL_analog_right_max) { LCDML.BT_right(); } // right
|
||||
|
||||
if(valuee == true) {LCDML.BT_enter();} // enter
|
||||
|
||||
// back buttons have to be included as menu item
|
||||
// lock at the example LCDML_back_button
|
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (7) CONTROL OVER PCF8574 ****************************
|
||||
// *********************************************************************
|
||||
|
||||
#elif(_LCDML_CONTROL_cfg == 7) |
||||
unsigned long g_LCDML_DISP_press_time = 0; |
||||
#define PCF8574_1 0x26 // I2C address for the buttons
|
||||
|
||||
#define PCF8574_Pin0 254 |
||||
#define PCF8574_Pin1 253 |
||||
#define PCF8574_Pin2 251 |
||||
#define PCF8574_Pin3 247 |
||||
#define PCF8574_Pin4 239 |
||||
#define PCF8574_Pin5 223 |
||||
#define PCF8574_Pin6 191 |
||||
#define PCF8574_Pin7 127 |
||||
|
||||
// Specify the PCF8574 pins here
|
||||
#define _LCDML_CONTROL_PCF8574_enable_quit 0 |
||||
#define _LCDML_CONTROL_PCF8574_enable_lr 0 |
||||
|
||||
#define _LCDML_CONTROL_PCF8574_enter PCF8574_Pin0 |
||||
#define _LCDML_CONTROL_PCF8574_up PCF8574_Pin1 |
||||
#define _LCDML_CONTROL_PCF8574_down PCF8574_Pin2 |
||||
#define _LCDML_CONTROL_PCF8574_left PCF8574_Pin3 |
||||
#define _LCDML_CONTROL_PCF8574_right PCF8574_Pin4 |
||||
#define _LCDML_CONTROL_PCF8574_quit PCF8574_Pin5 |
||||
// **********************************************************
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
} |
||||
|
||||
if((millis() - g_LCDML_DISP_press_time) >= 200) { |
||||
g_LCDML_DISP_press_time = millis(); // reset press time
|
||||
|
||||
Wire.write(0xff); // All pins as input?
|
||||
Wire.requestFrom(PCF8574_1, 1); |
||||
if (Wire.available()) { |
||||
switch (Wire.read()) |
||||
{ |
||||
case _LCDML_CONTROL_PCF8574_enter: LCDML.BT_enter(); break; |
||||
case _LCDML_CONTROL_PCF8574_up: LCDML.BT_up(); break; |
||||
case _LCDML_CONTROL_PCF8574_down: LCDML.BT_down(); break; |
||||
#if(_LCDML_CONTROL_PCF8574_enable_quit == 1) |
||||
case _LCDML_CONTROL_PCF8574_quit: LCDML.BT_quit(); break; |
||||
#endif |
||||
|
||||
#if(_LCDML_CONTROL_PCF8574_enable_lr == 1) |
||||
case _LCDML_CONTROL_PCF8574_left: LCDML.BT_left(); break; |
||||
case _LCDML_CONTROL_PCF8574_right: LCDML.BT_right(); break; |
||||
#endif |
||||
|
||||
default: break; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
#else |
||||
#error _LCDML_CONTROL_cfg is not defined or not in range |
||||
#endif |
@ -1,647 +0,0 @@ |
||||
// =====================================================================
|
||||
//
|
||||
// CONTROL v2.2.0
|
||||
//
|
||||
// =====================================================================
|
||||
// *********************************************************************
|
||||
// Features
|
||||
// - max 6 Buttons with special names (enter, quit, up, down, left, right)
|
||||
// new Features on v2.2.0
|
||||
// - max 64 Events, this could be a button ore something (Counter 0 - 63)
|
||||
// - standard buttons and events can be used at the same time
|
||||
// - Event 0 - 3 can be used with a menu callback function (when set this event, the function is called)
|
||||
// - The range from 0 - 3 can be changed in LCDMenuLib2.h
|
||||
// Attention!!
|
||||
// - events have to be reset manual over LCDML.CE_reset(number) ore LCDML.CE_resetAll();
|
||||
// - they will not be reseted from the menu library
|
||||
// *********************************************************************
|
||||
// content:
|
||||
// (0) Control over serial interface with asdw_e_q
|
||||
// (1) Control over one analog input
|
||||
// (2) Control over 4 - 6 digital input pins (internal pullups enabled)
|
||||
// (3) Control over encoder [third party lib] (Download: https://github.com/PaulStoffregen/Encoder)
|
||||
// (4) Control with Keypad [third party lib] (Download: http://playground.arduino.cc/Main/KeypadTutorial )
|
||||
// (5) Control with an IRMP remote [third party lib] (Download: https://github.com/ukw100/IRMP )
|
||||
// (6) Control with a joystick
|
||||
// (7) Control over I2C PCF8574
|
||||
// *********************************************************************
|
||||
|
||||
#define _LCDML_CONTROL_cfg 0 |
||||
|
||||
// theory:
|
||||
// "#if" is a preprocessor directive and no error, look here:
|
||||
// (English) https://en.wikipedia.org/wiki/C_preprocessor
|
||||
// (German) https://de.wikipedia.org/wiki/C-Pr%C3%A4prozessor
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (0) CONTROL OVER SERIAL INTERFACE *******************
|
||||
// *********************************************************************
|
||||
#if(_LCDML_CONTROL_cfg == 0) |
||||
// settings
|
||||
# define _LCDML_CONTROL_serial_enter 'e' |
||||
# define _LCDML_CONTROL_serial_up 'w' |
||||
# define _LCDML_CONTROL_serial_down 's' |
||||
# define _LCDML_CONTROL_serial_left 'a' |
||||
# define _LCDML_CONTROL_serial_right 'd' |
||||
# define _LCDML_CONTROL_serial_quit 'q' |
||||
|
||||
// example for the useage of events (not needed everywhere)
|
||||
// this defines are only for examples and can be renamed
|
||||
# define _LCDML_EVENT_command 'c' |
||||
# define _LCDML_EVENT_char_0 '0' |
||||
# define _LCDML_EVENT_char_1 '1' |
||||
# define _LCDML_EVENT_char_2 '2' |
||||
# define _LCDML_EVENT_char_3 '3' |
||||
# define _LCDML_EVENT_char_4 '4' |
||||
# define _LCDML_EVENT_char_5 '5' |
||||
# define _LCDML_EVENT_char_6 '6' |
||||
# define _LCDML_EVENT_char_7 '7' |
||||
# define _LCDML_EVENT_char_8 '8' |
||||
# define _LCDML_EVENT_char_9 '9' |
||||
// *********************************************************************
|
||||
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
} |
||||
|
||||
if(LCDML.CE_setup()) { |
||||
// runs only once
|
||||
Serial.println("CE_setup()"); |
||||
} |
||||
|
||||
// check if new serial input is available
|
||||
if (Serial.available()) { |
||||
// read one char from input buffer
|
||||
switch (Serial.read()) |
||||
{ |
||||
case _LCDML_CONTROL_serial_enter: LCDML.BT_enter(); break; |
||||
case _LCDML_CONTROL_serial_up: LCDML.BT_up(); break; |
||||
case _LCDML_CONTROL_serial_down: LCDML.BT_down(); break; |
||||
case _LCDML_CONTROL_serial_left: LCDML.BT_left(); break; |
||||
case _LCDML_CONTROL_serial_right: LCDML.BT_right(); break; |
||||
case _LCDML_CONTROL_serial_quit: LCDML.BT_quit(); break; |
||||
// example for event handling
|
||||
// custom event handling
|
||||
// is is also possible to enable more the one event on the same time
|
||||
// but when more then one events with callback functions are active
|
||||
// only the first callback function is called. (first = by number)
|
||||
case _LCDML_EVENT_command: LCDML.CE_set(0); break; |
||||
case _LCDML_EVENT_char_0: LCDML.CE_set(1); break; |
||||
case _LCDML_EVENT_char_1: LCDML.CE_set(2); break; |
||||
case _LCDML_EVENT_char_2: LCDML.CE_set(3); break; |
||||
case _LCDML_EVENT_char_3: LCDML.CE_set(4); break; |
||||
case _LCDML_EVENT_char_4: LCDML.CE_set(5); break; |
||||
case _LCDML_EVENT_char_5: LCDML.CE_set(6); break; |
||||
case _LCDML_EVENT_char_6: LCDML.CE_set(7); break; |
||||
case _LCDML_EVENT_char_7: LCDML.CE_set(8); break; |
||||
case _LCDML_EVENT_char_8: LCDML.CE_set(9); break; |
||||
case _LCDML_EVENT_char_9: LCDML.CE_set(10); break; |
||||
default: break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (1) CONTROL OVER ONE ANALOG PIN *********************
|
||||
// *********************************************************************
|
||||
#elif(_LCDML_CONTROL_cfg == 1) |
||||
|
||||
unsigned long g_LCDML_DISP_press_time = 0; |
||||
// settings
|
||||
#define _LCDML_CONTROL_analog_pin 0 |
||||
// when you did not use a button set the value to zero
|
||||
#define _LCDML_CONTROL_analog_enter_min 850 // Button Enter
|
||||
#define _LCDML_CONTROL_analog_enter_max 920 |
||||
#define _LCDML_CONTROL_analog_up_min 520 // Button Up
|
||||
#define _LCDML_CONTROL_analog_up_max 590 |
||||
#define _LCDML_CONTROL_analog_down_min 700 // Button Down
|
||||
#define _LCDML_CONTROL_analog_down_max 770 |
||||
#define _LCDML_CONTROL_analog_back_min 950 // Button Back
|
||||
#define _LCDML_CONTROL_analog_back_max 1020 |
||||
#define _LCDML_CONTROL_analog_left_min 430 // Button Left
|
||||
#define _LCDML_CONTROL_analog_left_max 500 |
||||
#define _LCDML_CONTROL_analog_right_min 610 // Button Right
|
||||
#define _LCDML_CONTROL_analog_right_max 680 |
||||
// *********************************************************************
|
||||
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
} |
||||
// check debounce timer
|
||||
if((millis() - g_LCDML_DISP_press_time) >= 200) { |
||||
g_LCDML_DISP_press_time = millis(); // reset debounce timer
|
||||
|
||||
uint16_t value = analogRead(_LCDML_CONTROL_analog_pin); // analog pin for keypad
|
||||
|
||||
if (value >= _LCDML_CONTROL_analog_enter_min && value <= _LCDML_CONTROL_analog_enter_max) { LCDML.BT_enter(); } |
||||
if (value >= _LCDML_CONTROL_analog_up_min && value <= _LCDML_CONTROL_analog_up_max) { LCDML.BT_up(); } |
||||
if (value >= _LCDML_CONTROL_analog_down_min && value <= _LCDML_CONTROL_analog_down_max) { LCDML.BT_down(); } |
||||
if (value >= _LCDML_CONTROL_analog_left_min && value <= _LCDML_CONTROL_analog_left_max) { LCDML.BT_left(); } |
||||
if (value >= _LCDML_CONTROL_analog_right_min && value <= _LCDML_CONTROL_analog_right_max) { LCDML.BT_right(); } |
||||
if (value >= _LCDML_CONTROL_analog_back_min && value <= _LCDML_CONTROL_analog_back_max) { LCDML.BT_quit(); } |
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (2) CONTROL OVER DIGITAL PINS ***********************
|
||||
// *********************************************************************
|
||||
#elif(_LCDML_CONTROL_cfg == 2) |
||||
// settings
|
||||
unsigned long g_LCDML_DISP_press_time = 0; |
||||
|
||||
#define _LCDML_CONTROL_digital_low_active 0 // 0 = high active (pulldown) button, 1 = low active (pullup)
|
||||
// http://playground.arduino.cc/CommonTopics/PullUpDownResistor
|
||||
#define _LCDML_CONTROL_digital_enable_quit 1 |
||||
#define _LCDML_CONTROL_digital_enable_lr 1 |
||||
#define _LCDML_CONTROL_digital_enter 8 |
||||
#define _LCDML_CONTROL_digital_up 9 |
||||
#define _LCDML_CONTROL_digital_down 10 |
||||
#define _LCDML_CONTROL_digital_quit 11 |
||||
#define _LCDML_CONTROL_digital_left 12 |
||||
#define _LCDML_CONTROL_digital_right 13 |
||||
// *********************************************************************
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
// init buttons
|
||||
pinMode(_LCDML_CONTROL_digital_enter , INPUT_PULLUP); |
||||
pinMode(_LCDML_CONTROL_digital_up , INPUT_PULLUP); |
||||
pinMode(_LCDML_CONTROL_digital_down , INPUT_PULLUP); |
||||
# if(_LCDML_CONTROL_digital_enable_quit == 1) |
||||
pinMode(_LCDML_CONTROL_digital_quit , INPUT_PULLUP); |
||||
# endif |
||||
# if(_LCDML_CONTROL_digital_enable_lr == 1) |
||||
pinMode(_LCDML_CONTROL_digital_left , INPUT_PULLUP); |
||||
pinMode(_LCDML_CONTROL_digital_right , INPUT_PULLUP); |
||||
# endif |
||||
} |
||||
|
||||
#if(_LCDML_CONTROL_digital_low_active == 1) |
||||
# define _LCDML_CONTROL_digital_a ! |
||||
#else |
||||
# define _LCDML_CONTROL_digital_a |
||||
#endif |
||||
|
||||
uint8_t but_stat = 0x00; |
||||
|
||||
bitWrite(but_stat, 0, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_enter))); |
||||
bitWrite(but_stat, 1, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_up))); |
||||
bitWrite(but_stat, 2, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_down))); |
||||
#if(_LCDML_CONTROL_digital_enable_quit == 1) |
||||
bitWrite(but_stat, 3, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_quit))); |
||||
#endif |
||||
#if(_LCDML_CONTROL_digital_enable_lr == 1) |
||||
bitWrite(but_stat, 4, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_left))); |
||||
bitWrite(but_stat, 5, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_right))); |
||||
#endif |
||||
|
||||
if (but_stat > 0) { |
||||
if((millis() - g_LCDML_DISP_press_time) >= 200) { |
||||
g_LCDML_DISP_press_time = millis(); // reset press time
|
||||
|
||||
if (bitRead(but_stat, 0)) { LCDML.BT_enter(); } |
||||
if (bitRead(but_stat, 1)) { LCDML.BT_up(); } |
||||
if (bitRead(but_stat, 2)) { LCDML.BT_down(); } |
||||
if (bitRead(but_stat, 3)) { LCDML.BT_quit(); } |
||||
if (bitRead(but_stat, 4)) { LCDML.BT_left(); } |
||||
if (bitRead(but_stat, 5)) { LCDML.BT_right(); } |
||||
} |
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (3) CONTROL WITH ENCODER ****************************
|
||||
// *********************************************************************
|
||||
#elif(_LCDML_CONTROL_cfg == 3) |
||||
/*
|
||||
* Thanks to "MuchMore" (Arduino forum) to add this encoder functionality |
||||
* |
||||
* rotate left = Up |
||||
* rotate right = Down |
||||
* push = Enter |
||||
* push long = Quit |
||||
* push + rotate left = Left |
||||
* push + rotate right = Right |
||||
*/ |
||||
|
||||
/* encoder connection
|
||||
* button * (do not use an external resistor, the internal pullup resistor is used) |
||||
* .-------o Arduino Pin |
||||
* | |
||||
* | |
||||
* o / |
||||
* / |
||||
* / |
||||
* o |
||||
* | |
||||
* '-------o GND |
||||
* |
||||
* encoder * (do not use an external resistor, the internal pullup resistors are used) |
||||
* |
||||
* .---------------o Arduino Pin A |
||||
* | .------o Arduino Pin B |
||||
* | | |
||||
* o / o / |
||||
* / / |
||||
* / / |
||||
* o o |
||||
* | | |
||||
* '--------o----o GND (common pin) |
||||
*/ |
||||
|
||||
// global defines
|
||||
#define encoder_A_pin 20 // physical pin has to be 2 or 3 to use interrupts (on mega e.g. 20 or 21), use internal pullups
|
||||
#define encoder_B_pin 21 // physical pin has to be 2 or 3 to use interrupts (on mega e.g. 20 or 21), use internal pullups
|
||||
#define encoder_button_pin 49 // physical pin , use internal pullup
|
||||
|
||||
#define g_LCDML_CONTROL_button_long_press 800 // ms
|
||||
#define g_LCDML_CONTROL_button_short_press 120 // ms
|
||||
|
||||
#define ENCODER_OPTIMIZE_INTERRUPTS //Only when using pin2/3 (or 20/21 on mega)
|
||||
#include <Encoder.h> //for Encoder Download: https://github.com/PaulStoffregen/Encoder |
||||
|
||||
Encoder ENCODER(encoder_A_pin, encoder_B_pin); |
||||
|
||||
unsigned long g_LCDML_CONTROL_button_press_time = millis(); |
||||
bool g_LCDML_CONTROL_button_prev = HIGH; |
||||
|
||||
// *********************************************************************
|
||||
void lcdml_menu_control(void) |
||||
// *********************************************************************
|
||||
{ |
||||
// declare variable for this function
|
||||
int32_t g_LCDML_CONTROL_Encoder_position = ENCODER.read(); |
||||
bool g_LCDML_button = digitalRead(encoder_button_pin); |
||||
|
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) |
||||
{ |
||||
// runs only once
|
||||
|
||||
// init pins, enable pullups
|
||||
pinMode(encoder_A_pin , INPUT_PULLUP); |
||||
pinMode(encoder_B_pin , INPUT_PULLUP); |
||||
pinMode(encoder_button_pin , INPUT_PULLUP); |
||||
} |
||||
|
||||
// check if encoder is rotated on direction A
|
||||
if(g_LCDML_CONTROL_Encoder_position <= -3)
|
||||
{ |
||||
// check if the button is pressed and the encoder is rotated
|
||||
// the button is low active
|
||||
if(g_LCDML_button == LOW) |
||||
{ |
||||
// button is pressed
|
||||
LCDML.BT_left();
|
||||
|
||||
// reset button press time for next detection
|
||||
g_LCDML_CONTROL_button_prev = HIGH; |
||||
} |
||||
else |
||||
{ |
||||
LCDML.BT_down(); |
||||
}
|
||||
|
||||
// init encoder for the next step
|
||||
ENCODER.write(g_LCDML_CONTROL_Encoder_position+4); |
||||
} |
||||
|
||||
// check if encoder is rotated on direction B
|
||||
else if(g_LCDML_CONTROL_Encoder_position >= 3) |
||||
{
|
||||
// check if the button is pressed and the encoder is rotated
|
||||
// the button is low active
|
||||
if(g_LCDML_button == LOW) |
||||
{ |
||||
// button is pressed
|
||||
LCDML.BT_right();
|
||||
|
||||
// reset button press time for next detection
|
||||
g_LCDML_CONTROL_button_prev = HIGH; |
||||
} |
||||
else |
||||
{ |
||||
LCDML.BT_up(); |
||||
}
|
||||
|
||||
// init encoder for the next step
|
||||
ENCODER.write(g_LCDML_CONTROL_Encoder_position-4); |
||||
} |
||||
else |
||||
{ |
||||
// check if the button was pressed for a shortly time or a long time
|
||||
|
||||
//falling edge, button pressed, no action
|
||||
if(g_LCDML_button == LOW && g_LCDML_CONTROL_button_prev == HIGH)
|
||||
{ |
||||
g_LCDML_CONTROL_button_prev = LOW; |
||||
g_LCDML_CONTROL_button_press_time = millis(); |
||||
} |
||||
|
||||
// rising edge, button not pressed, check how long was it pressed
|
||||
else if(g_LCDML_button == HIGH && g_LCDML_CONTROL_button_prev == LOW)
|
||||
{ |
||||
g_LCDML_CONTROL_button_prev = HIGH; |
||||
|
||||
// check how long was the button pressed and detect a long press or a short press
|
||||
|
||||
// check long press situation
|
||||
if((millis() - g_LCDML_CONTROL_button_press_time) >= g_LCDML_CONTROL_button_long_press) |
||||
{ |
||||
// long press detected
|
||||
LCDML.BT_quit(); |
||||
} |
||||
// check short press situation
|
||||
else if((millis() - g_LCDML_CONTROL_button_press_time) >= g_LCDML_CONTROL_button_short_press) |
||||
{ |
||||
// short press detected
|
||||
LCDML.BT_enter(); |
||||
} |
||||
} |
||||
|
||||
// do nothing
|
||||
else
|
||||
{ |
||||
// do nothing
|
||||
} |
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (4) CONTROL WITH A KEYPAD ***************************
|
||||
// *********************************************************************
|
||||
#elif(_LCDML_CONTROL_cfg == 4) |
||||
// include
|
||||
// more information under http://playground.arduino.cc/Main/KeypadTutorial
|
||||
#include <Keypad.h> |
||||
// settings
|
||||
#define _LCDML_CONTROL_keypad_rows 4 // Four rows
|
||||
#define _LCDML_CONTROL_keypad_cols 3 // Three columns
|
||||
// global vars
|
||||
char keys[_LCDML_CONTROL_keypad_rows][_LCDML_CONTROL_keypad_cols] = { |
||||
{'1','2','3'}, |
||||
{'4','5','6'}, |
||||
{'7','8','9'}, |
||||
{'#','0','*'} |
||||
}; |
||||
byte rowPins[_LCDML_CONTROL_keypad_rows] = { 9, 8, 7, 6 }; // Connect keypad COL0, COL1 and COL2 to these Arduino pins.
|
||||
byte colPins[_LCDML_CONTROL_keypad_cols] = { 12, 11, 10 }; // Create the Keypad
|
||||
// objects
|
||||
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, _LCDML_CONTROL_keypad_rows, _LCDML_CONTROL_keypad_cols ); |
||||
// *********************************************************************
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
} |
||||
char key = kpd.getKey(); |
||||
if(key) // Check for a valid key.
|
||||
{ |
||||
switch (key) |
||||
{ |
||||
// this is the default configuration
|
||||
case '#': LCDML.BT_enter(); break; |
||||
case '2': LCDML.BT_up(); break; |
||||
case '8': LCDML.BT_down(); break; |
||||
case '4': LCDML.BT_left(); break; |
||||
case '6': LCDML.BT_right(); break; |
||||
case '*': LCDML.BT_quit(); break; |
||||
|
||||
// when you want to use all characters you have to use the CE_ functionality
|
||||
// CE stands for "custom event" and you can define 64 evetns
|
||||
// the following code is only an example
|
||||
/*
|
||||
case '1': LCDML.CE_set(2); break; |
||||
case '2': LCDML.CE_set(3); LCDML.BT_up(); break; |
||||
case '3': LCDML.CE_set(4); break;
|
||||
case '4': LCDML.CE_set(5); LCDML.BT_left(); break; |
||||
case '5': LCDML.CE_set(6); break;
|
||||
case '6': LCDML.CE_set(7); LCDML.BT_right(); break; |
||||
case '7': LCDML.CE_set(8); break;
|
||||
case '8': LCDML.CE_set(9); LCDML.BT_down(); break; |
||||
case '9': LCDML.CE_set(10); break;
|
||||
case '0': LCDML.CE_set(1); break;
|
||||
case '#': LCDML.CE_set(12); LCDML.BT_enter(); break; |
||||
case '*': LCDML.CE_set(11); LCDML.BT_quit(); break; |
||||
*/
|
||||
default: break; |
||||
} |
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (5) CONTROL WITH IR REMOTE ***************************
|
||||
// *********************************************************************
|
||||
#elif(_LCDML_CONTROL_cfg == 5) |
||||
// IR include (this lib have to be installed)
|
||||
// Download path: https://github.com/ukw100/IRMP
|
||||
#define IRMP_INPUT_PIN PA0 |
||||
#define IRMP_PROTOCOL_NAMES 1 // Enable protocol number mapping to protocol strings - needs some FLASH. Must before #include <irmp*>
|
||||
#include <irmpSelectMain15Protocols.h> // This enables 15 main protocols |
||||
|
||||
#include <irmp.c.h> |
||||
|
||||
IRMP_DATA irmp_data[1]; |
||||
|
||||
#define STR_HELPER(x) #x |
||||
#define STR(x) STR_HELPER(x) |
||||
|
||||
void handleReceivedIRData(); |
||||
|
||||
// *********************************************************************
|
||||
// change in this function the IR values to your values
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
irmp_init(); |
||||
} |
||||
|
||||
if (irmp_get_data(&irmp_data[0])) |
||||
{ |
||||
// comment this line out, to check the correct code
|
||||
//Serial.println(results.value, HEX);
|
||||
|
||||
// in this switch case you have to change the value 0x...1 to the correct IR code
|
||||
switch (irmp_data[0].command) |
||||
{ |
||||
case 0x52: LCDML.BT_enter(); break; |
||||
case 0x50: LCDML.BT_up(); break; |
||||
case 0x51: LCDML.BT_down(); break; |
||||
case 0x55: LCDML.BT_left(); break; |
||||
case 0x56: LCDML.BT_right(); break; |
||||
case 0x23: LCDML.BT_quit(); break; |
||||
default: break; |
||||
} |
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (6) CONTROL OVER JOYSTICK ***************************
|
||||
// *********************************************************************
|
||||
#elif(_LCDML_CONTROL_cfg == 6) |
||||
unsigned long g_LCDML_DISP_press_time = 0; |
||||
// settings
|
||||
#define _LCDML_CONTROL_analog_pinx A0 |
||||
#define _LCDML_CONTROL_analog_piny A1 |
||||
#define _LCDML_CONTROL_digitalread 33 //don't work with u8glib
|
||||
|
||||
// when you did not use a button set the value to zero
|
||||
#define _LCDML_CONTROL_analog_up_min 612 // Button Up
|
||||
#define _LCDML_CONTROL_analog_up_max 1023 |
||||
#define _LCDML_CONTROL_analog_down_min 0 // Button Down
|
||||
#define _LCDML_CONTROL_analog_down_max 412 |
||||
#define _LCDML_CONTROL_analog_left_min 612 // Button Left
|
||||
#define _LCDML_CONTROL_analog_left_max 1023 |
||||
#define _LCDML_CONTROL_analog_right_min 0 // Button Right
|
||||
#define _LCDML_CONTROL_analog_right_max 412 |
||||
// *********************************************************************
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
pinMode (_LCDML_CONTROL_digitalread, INPUT); |
||||
} |
||||
// check debounce timer
|
||||
if((millis() - g_LCDML_DISP_press_time) >= 200) { |
||||
g_LCDML_DISP_press_time = millis(); // reset debounce timer
|
||||
|
||||
uint16_t valuex = analogRead(_LCDML_CONTROL_analog_pinx); // analogpinx
|
||||
uint16_t valuey = analogRead(_LCDML_CONTROL_analog_piny); // analogpinx
|
||||
uint16_t valuee = digitalRead(_LCDML_CONTROL_digitalread); //digitalpinenter
|
||||
|
||||
|
||||
if (valuey >= _LCDML_CONTROL_analog_up_min && valuey <= _LCDML_CONTROL_analog_up_max) { LCDML.BT_up(); } // up
|
||||
if (valuey >= _LCDML_CONTROL_analog_down_min && valuey <= _LCDML_CONTROL_analog_down_max) { LCDML.BT_down(); } // down
|
||||
if (valuex >= _LCDML_CONTROL_analog_left_min && valuex <= _LCDML_CONTROL_analog_left_max) { LCDML.BT_left(); } // left
|
||||
if (valuex >= _LCDML_CONTROL_analog_right_min && valuex <= _LCDML_CONTROL_analog_right_max) { LCDML.BT_right(); } // right
|
||||
|
||||
if(valuee == true) {LCDML.BT_enter();} // enter
|
||||
|
||||
// back buttons have to be included as menu item
|
||||
// lock at the example LCDML_back_button
|
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (7) CONTROL OVER PCF8574 ****************************
|
||||
// *********************************************************************
|
||||
|
||||
#elif(_LCDML_CONTROL_cfg == 7) |
||||
unsigned long g_LCDML_DISP_press_time = 0; |
||||
#define PCF8574_1 0x26 // I2C address for the buttons
|
||||
|
||||
#define PCF8574_Pin0 254 |
||||
#define PCF8574_Pin1 253 |
||||
#define PCF8574_Pin2 251 |
||||
#define PCF8574_Pin3 247 |
||||
#define PCF8574_Pin4 239 |
||||
#define PCF8574_Pin5 223 |
||||
#define PCF8574_Pin6 191 |
||||
#define PCF8574_Pin7 127 |
||||
|
||||
// Specify the PCF8574 pins here
|
||||
#define _LCDML_CONTROL_PCF8574_enable_quit 0 |
||||
#define _LCDML_CONTROL_PCF8574_enable_lr 0 |
||||
|
||||
#define _LCDML_CONTROL_PCF8574_enter PCF8574_Pin0 |
||||
#define _LCDML_CONTROL_PCF8574_up PCF8574_Pin1 |
||||
#define _LCDML_CONTROL_PCF8574_down PCF8574_Pin2 |
||||
#define _LCDML_CONTROL_PCF8574_left PCF8574_Pin3 |
||||
#define _LCDML_CONTROL_PCF8574_right PCF8574_Pin4 |
||||
#define _LCDML_CONTROL_PCF8574_quit PCF8574_Pin5 |
||||
// **********************************************************
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
} |
||||
|
||||
if((millis() - g_LCDML_DISP_press_time) >= 200) { |
||||
g_LCDML_DISP_press_time = millis(); // reset press time
|
||||
|
||||
Wire.write(0xff); // All pins as input?
|
||||
Wire.requestFrom(PCF8574_1, 1); |
||||
if (Wire.available()) { |
||||
switch (Wire.read()) |
||||
{ |
||||
case _LCDML_CONTROL_PCF8574_enter: LCDML.BT_enter(); break; |
||||
case _LCDML_CONTROL_PCF8574_up: LCDML.BT_up(); break; |
||||
case _LCDML_CONTROL_PCF8574_down: LCDML.BT_down(); break; |
||||
#if(_LCDML_CONTROL_PCF8574_enable_quit == 1) |
||||
case _LCDML_CONTROL_PCF8574_quit: LCDML.BT_quit(); break; |
||||
#endif |
||||
|
||||
#if(_LCDML_CONTROL_PCF8574_enable_lr == 1) |
||||
case _LCDML_CONTROL_PCF8574_left: LCDML.BT_left(); break; |
||||
case _LCDML_CONTROL_PCF8574_right: LCDML.BT_right(); break; |
||||
#endif |
||||
|
||||
default: break; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
#else |
||||
#error _LCDML_CONTROL_cfg is not defined or not in range |
||||
#endif |
@ -1,647 +0,0 @@ |
||||
// =====================================================================
|
||||
//
|
||||
// CONTROL v2.2.0
|
||||
//
|
||||
// =====================================================================
|
||||
// *********************************************************************
|
||||
// Features
|
||||
// - max 6 Buttons with special names (enter, quit, up, down, left, right)
|
||||
// new Features on v2.2.0
|
||||
// - max 64 Events, this could be a button ore something (Counter 0 - 63)
|
||||
// - standard buttons and events can be used at the same time
|
||||
// - Event 0 - 3 can be used with a menu callback function (when set this event, the function is called)
|
||||
// - The range from 0 - 3 can be changed in LCDMenuLib2.h
|
||||
// Attention!!
|
||||
// - events have to be reset manual over LCDML.CE_reset(number) ore LCDML.CE_resetAll();
|
||||
// - they will not be reseted from the menu library
|
||||
// *********************************************************************
|
||||
// content:
|
||||
// (0) Control over serial interface with asdw_e_q
|
||||
// (1) Control over one analog input
|
||||
// (2) Control over 4 - 6 digital input pins (internal pullups enabled)
|
||||
// (3) Control over encoder [third party lib] (Download: https://github.com/PaulStoffregen/Encoder)
|
||||
// (4) Control with Keypad [third party lib] (Download: http://playground.arduino.cc/Main/KeypadTutorial )
|
||||
// (5) Control with an IRMP remote [third party lib] (Download: https://github.com/ukw100/IRMP )
|
||||
// (6) Control with a joystick
|
||||
// (7) Control over I2C PCF8574
|
||||
// *********************************************************************
|
||||
|
||||
#define _LCDML_CONTROL_cfg 0 |
||||
|
||||
// theory:
|
||||
// "#if" is a preprocessor directive and no error, look here:
|
||||
// (English) https://en.wikipedia.org/wiki/C_preprocessor
|
||||
// (German) https://de.wikipedia.org/wiki/C-Pr%C3%A4prozessor
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (0) CONTROL OVER SERIAL INTERFACE *******************
|
||||
// *********************************************************************
|
||||
#if(_LCDML_CONTROL_cfg == 0) |
||||
// settings
|
||||
# define _LCDML_CONTROL_serial_enter 'e' |
||||
# define _LCDML_CONTROL_serial_up 'w' |
||||
# define _LCDML_CONTROL_serial_down 's' |
||||
# define _LCDML_CONTROL_serial_left 'a' |
||||
# define _LCDML_CONTROL_serial_right 'd' |
||||
# define _LCDML_CONTROL_serial_quit 'q' |
||||
|
||||
// example for the useage of events (not needed everywhere)
|
||||
// this defines are only for examples and can be renamed
|
||||
# define _LCDML_EVENT_command 'c' |
||||
# define _LCDML_EVENT_char_0 '0' |
||||
# define _LCDML_EVENT_char_1 '1' |
||||
# define _LCDML_EVENT_char_2 '2' |
||||
# define _LCDML_EVENT_char_3 '3' |
||||
# define _LCDML_EVENT_char_4 '4' |
||||
# define _LCDML_EVENT_char_5 '5' |
||||
# define _LCDML_EVENT_char_6 '6' |
||||
# define _LCDML_EVENT_char_7 '7' |
||||
# define _LCDML_EVENT_char_8 '8' |
||||
# define _LCDML_EVENT_char_9 '9' |
||||
// *********************************************************************
|
||||
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
} |
||||
|
||||
if(LCDML.CE_setup()) { |
||||
// runs only once
|
||||
Serial.println("CE_setup()"); |
||||
} |
||||
|
||||
// check if new serial input is available
|
||||
if (Serial.available()) { |
||||
// read one char from input buffer
|
||||
switch (Serial.read()) |
||||
{ |
||||
case _LCDML_CONTROL_serial_enter: LCDML.BT_enter(); break; |
||||
case _LCDML_CONTROL_serial_up: LCDML.BT_up(); break; |
||||
case _LCDML_CONTROL_serial_down: LCDML.BT_down(); break; |
||||
case _LCDML_CONTROL_serial_left: LCDML.BT_left(); break; |
||||
case _LCDML_CONTROL_serial_right: LCDML.BT_right(); break; |
||||
case _LCDML_CONTROL_serial_quit: LCDML.BT_quit(); break; |
||||
// example for event handling
|
||||
// custom event handling
|
||||
// is is also possible to enable more the one event on the same time
|
||||
// but when more then one events with callback functions are active
|
||||
// only the first callback function is called. (first = by number)
|
||||
case _LCDML_EVENT_command: LCDML.CE_set(0); break; |
||||
case _LCDML_EVENT_char_0: LCDML.CE_set(1); break; |
||||
case _LCDML_EVENT_char_1: LCDML.CE_set(2); break; |
||||
case _LCDML_EVENT_char_2: LCDML.CE_set(3); break; |
||||
case _LCDML_EVENT_char_3: LCDML.CE_set(4); break; |
||||
case _LCDML_EVENT_char_4: LCDML.CE_set(5); break; |
||||
case _LCDML_EVENT_char_5: LCDML.CE_set(6); break; |
||||
case _LCDML_EVENT_char_6: LCDML.CE_set(7); break; |
||||
case _LCDML_EVENT_char_7: LCDML.CE_set(8); break; |
||||
case _LCDML_EVENT_char_8: LCDML.CE_set(9); break; |
||||
case _LCDML_EVENT_char_9: LCDML.CE_set(10); break; |
||||
default: break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (1) CONTROL OVER ONE ANALOG PIN *********************
|
||||
// *********************************************************************
|
||||
#elif(_LCDML_CONTROL_cfg == 1) |
||||
|
||||
unsigned long g_LCDML_DISP_press_time = 0; |
||||
// settings
|
||||
#define _LCDML_CONTROL_analog_pin 0 |
||||
// when you did not use a button set the value to zero
|
||||
#define _LCDML_CONTROL_analog_enter_min 850 // Button Enter
|
||||
#define _LCDML_CONTROL_analog_enter_max 920 |
||||
#define _LCDML_CONTROL_analog_up_min 520 // Button Up
|
||||
#define _LCDML_CONTROL_analog_up_max 590 |
||||
#define _LCDML_CONTROL_analog_down_min 700 // Button Down
|
||||
#define _LCDML_CONTROL_analog_down_max 770 |
||||
#define _LCDML_CONTROL_analog_back_min 950 // Button Back
|
||||
#define _LCDML_CONTROL_analog_back_max 1020 |
||||
#define _LCDML_CONTROL_analog_left_min 430 // Button Left
|
||||
#define _LCDML_CONTROL_analog_left_max 500 |
||||
#define _LCDML_CONTROL_analog_right_min 610 // Button Right
|
||||
#define _LCDML_CONTROL_analog_right_max 680 |
||||
// *********************************************************************
|
||||
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
} |
||||
// check debounce timer
|
||||
if((millis() - g_LCDML_DISP_press_time) >= 200) { |
||||
g_LCDML_DISP_press_time = millis(); // reset debounce timer
|
||||
|
||||
uint16_t value = analogRead(_LCDML_CONTROL_analog_pin); // analog pin for keypad
|
||||
|
||||
if (value >= _LCDML_CONTROL_analog_enter_min && value <= _LCDML_CONTROL_analog_enter_max) { LCDML.BT_enter(); } |
||||
if (value >= _LCDML_CONTROL_analog_up_min && value <= _LCDML_CONTROL_analog_up_max) { LCDML.BT_up(); } |
||||
if (value >= _LCDML_CONTROL_analog_down_min && value <= _LCDML_CONTROL_analog_down_max) { LCDML.BT_down(); } |
||||
if (value >= _LCDML_CONTROL_analog_left_min && value <= _LCDML_CONTROL_analog_left_max) { LCDML.BT_left(); } |
||||
if (value >= _LCDML_CONTROL_analog_right_min && value <= _LCDML_CONTROL_analog_right_max) { LCDML.BT_right(); } |
||||
if (value >= _LCDML_CONTROL_analog_back_min && value <= _LCDML_CONTROL_analog_back_max) { LCDML.BT_quit(); } |
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (2) CONTROL OVER DIGITAL PINS ***********************
|
||||
// *********************************************************************
|
||||
#elif(_LCDML_CONTROL_cfg == 2) |
||||
// settings
|
||||
unsigned long g_LCDML_DISP_press_time = 0; |
||||
|
||||
#define _LCDML_CONTROL_digital_low_active 0 // 0 = high active (pulldown) button, 1 = low active (pullup)
|
||||
// http://playground.arduino.cc/CommonTopics/PullUpDownResistor
|
||||
#define _LCDML_CONTROL_digital_enable_quit 1 |
||||
#define _LCDML_CONTROL_digital_enable_lr 1 |
||||
#define _LCDML_CONTROL_digital_enter 8 |
||||
#define _LCDML_CONTROL_digital_up 9 |
||||
#define _LCDML_CONTROL_digital_down 10 |
||||
#define _LCDML_CONTROL_digital_quit 11 |
||||
#define _LCDML_CONTROL_digital_left 12 |
||||
#define _LCDML_CONTROL_digital_right 13 |
||||
// *********************************************************************
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
// init buttons
|
||||
pinMode(_LCDML_CONTROL_digital_enter , INPUT_PULLUP); |
||||
pinMode(_LCDML_CONTROL_digital_up , INPUT_PULLUP); |
||||
pinMode(_LCDML_CONTROL_digital_down , INPUT_PULLUP); |
||||
# if(_LCDML_CONTROL_digital_enable_quit == 1) |
||||
pinMode(_LCDML_CONTROL_digital_quit , INPUT_PULLUP); |
||||
# endif |
||||
# if(_LCDML_CONTROL_digital_enable_lr == 1) |
||||
pinMode(_LCDML_CONTROL_digital_left , INPUT_PULLUP); |
||||
pinMode(_LCDML_CONTROL_digital_right , INPUT_PULLUP); |
||||
# endif |
||||
} |
||||
|
||||
#if(_LCDML_CONTROL_digital_low_active == 1) |
||||
# define _LCDML_CONTROL_digital_a ! |
||||
#else |
||||
# define _LCDML_CONTROL_digital_a |
||||
#endif |
||||
|
||||
uint8_t but_stat = 0x00; |
||||
|
||||
bitWrite(but_stat, 0, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_enter))); |
||||
bitWrite(but_stat, 1, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_up))); |
||||
bitWrite(but_stat, 2, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_down))); |
||||
#if(_LCDML_CONTROL_digital_enable_quit == 1) |
||||
bitWrite(but_stat, 3, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_quit))); |
||||
#endif |
||||
#if(_LCDML_CONTROL_digital_enable_lr == 1) |
||||
bitWrite(but_stat, 4, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_left))); |
||||
bitWrite(but_stat, 5, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_right))); |
||||
#endif |
||||
|
||||
if (but_stat > 0) { |
||||
if((millis() - g_LCDML_DISP_press_time) >= 200) { |
||||
g_LCDML_DISP_press_time = millis(); // reset press time
|
||||
|
||||
if (bitRead(but_stat, 0)) { LCDML.BT_enter(); } |
||||
if (bitRead(but_stat, 1)) { LCDML.BT_up(); } |
||||
if (bitRead(but_stat, 2)) { LCDML.BT_down(); } |
||||
if (bitRead(but_stat, 3)) { LCDML.BT_quit(); } |
||||
if (bitRead(but_stat, 4)) { LCDML.BT_left(); } |
||||
if (bitRead(but_stat, 5)) { LCDML.BT_right(); } |
||||
} |
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (3) CONTROL WITH ENCODER ****************************
|
||||
// *********************************************************************
|
||||
#elif(_LCDML_CONTROL_cfg == 3) |
||||
/*
|
||||
* Thanks to "MuchMore" (Arduino forum) to add this encoder functionality |
||||
* |
||||
* rotate left = Up |
||||
* rotate right = Down |
||||
* push = Enter |
||||
* push long = Quit |
||||
* push + rotate left = Left |
||||
* push + rotate right = Right |
||||
*/ |
||||
|
||||
/* encoder connection
|
||||
* button * (do not use an external resistor, the internal pullup resistor is used) |
||||
* .-------o Arduino Pin |
||||
* | |
||||
* | |
||||
* o / |
||||
* / |
||||
* / |
||||
* o |
||||
* | |
||||
* '-------o GND |
||||
* |
||||
* encoder * (do not use an external resistor, the internal pullup resistors are used) |
||||
* |
||||
* .---------------o Arduino Pin A |
||||
* | .------o Arduino Pin B |
||||
* | | |
||||
* o / o / |
||||
* / / |
||||
* / / |
||||
* o o |
||||
* | | |
||||
* '--------o----o GND (common pin) |
||||
*/ |
||||
|
||||
// global defines
|
||||
#define encoder_A_pin 20 // physical pin has to be 2 or 3 to use interrupts (on mega e.g. 20 or 21), use internal pullups
|
||||
#define encoder_B_pin 21 // physical pin has to be 2 or 3 to use interrupts (on mega e.g. 20 or 21), use internal pullups
|
||||
#define encoder_button_pin 49 // physical pin , use internal pullup
|
||||
|
||||
#define g_LCDML_CONTROL_button_long_press 800 // ms
|
||||
#define g_LCDML_CONTROL_button_short_press 120 // ms
|
||||
|
||||
#define ENCODER_OPTIMIZE_INTERRUPTS //Only when using pin2/3 (or 20/21 on mega)
|
||||
#include <Encoder.h> //for Encoder Download: https://github.com/PaulStoffregen/Encoder |
||||
|
||||
Encoder ENCODER(encoder_A_pin, encoder_B_pin); |
||||
|
||||
unsigned long g_LCDML_CONTROL_button_press_time = millis(); |
||||
bool g_LCDML_CONTROL_button_prev = HIGH; |
||||
|
||||
// *********************************************************************
|
||||
void lcdml_menu_control(void) |
||||
// *********************************************************************
|
||||
{ |
||||
// declare variable for this function
|
||||
int32_t g_LCDML_CONTROL_Encoder_position = ENCODER.read(); |
||||
bool g_LCDML_button = digitalRead(encoder_button_pin); |
||||
|
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) |
||||
{ |
||||
// runs only once
|
||||
|
||||
// init pins, enable pullups
|
||||
pinMode(encoder_A_pin , INPUT_PULLUP); |
||||
pinMode(encoder_B_pin , INPUT_PULLUP); |
||||
pinMode(encoder_button_pin , INPUT_PULLUP); |
||||
} |
||||
|
||||
// check if encoder is rotated on direction A
|
||||
if(g_LCDML_CONTROL_Encoder_position <= -3)
|
||||
{ |
||||
// check if the button is pressed and the encoder is rotated
|
||||
// the button is low active
|
||||
if(g_LCDML_button == LOW) |
||||
{ |
||||
// button is pressed
|
||||
LCDML.BT_left();
|
||||
|
||||
// reset button press time for next detection
|
||||
g_LCDML_CONTROL_button_prev = HIGH; |
||||
} |
||||
else |
||||
{ |
||||
LCDML.BT_down(); |
||||
}
|
||||
|
||||
// init encoder for the next step
|
||||
ENCODER.write(g_LCDML_CONTROL_Encoder_position+4); |
||||
} |
||||
|
||||
// check if encoder is rotated on direction B
|
||||
else if(g_LCDML_CONTROL_Encoder_position >= 3) |
||||
{
|
||||
// check if the button is pressed and the encoder is rotated
|
||||
// the button is low active
|
||||
if(g_LCDML_button == LOW) |
||||
{ |
||||
// button is pressed
|
||||
LCDML.BT_right();
|
||||
|
||||
// reset button press time for next detection
|
||||
g_LCDML_CONTROL_button_prev = HIGH; |
||||
} |
||||
else |
||||
{ |
||||
LCDML.BT_up(); |
||||
}
|
||||
|
||||
// init encoder for the next step
|
||||
ENCODER.write(g_LCDML_CONTROL_Encoder_position-4); |
||||
} |
||||
else |
||||
{ |
||||
// check if the button was pressed for a shortly time or a long time
|
||||
|
||||
//falling edge, button pressed, no action
|
||||
if(g_LCDML_button == LOW && g_LCDML_CONTROL_button_prev == HIGH)
|
||||
{ |
||||
g_LCDML_CONTROL_button_prev = LOW; |
||||
g_LCDML_CONTROL_button_press_time = millis(); |
||||
} |
||||
|
||||
// rising edge, button not pressed, check how long was it pressed
|
||||
else if(g_LCDML_button == HIGH && g_LCDML_CONTROL_button_prev == LOW)
|
||||
{ |
||||
g_LCDML_CONTROL_button_prev = HIGH; |
||||
|
||||
// check how long was the button pressed and detect a long press or a short press
|
||||
|
||||
// check long press situation
|
||||
if((millis() - g_LCDML_CONTROL_button_press_time) >= g_LCDML_CONTROL_button_long_press) |
||||
{ |
||||
// long press detected
|
||||
LCDML.BT_quit(); |
||||
} |
||||
// check short press situation
|
||||
else if((millis() - g_LCDML_CONTROL_button_press_time) >= g_LCDML_CONTROL_button_short_press) |
||||
{ |
||||
// short press detected
|
||||
LCDML.BT_enter(); |
||||
} |
||||
} |
||||
|
||||
// do nothing
|
||||
else
|
||||
{ |
||||
// do nothing
|
||||
} |
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (4) CONTROL WITH A KEYPAD ***************************
|
||||
// *********************************************************************
|
||||
#elif(_LCDML_CONTROL_cfg == 4) |
||||
// include
|
||||
// more information under http://playground.arduino.cc/Main/KeypadTutorial
|
||||
#include <Keypad.h> |
||||
// settings
|
||||
#define _LCDML_CONTROL_keypad_rows 4 // Four rows
|
||||
#define _LCDML_CONTROL_keypad_cols 3 // Three columns
|
||||
// global vars
|
||||
char keys[_LCDML_CONTROL_keypad_rows][_LCDML_CONTROL_keypad_cols] = { |
||||
{'1','2','3'}, |
||||
{'4','5','6'}, |
||||
{'7','8','9'}, |
||||
{'#','0','*'} |
||||
}; |
||||
byte rowPins[_LCDML_CONTROL_keypad_rows] = { 9, 8, 7, 6 }; // Connect keypad COL0, COL1 and COL2 to these Arduino pins.
|
||||
byte colPins[_LCDML_CONTROL_keypad_cols] = { 12, 11, 10 }; // Create the Keypad
|
||||
// objects
|
||||
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, _LCDML_CONTROL_keypad_rows, _LCDML_CONTROL_keypad_cols ); |
||||
// *********************************************************************
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
} |
||||
char key = kpd.getKey(); |
||||
if(key) // Check for a valid key.
|
||||
{ |
||||
switch (key) |
||||
{ |
||||
// this is the default configuration
|
||||
case '#': LCDML.BT_enter(); break; |
||||
case '2': LCDML.BT_up(); break; |
||||
case '8': LCDML.BT_down(); break; |
||||
case '4': LCDML.BT_left(); break; |
||||
case '6': LCDML.BT_right(); break; |
||||
case '*': LCDML.BT_quit(); break; |
||||
|
||||
// when you want to use all characters you have to use the CE_ functionality
|
||||
// CE stands for "custom event" and you can define 64 evetns
|
||||
// the following code is only an example
|
||||
/*
|
||||
case '1': LCDML.CE_set(2); break; |
||||
case '2': LCDML.CE_set(3); LCDML.BT_up(); break; |
||||
case '3': LCDML.CE_set(4); break;
|
||||
case '4': LCDML.CE_set(5); LCDML.BT_left(); break; |
||||
case '5': LCDML.CE_set(6); break;
|
||||
case '6': LCDML.CE_set(7); LCDML.BT_right(); break; |
||||
case '7': LCDML.CE_set(8); break;
|
||||
case '8': LCDML.CE_set(9); LCDML.BT_down(); break; |
||||
case '9': LCDML.CE_set(10); break;
|
||||
case '0': LCDML.CE_set(1); break;
|
||||
case '#': LCDML.CE_set(12); LCDML.BT_enter(); break; |
||||
case '*': LCDML.CE_set(11); LCDML.BT_quit(); break; |
||||
*/
|
||||
default: break; |
||||
} |
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (5) CONTROL WITH IR REMOTE ***************************
|
||||
// *********************************************************************
|
||||
#elif(_LCDML_CONTROL_cfg == 5) |
||||
// IR include (this lib have to be installed)
|
||||
// Download path: https://github.com/ukw100/IRMP
|
||||
#define IRMP_INPUT_PIN PA0 |
||||
#define IRMP_PROTOCOL_NAMES 1 // Enable protocol number mapping to protocol strings - needs some FLASH. Must before #include <irmp*>
|
||||
#include <irmpSelectMain15Protocols.h> // This enables 15 main protocols |
||||
|
||||
#include <irmp.c.h> |
||||
|
||||
IRMP_DATA irmp_data[1]; |
||||
|
||||
#define STR_HELPER(x) #x |
||||
#define STR(x) STR_HELPER(x) |
||||
|
||||
void handleReceivedIRData(); |
||||
|
||||
// *********************************************************************
|
||||
// change in this function the IR values to your values
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
irmp_init(); |
||||
} |
||||
|
||||
if (irmp_get_data(&irmp_data[0])) |
||||
{ |
||||
// comment this line out, to check the correct code
|
||||
//Serial.println(results.value, HEX);
|
||||
|
||||
// in this switch case you have to change the value 0x...1 to the correct IR code
|
||||
switch (irmp_data[0].command) |
||||
{ |
||||
case 0x52: LCDML.BT_enter(); break; |
||||
case 0x50: LCDML.BT_up(); break; |
||||
case 0x51: LCDML.BT_down(); break; |
||||
case 0x55: LCDML.BT_left(); break; |
||||
case 0x56: LCDML.BT_right(); break; |
||||
case 0x23: LCDML.BT_quit(); break; |
||||
default: break; |
||||
} |
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (6) CONTROL OVER JOYSTICK ***************************
|
||||
// *********************************************************************
|
||||
#elif(_LCDML_CONTROL_cfg == 6) |
||||
unsigned long g_LCDML_DISP_press_time = 0; |
||||
// settings
|
||||
#define _LCDML_CONTROL_analog_pinx A0 |
||||
#define _LCDML_CONTROL_analog_piny A1 |
||||
#define _LCDML_CONTROL_digitalread 33 //don't work with u8glib
|
||||
|
||||
// when you did not use a button set the value to zero
|
||||
#define _LCDML_CONTROL_analog_up_min 612 // Button Up
|
||||
#define _LCDML_CONTROL_analog_up_max 1023 |
||||
#define _LCDML_CONTROL_analog_down_min 0 // Button Down
|
||||
#define _LCDML_CONTROL_analog_down_max 412 |
||||
#define _LCDML_CONTROL_analog_left_min 612 // Button Left
|
||||
#define _LCDML_CONTROL_analog_left_max 1023 |
||||
#define _LCDML_CONTROL_analog_right_min 0 // Button Right
|
||||
#define _LCDML_CONTROL_analog_right_max 412 |
||||
// *********************************************************************
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
pinMode (_LCDML_CONTROL_digitalread, INPUT); |
||||
} |
||||
// check debounce timer
|
||||
if((millis() - g_LCDML_DISP_press_time) >= 200) { |
||||
g_LCDML_DISP_press_time = millis(); // reset debounce timer
|
||||
|
||||
uint16_t valuex = analogRead(_LCDML_CONTROL_analog_pinx); // analogpinx
|
||||
uint16_t valuey = analogRead(_LCDML_CONTROL_analog_piny); // analogpinx
|
||||
uint16_t valuee = digitalRead(_LCDML_CONTROL_digitalread); //digitalpinenter
|
||||
|
||||
|
||||
if (valuey >= _LCDML_CONTROL_analog_up_min && valuey <= _LCDML_CONTROL_analog_up_max) { LCDML.BT_up(); } // up
|
||||
if (valuey >= _LCDML_CONTROL_analog_down_min && valuey <= _LCDML_CONTROL_analog_down_max) { LCDML.BT_down(); } // down
|
||||
if (valuex >= _LCDML_CONTROL_analog_left_min && valuex <= _LCDML_CONTROL_analog_left_max) { LCDML.BT_left(); } // left
|
||||
if (valuex >= _LCDML_CONTROL_analog_right_min && valuex <= _LCDML_CONTROL_analog_right_max) { LCDML.BT_right(); } // right
|
||||
|
||||
if(valuee == true) {LCDML.BT_enter();} // enter
|
||||
|
||||
// back buttons have to be included as menu item
|
||||
// lock at the example LCDML_back_button
|
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
// *********************************************************************
|
||||
// *************** (7) CONTROL OVER PCF8574 ****************************
|
||||
// *********************************************************************
|
||||
|
||||
#elif(_LCDML_CONTROL_cfg == 7) |
||||
unsigned long g_LCDML_DISP_press_time = 0; |
||||
#define PCF8574_1 0x26 // I2C address for the buttons
|
||||
|
||||
#define PCF8574_Pin0 254 |
||||
#define PCF8574_Pin1 253 |
||||
#define PCF8574_Pin2 251 |
||||
#define PCF8574_Pin3 247 |
||||
#define PCF8574_Pin4 239 |
||||
#define PCF8574_Pin5 223 |
||||
#define PCF8574_Pin6 191 |
||||
#define PCF8574_Pin7 127 |
||||
|
||||
// Specify the PCF8574 pins here
|
||||
#define _LCDML_CONTROL_PCF8574_enable_quit 0 |
||||
#define _LCDML_CONTROL_PCF8574_enable_lr 0 |
||||
|
||||
#define _LCDML_CONTROL_PCF8574_enter PCF8574_Pin0 |
||||
#define _LCDML_CONTROL_PCF8574_up PCF8574_Pin1 |
||||
#define _LCDML_CONTROL_PCF8574_down PCF8574_Pin2 |
||||
#define _LCDML_CONTROL_PCF8574_left PCF8574_Pin3 |
||||
#define _LCDML_CONTROL_PCF8574_right PCF8574_Pin4 |
||||
#define _LCDML_CONTROL_PCF8574_quit PCF8574_Pin5 |
||||
// **********************************************************
|
||||
void lcdml_menu_control(void) |
||||
{ |
||||
// If something must init, put in in the setup condition
|
||||
if(LCDML.BT_setup()) { |
||||
// runs only once
|
||||
} |
||||
|
||||
if((millis() - g_LCDML_DISP_press_time) >= 200) { |
||||
g_LCDML_DISP_press_time = millis(); // reset press time
|
||||
|
||||
Wire.write(0xff); // All pins as input?
|
||||
Wire.requestFrom(PCF8574_1, 1); |
||||
if (Wire.available()) { |
||||
switch (Wire.read()) |
||||
{ |
||||
case _LCDML_CONTROL_PCF8574_enter: LCDML.BT_enter(); break; |
||||
case _LCDML_CONTROL_PCF8574_up: LCDML.BT_up(); break; |
||||
case _LCDML_CONTROL_PCF8574_down: LCDML.BT_down(); break; |
||||
#if(_LCDML_CONTROL_PCF8574_enable_quit == 1) |
||||
case _LCDML_CONTROL_PCF8574_quit: LCDML.BT_quit(); break; |
||||
#endif |
||||
|
||||
#if(_LCDML_CONTROL_PCF8574_enable_lr == 1) |
||||
case _LCDML_CONTROL_PCF8574_left: LCDML.BT_left(); break; |
||||
case _LCDML_CONTROL_PCF8574_right: LCDML.BT_right(); break; |
||||
#endif |
||||
|
||||
default: break; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
// *********************************************************************
|
||||
// ******************************* END *********************************
|
||||
// *********************************************************************
|
||||
|
||||
|
||||
#else |
||||
#error _LCDML_CONTROL_cfg is not defined or not in range |
||||
#endif |
@ -1 +0,0 @@ |
||||
Subproject commit 4bdf02125cfbe27a3489d0157317270073d152f0 |
Loading…
Reference in new issue