瀏覽代碼

nog niet werkend

MalekSediqi 9 年之前
父節點
當前提交
576ebe9729
共有 8 個文件被更改,包括 96 次插入26 次删除
  1. 1 3
      .idea/InternetRadio.iml
  2. 15 0
      display.c
  3. 2 2
      display.h
  4. 14 0
      displayHandler.c
  5. 1 0
      displayHandler.h
  6. 17 17
      keyboard.c
  7. 2 2
      keyboard.h
  8. 44 2
      main.c

+ 1 - 3
.idea/InternetRadio.iml

@@ -1,9 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <module type="CPP_MODULE" version="4">
   <component name="NewModuleRootManager">
-    <content url="file://$MODULE_DIR$">
-      <sourceFolder url="file://$MODULE_DIR$/CMakeLists.txt" isTestSource="false" />
-    </content>
+    <content url="file://$MODULE_DIR$" />
     <orderEntry type="sourceFolder" forTests="false" />
     <orderEntry type="module-library">
       <library name="Header Search Paths">

+ 15 - 0
display.c

@@ -278,6 +278,21 @@ void LcdArrayLineTwo(char *data, int size){
 	}
 }
 
+void setXCursorPos(int leftRight,int count)
+{
+    int i;
+    for ( i = 0; i <count ; ++i)
+    {
+        switch(leftRight)
+        {
+            case 0: LcdWriteByte(1,0x18);		// shift rechts
+                break;
+            case 1: LcdWriteByte(1,0x1c);		// shift links
+                break;
+        }
+    }
+}
+
 /* ---------- end of module ------------------------------------------------ */
 	
 /*@}*/

+ 2 - 2
display.h

@@ -57,9 +57,9 @@ extern void LcdLowLevelInit(void);
 extern void ClearLcd(void);
 extern void LcdArrayLineOne(char*, int);
 extern void LcdArrayLineTwo(char*, int);
-
+extern void setXCursorPos(int,int);
 #endif /* _Display_H */
-/*  ÍÍÍÍ  End Of File  ÍÍÍÍÍÍÍÍ ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+/*  ����  End Of File  �������� �������������������������������������������� */
 
 
 

+ 14 - 0
displayHandler.c

@@ -86,5 +86,19 @@ void displayAlarm(int line_number, int line_numberTwo)
     }
 }
 
+void displayVolume(int pos)
+{
+    int i;
+    char characters[17];
+
+    for(i = 0; i < 17; i++)
+    {
+        characters[i] = 0xFF;
+    }
+        ClearLcd();
+        LcdArrayLineTwo(characters,pos);
+
+}
+
 
 

+ 1 - 0
displayHandler.h

@@ -8,4 +8,5 @@
 void displayTime(int);
 void displayDate(int);
 void displayAlarm(int line_number, int line_numberTwo);
+void displayVolume(int pos);
 #endif //MUTLI_OS_BUILD_DISPLAYHANDLER_H

+ 17 - 17
keyboard.c

@@ -75,7 +75,7 @@ static u_char KbRemapKey(u_short LongKey);
 
 
 
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+/* ����������������������������������������������������������������������� */
 /*!
  * \brief Clear the eventbuffer of this module
  *
@@ -83,7 +83,7 @@ static u_char KbRemapKey(u_short LongKey);
  *
  * \param *pEvent pointer to the event queue
  */
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+/* ����������������������������������������������������������������������� */
 static void KbClearEvent(HANDLE *pEvent)
 {
     NutEnterCritical();
@@ -93,7 +93,7 @@ static void KbClearEvent(HANDLE *pEvent)
     NutExitCritical();
 }
 
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+/* ����������������������������������������������������������������������� */
 /*!
  * \brief Low-level keyboard scan
  *
@@ -102,8 +102,8 @@ static void KbClearEvent(HANDLE *pEvent)
  *
  * After each keyboard-scan, check for a valid MMCard
  */
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
-int KbScan()
+/* ����������������������������������������������������������������������� */
+u_short KbScan()
 {
     u_char KeyNibble0, KeyNibble1, KeyNibble2, KeyNibble3;
 
@@ -161,12 +161,12 @@ int KbScan()
 
 }
 
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+/* ����������������������������������������������������������������������� */
 /*!
  * \brief Remap the 16-bit value for the active key to an 8-bit value
  *
  */
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+/* ����������������������������������������������������������������������� */
 static u_char KbRemapKey(u_short LongKey)
 {
     switch (LongKey)
@@ -192,25 +192,25 @@ static u_char KbRemapKey(u_short LongKey)
     }
 }
 
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+/* ����������������������������������������������������������������������� */
 /*!
  * \brief Return the repeating property for this key
  *
  * \return 'TRUE' in case the key was repeating, 'FALSE' if not
  *
  */
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+/* ����������������������������������������������������������������������� */
 static u_char KbKeyIsRepeating(u_short Key)
 {
     return(KeyRepeatArray[KbRemapKey(Key)]==KEY_REPEAT);
 }
 
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+/* ����������������������������������������������������������������������� */
 /*!
  * \brief set the property of this key to repeating or not-repeating
  *
  */
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+/* ����������������������������������������������������������������������� */
 void KbSetKeyRepeating(u_char Key, u_char Property)
 {
     // check arguments
@@ -220,7 +220,7 @@ void KbSetKeyRepeating(u_char Key, u_char Property)
     }
 }
 
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+/* ����������������������������������������������������������������������� */
 /*!
  * \brief Wait until an event was pushed on the eventqueue for this module
  *
@@ -232,7 +232,7 @@ void KbSetKeyRepeating(u_char Key, u_char Property)
  * \return KB_OK in case an event was found
  * \return KB_ERROR in case no event was found (return due to timeout)
  */
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+/* ����������������������������������������������������������������������� */
 int KbWaitForKeyEvent(u_long dwTimeout)
 {
 
@@ -248,7 +248,7 @@ int KbWaitForKeyEvent(u_long dwTimeout)
     return(nError);
 }
 
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+/* ����������������������������������������������������������������������� */
 /*!
  * \brief Return the databyte that was receeived in the IR-stream
  *
@@ -260,7 +260,7 @@ int KbWaitForKeyEvent(u_long dwTimeout)
  *
  * \todo implement a key-buffer for this routine
  */
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+/* ����������������������������������������������������������������������� */
 u_char KbGetKey()
 {
     return(KeyBuffer[0]);
@@ -275,7 +275,7 @@ void KbInjectKey(u_char VirtualKey)
     KeyBuffer[0]=VirtualKey;
     NutEventPostFromIrq(&hKBEvent);   // 'valid key' detected -> generate Event
 }
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+/* ����������������������������������������������������������������������� */
 /*!
  * \brief Initialise the Keyboard module
  *
@@ -288,7 +288,7 @@ void KbInjectKey(u_char VirtualKey)
  * when no key is pressed. Use negative logic to detect keys.
  * So default state of the colums is '1'
  */
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+/* ����������������������������������������������������������������������� */
 void KbInit()
 {
     u_char i;

+ 2 - 2
keyboard.h

@@ -90,14 +90,14 @@
 /* export global routines (interface)                                      */
 /*-------------------------------------------------------------------------*/
 void    KbInit(void);
-int    KbScan(void);
+void  KbScan(void);
 int 	CheckKey();
 int     KbWaitForKeyEvent(u_long);
 u_char  KbGetKey(void);
 void    KbSetKeyRepeating(u_char, u_char);
 void    KbInjectKey(u_char VirtualKey);
 
-/*  ÍÍÍÍ  End Of File  ÍÍÍÍÍÍÍÍ ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+/*  ����  End Of File  �������� �������������������������������������������� */
 
 
 

+ 44 - 2
main.c

@@ -221,7 +221,9 @@ int checkOffPressed(){
 
 int main(void)
 {
+    unsigned char rightSave;
 	time_t start;
+    time_t startVolumeTime;
 	int running = 0;
 
     WatchDogDisable();
@@ -251,6 +253,7 @@ int main(void)
 
     /** Quick fix for turning off the display after 10 seconds boot */
     start = time(0);
+    startVolumeTime = time(0);
     running = 1;
 
     RcInit();
@@ -266,9 +269,12 @@ int main(void)
 
 	/* Enable global interrupts */
 	sei();
-
+    unsigned char left = 64;
+    unsigned char right = 64;
+    displayDate(1);
     for (;;)
     {
+        printf("%d \n", KbScan());
 		//Check if a button is pressed
 		if (checkOffPressed() == 1){
 			start = time(0);
@@ -294,7 +300,43 @@ int main(void)
         }
         else {
             displayTime(0);
-            displayDate(1);
+                if (timer(startVolumeTime) >= 10) {
+                    startVolumeTime = time(0);
+                    printf("%d \n", left);
+                    left = rightSave;
+                    displayDate(1);
+                   // printf("%d \n", right);
+                }
+            }
+
+
+        if(KbScan() == -2049)
+        {
+            startVolumeTime = time(0);
+            if(left > 1){
+            left -= 8;
+            right = left;
+            VsSetVolume (left, right);
+            //LogMsg_P(LOG_INFO, PSTR("klikU : %d"), right/8);
+              // LogMsg_P(LOG_INFO, PSTR("klikU : %d"), left);
+              //  printf("%d \n", right);
+            displayVolume(left/8);
+                }
+            rightSave = left;
+        }
+        if(KbScan() == -1025)
+        {
+            startVolumeTime = time(0);
+            if(left < 128) {
+                left += 8;
+                right = left;
+                VsSetVolume(left, right);
+               // LogMsg_P(LOG_INFO, PSTR("klikD : %d"), right/8);
+               // LogMsg_P(LOG_INFO, PSTR("klikD : %d"), left);
+                //printf("%d \n", right);
+                displayVolume(left/8);
+                rightSave = left;
+            }
         }
         WatchDogRestart();
     }