Library za koristenje 7 Segmentnog Displaya
Revision 2:e832b0651b17, committed 2022-02-24
- Comitter:
- ivanz
- Date:
- Thu Feb 24 18:36:05 2022 +0000
- Parent:
- 1:fc20df0d22b7
- Commit message:
- Promjene u main.cpp
Changed in this revision
--- a/7_seg_display.cpp Tue Feb 22 21:11:37 2022 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -#include "7_seg_display.h" -BusOut Seg1(PB_4,PB_10,PA_8,PA_9,PC_7,PB_6,PA_7,PB_9); -void SegInit(void) -{ - Seg1=SegConvert(0); -} -char SegConvert(int SegValue) //Konverzija int varijable u niz bitova za ispis na 7 seg. displayu -{ - char SegByte=0x00; - switch (SegValue) { - case 0 : - SegByte = 0x3F; - break; - case 1 : - SegByte = 0x06; - break; - case 2 : - SegByte = 0x5B; - break; - case 3 : - SegByte = 0x4F; - break; - case 4 : - SegByte = 0x66; - break; - case 5 : - SegByte = 0x6D; - break; - case 6 : - SegByte = 0x7D; - break; - case 7 : - SegByte = 0x07; - break; - case 8 : - SegByte = 0x7F; - break; - case 9 : - SegByte = 0x6F; - break; - case 10 : - SegByte = 0x80; - break; - } - return SegByte; -} \ No newline at end of file
--- a/7_seg_display.h Tue Feb 22 21:11:37 2022 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -#ifndef SEGDISPLAY_H -#define SEGDISPLAY_H -#include "mbed.h" -extern BusOut Seg1; -void SegInit(void); -char SegConvert(int SegValue); -#endif - \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SegDisplay.cpp Thu Feb 24 18:36:05 2022 +0000 @@ -0,0 +1,46 @@ +#include "SegDisplay.h" +BusOut Seg1(PB_4,PB_10,PA_8,PA_9,PC_7,PB_6,PA_7,PB_9); +void SegInit(void) +{ + Seg1=SegConvert(0); +} +char SegConvert(int SegValue) //Konverzija int varijable u niz bitova za ispis na 7 seg. displayu +{ + char SegByte=0x00; + switch (SegValue) { + case 0 : + SegByte = 0x3F; + break; + case 1 : + SegByte = 0x06; + break; + case 2 : + SegByte = 0x5B; + break; + case 3 : + SegByte = 0x4F; + break; + case 4 : + SegByte = 0x66; + break; + case 5 : + SegByte = 0x6D; + break; + case 6 : + SegByte = 0x7D; + break; + case 7 : + SegByte = 0x07; + break; + case 8 : + SegByte = 0x7F; + break; + case 9 : + SegByte = 0x6F; + break; + case 10 : + SegByte = 0x80; + break; + } + return SegByte; +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SegDisplay.h Thu Feb 24 18:36:05 2022 +0000 @@ -0,0 +1,8 @@ +#ifndef SEGDISPLAY_H +#define SEGDISPLAY_H +#include "mbed.h" +extern BusOut Seg1; +void SegInit(void); +char SegConvert(int SegValue); +#endif + \ No newline at end of file