From d383f2bcdb6ff13cc562fce1ff55d826035debad Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Mon, 6 Mar 2023 17:36:31 +0100 Subject: Simplify source tree Now just use make in the root directory to build. --- AT91SAM7S256/Source/c_button.c | 134 ----------------------------------------- 1 file changed, 134 deletions(-) delete mode 100644 AT91SAM7S256/Source/c_button.c (limited to 'AT91SAM7S256/Source/c_button.c') diff --git a/AT91SAM7S256/Source/c_button.c b/AT91SAM7S256/Source/c_button.c deleted file mode 100644 index 3145d8f..0000000 --- a/AT91SAM7S256/Source/c_button.c +++ /dev/null @@ -1,134 +0,0 @@ -// -// Date init 14.12.2004 -// -// Revision date $Date:: 14-11-07 12:40 $ -// -// Filename $Workfile:: c_button.c $ -// -// Version $Revision:: 1 $ -// -// Archive $Archive:: /LMS2006/Sys01/Main_V02/Firmware/Source/c_butt $ -// -// Platform C -// - -#include "stdconst.h" -#include "modules.h" -#include "c_button.h" -#include "c_button.iom" -#include "c_button.h" -#include "d_button.h" - -#define BTN_PRESCALER 2 - -enum -{ - LONG_TIME = (2000/BTN_PRESCALER) -}; - -static IOMAPBUTTON IOMapButton; -static VARSBUTTON VarsButton; -static UBYTE BtnCnt; - -const HEADER cButton = -{ - 0x00040001L, - "Button", - cButtonInit, - cButtonCtrl, - cButtonExit, - (void *)&IOMapButton, - (void *)&VarsButton, - (UWORD)sizeof(IOMapButton), - (UWORD)sizeof(VarsButton), - 0x0000 //Code size - not used so far -}; - - -void cButtonInit(void* pHeader) -{ - UBYTE Tmp; - - for (Tmp = 0; Tmp < NO_OF_BTNS; Tmp++) - { - IOMapButton.State[Tmp] = 0; - IOMapButton.BtnCnt[Tmp].PressedCnt = 0; - IOMapButton.BtnCnt[Tmp].LongPressCnt = 0; - IOMapButton.BtnCnt[Tmp].ShortRelCnt = 0; - IOMapButton.BtnCnt[Tmp].LongRelCnt = 0; - VarsButton.Cnt[Tmp] = 0; - } - VarsButton.OldState = 0; - BtnCnt = 0; - dButtonInit(BTN_PRESCALER); -} - -void cButtonCtrl(void) -{ - UBYTE ButtonState, Tmp, ButtonNo; - - for (Tmp = 0; Tmp < NO_OF_BTNS; Tmp++) - { - IOMapButton.State[Tmp] &= ~PRESSED_EV; - } - if (++BtnCnt >= BTN_PRESCALER) - { - BtnCnt = 0; - dButtonRead(&ButtonState); - - ButtonNo = 0x01; - for (Tmp = 0; Tmp < NO_OF_BTNS; Tmp++) - { - if (ButtonState & ButtonNo) - { - if (LONG_TIME >= (VarsButton.Cnt[Tmp])) - { - (VarsButton.Cnt[Tmp])++; - } - IOMapButton.State[Tmp] = PRESSED_STATE; - if (!((VarsButton.OldState) & ButtonNo)) - { - - /* Button just pressed */ - (IOMapButton.State[Tmp]) |= PRESSED_EV; - (IOMapButton.BtnCnt[Tmp].PressedCnt)++; - VarsButton.Cnt[Tmp] = 0; - } - else - { - if (LONG_TIME == VarsButton.Cnt[Tmp]) - { - IOMapButton.State[Tmp] |= LONG_PRESSED_EV; - (IOMapButton.BtnCnt[Tmp].LongPressCnt)++; - } - } - } - else - { - IOMapButton.State[Tmp] = 0x00; - if ((VarsButton.OldState) & ButtonNo) - { - if (VarsButton.Cnt[Tmp] > LONG_TIME) - { - IOMapButton.State[Tmp] = LONG_RELEASED_EV; - (IOMapButton.BtnCnt[Tmp].LongRelCnt)++; - - } - else - { - IOMapButton.State[Tmp] = SHORT_RELEASED_EV; - (IOMapButton.BtnCnt[Tmp].ShortRelCnt)++; - } - } - } - ButtonNo <<= 1; - IOMapButton.BtnCnt[Tmp].RelCnt = ((IOMapButton.BtnCnt[Tmp].ShortRelCnt) + (IOMapButton.BtnCnt[Tmp].LongRelCnt)); - } - VarsButton.OldState = ButtonState; - } -} - -void cButtonExit(void) -{ - dButtonExit(); -} -- cgit v1.2.3