P10
LED_P10.cpp@0:3d89509fadb7, 2019-09-16 (annotated)
- Committer:
- shivanandgowdakr
- Date:
- Mon Sep 16 15:02:05 2019 +0000
- Revision:
- 0:3d89509fadb7
p10;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shivanandgowdakr | 0:3d89509fadb7 | 1 | #include "mbed.h" |
shivanandgowdakr | 0:3d89509fadb7 | 2 | #include "Aerial_black_16.h" |
shivanandgowdakr | 0:3d89509fadb7 | 3 | #include "double_font2.h" |
shivanandgowdakr | 0:3d89509fadb7 | 4 | #include "led_half_1.h" |
shivanandgowdakr | 0:3d89509fadb7 | 5 | #include "LED_P10.h" |
shivanandgowdakr | 0:3d89509fadb7 | 6 | #include <string.h> |
shivanandgowdakr | 0:3d89509fadb7 | 7 | |
shivanandgowdakr | 0:3d89509fadb7 | 8 | char * LedP10 :: msg=NULL; |
shivanandgowdakr | 0:3d89509fadb7 | 9 | char * LedP10 :: msg1=NULL; |
shivanandgowdakr | 0:3d89509fadb7 | 10 | char * LedP10 :: msg2=NULL; |
shivanandgowdakr | 0:3d89509fadb7 | 11 | const uint8_t * LedP10 :: font_lib; |
shivanandgowdakr | 0:3d89509fadb7 | 12 | uint8_t * LedP10 :: dislay[2]={NULL}; |
shivanandgowdakr | 0:3d89509fadb7 | 13 | int LedP10 :: speed=5; |
shivanandgowdakr | 0:3d89509fadb7 | 14 | int LedP10 :: font; |
shivanandgowdakr | 0:3d89509fadb7 | 15 | int LedP10 :: filled=0; |
shivanandgowdakr | 0:3d89509fadb7 | 16 | int LedP10 :: index=0; |
shivanandgowdakr | 0:3d89509fadb7 | 17 | int LedP10 :: filled1=0; |
shivanandgowdakr | 0:3d89509fadb7 | 18 | int LedP10 :: filled2=0; |
shivanandgowdakr | 0:3d89509fadb7 | 19 | int LedP10 :: index1=0; |
shivanandgowdakr | 0:3d89509fadb7 | 20 | int LedP10 :: index2=0; |
shivanandgowdakr | 0:3d89509fadb7 | 21 | int LedP10 :: numberofpanels=1; |
shivanandgowdakr | 0:3d89509fadb7 | 22 | int LedP10 :: buffersize=49; |
shivanandgowdakr | 0:3d89509fadb7 | 23 | int LedP10 :: storepin =8; |
shivanandgowdakr | 0:3d89509fadb7 | 24 | int LedP10 :: outputenablepin=9 ; |
shivanandgowdakr | 0:3d89509fadb7 | 25 | int LedP10 :: b =4; |
shivanandgowdakr | 0:3d89509fadb7 | 26 | int LedP10 :: a =3; |
shivanandgowdakr | 0:3d89509fadb7 | 27 | int LedP10 :: scroll=-1; |
shivanandgowdakr | 0:3d89509fadb7 | 28 | int LedP10 :: scroll1=-1; |
shivanandgowdakr | 0:3d89509fadb7 | 29 | int LedP10 :: scroll2=-1; |
shivanandgowdakr | 0:3d89509fadb7 | 30 | int LedP10 :: scrollcount=0; |
shivanandgowdakr | 0:3d89509fadb7 | 31 | int LedP10 :: scrollcount1=0; |
shivanandgowdakr | 0:3d89509fadb7 | 32 | int LedP10 :: scrollcount2=0; |
shivanandgowdakr | 0:3d89509fadb7 | 33 | int LedP10 :: x=0; |
shivanandgowdakr | 0:3d89509fadb7 | 34 | int LedP10 :: y=0; |
shivanandgowdakr | 0:3d89509fadb7 | 35 | int LedP10 :: speed1=5; |
shivanandgowdakr | 0:3d89509fadb7 | 36 | int LedP10 :: speed2=5; |
shivanandgowdakr | 0:3d89509fadb7 | 37 | int LedP10 :: speedcount=0; |
shivanandgowdakr | 0:3d89509fadb7 | 38 | int LedP10 :: speedcount1=0; |
shivanandgowdakr | 0:3d89509fadb7 | 39 | int LedP10 :: speedcount2=0; |
shivanandgowdakr | 0:3d89509fadb7 | 40 | int LedP10 :: always=1; |
shivanandgowdakr | 0:3d89509fadb7 | 41 | int LedP10 :: always1=0; |
shivanandgowdakr | 0:3d89509fadb7 | 42 | int LedP10 :: always2=1; |
shivanandgowdakr | 0:3d89509fadb7 | 43 | uint8_t LedP10 :: brightness=255; |
shivanandgowdakr | 0:3d89509fadb7 | 44 | LedP10 :: LedP10() |
shivanandgowdakr | 0:3d89509fadb7 | 45 | {} |
shivanandgowdakr | 0:3d89509fadb7 | 46 | void LedP10 :: init_internal() |
shivanandgowdakr | 0:3d89509fadb7 | 47 | { |
shivanandgowdakr | 0:3d89509fadb7 | 48 | |
shivanandgowdakr | 0:3d89509fadb7 | 49 | /* |
shivanandgowdakr | 0:3d89509fadb7 | 50 | pinMode(outputenablepin,OUTPUT); |
shivanandgowdakr | 0:3d89509fadb7 | 51 | pinMode(a,OUTPUT); |
shivanandgowdakr | 0:3d89509fadb7 | 52 | pinMode(b,OUTPUT); |
shivanandgowdakr | 0:3d89509fadb7 | 53 | pinMode(10,OUTPUT); |
shivanandgowdakr | 0:3d89509fadb7 | 54 | |
shivanandgowdakr | 0:3d89509fadb7 | 55 | pinMode(storepin,OUTPUT); |
shivanandgowdakr | 0:3d89509fadb7 | 56 | digitalWrite(a, LOW); |
shivanandgowdakr | 0:3d89509fadb7 | 57 | digitalWrite(b, LOW); |
shivanandgowdakr | 0:3d89509fadb7 | 58 | SPI.beginTransaction(SPISettings(1152000, MSBFIRST, SPI_MODE0)); |
shivanandgowdakr | 0:3d89509fadb7 | 59 | SPI.begin(); |
shivanandgowdakr | 0:3d89509fadb7 | 60 | digitalWrite(outputenablepin,LOW); |
shivanandgowdakr | 0:3d89509fadb7 | 61 | scroll=-1; |
shivanandgowdakr | 0:3d89509fadb7 | 62 | scroll1=-1; |
shivanandgowdakr | 0:3d89509fadb7 | 63 | scroll2=-1; |
shivanandgowdakr | 0:3d89509fadb7 | 64 | |
shivanandgowdakr | 0:3d89509fadb7 | 65 | */ |
shivanandgowdakr | 0:3d89509fadb7 | 66 | } |
shivanandgowdakr | 0:3d89509fadb7 | 67 | |
shivanandgowdakr | 0:3d89509fadb7 | 68 | void LedP10 :: store() |
shivanandgowdakr | 0:3d89509fadb7 | 69 | { |
shivanandgowdakr | 0:3d89509fadb7 | 70 | /* |
shivanandgowdakr | 0:3d89509fadb7 | 71 | digitalWrite(storepin, HIGH); |
shivanandgowdakr | 0:3d89509fadb7 | 72 | digitalWrite(storepin, LOW); |
shivanandgowdakr | 0:3d89509fadb7 | 73 | |
shivanandgowdakr | 0:3d89509fadb7 | 74 | */ |
shivanandgowdakr | 0:3d89509fadb7 | 75 | } |
shivanandgowdakr | 0:3d89509fadb7 | 76 | |
shivanandgowdakr | 0:3d89509fadb7 | 77 | void LedP10 :: init(int A, int B, int store_pin, int oe, int no_of_panels) |
shivanandgowdakr | 0:3d89509fadb7 | 78 | { |
shivanandgowdakr | 0:3d89509fadb7 | 79 | a=A; |
shivanandgowdakr | 0:3d89509fadb7 | 80 | b=B; |
shivanandgowdakr | 0:3d89509fadb7 | 81 | storepin=store_pin; |
shivanandgowdakr | 0:3d89509fadb7 | 82 | outputenablepin=oe; |
shivanandgowdakr | 0:3d89509fadb7 | 83 | numberofpanels=no_of_panels; |
shivanandgowdakr | 0:3d89509fadb7 | 84 | buffersize=17+numberofpanels*32; |
shivanandgowdakr | 0:3d89509fadb7 | 85 | dislay[0]=(uint8_t *)malloc(buffersize*sizeof(uint8_t)); |
shivanandgowdakr | 0:3d89509fadb7 | 86 | dislay[1]=(uint8_t *)malloc(buffersize*sizeof(uint8_t)); |
shivanandgowdakr | 0:3d89509fadb7 | 87 | for(int i=0;i<buffersize;i++) |
shivanandgowdakr | 0:3d89509fadb7 | 88 | { |
shivanandgowdakr | 0:3d89509fadb7 | 89 | dislay[0][i]=0x00; |
shivanandgowdakr | 0:3d89509fadb7 | 90 | dislay[1][i]=0x00; |
shivanandgowdakr | 0:3d89509fadb7 | 91 | } |
shivanandgowdakr | 0:3d89509fadb7 | 92 | LedP10 ::init_internal(); |
shivanandgowdakr | 0:3d89509fadb7 | 93 | } |
shivanandgowdakr | 0:3d89509fadb7 | 94 | void LedP10 :: filldisplaysingle_static() |
shivanandgowdakr | 0:3d89509fadb7 | 95 | { |
shivanandgowdakr | 0:3d89509fadb7 | 96 | filled=0; |
shivanandgowdakr | 0:3d89509fadb7 | 97 | index=0; |
shivanandgowdakr | 0:3d89509fadb7 | 98 | char nextchar; |
shivanandgowdakr | 0:3d89509fadb7 | 99 | int no_of_char = pgm_read_byte_near(font_lib+5); |
shivanandgowdakr | 0:3d89509fadb7 | 100 | int first_char = pgm_read_byte_near(font_lib+4); |
shivanandgowdakr | 0:3d89509fadb7 | 101 | uint16_t widthpos,width,datapos; |
shivanandgowdakr | 0:3d89509fadb7 | 102 | while(index!=strlen(msg)&&filled<32*numberofpanels) |
shivanandgowdakr | 0:3d89509fadb7 | 103 | { |
shivanandgowdakr | 0:3d89509fadb7 | 104 | nextchar=msg[index++]; |
shivanandgowdakr | 0:3d89509fadb7 | 105 | widthpos= 6+nextchar-first_char; |
shivanandgowdakr | 0:3d89509fadb7 | 106 | uint16_t sum=0; |
shivanandgowdakr | 0:3d89509fadb7 | 107 | for(int i=0;i<nextchar-first_char;i++) |
shivanandgowdakr | 0:3d89509fadb7 | 108 | { |
shivanandgowdakr | 0:3d89509fadb7 | 109 | sum+= 2*pgm_read_byte_near(font_lib+6+i); |
shivanandgowdakr | 0:3d89509fadb7 | 110 | } |
shivanandgowdakr | 0:3d89509fadb7 | 111 | datapos= 6+no_of_char+sum; |
shivanandgowdakr | 0:3d89509fadb7 | 112 | width=pgm_read_byte_near(font_lib+widthpos); |
shivanandgowdakr | 0:3d89509fadb7 | 113 | if(filled+width+1<=32*numberofpanels) |
shivanandgowdakr | 0:3d89509fadb7 | 114 | { |
shivanandgowdakr | 0:3d89509fadb7 | 115 | word count=0; |
shivanandgowdakr | 0:3d89509fadb7 | 116 | for(count=0;count<width;count++) |
shivanandgowdakr | 0:3d89509fadb7 | 117 | { |
shivanandgowdakr | 0:3d89509fadb7 | 118 | dislay[0][filled]=pgm_read_byte_near(font_lib+datapos+count); |
shivanandgowdakr | 0:3d89509fadb7 | 119 | dislay[1][filled]=pgm_read_byte_near(font_lib+datapos+count+width); |
shivanandgowdakr | 0:3d89509fadb7 | 120 | (filled)++; |
shivanandgowdakr | 0:3d89509fadb7 | 121 | } |
shivanandgowdakr | 0:3d89509fadb7 | 122 | dislay[0][filled]=0x00; |
shivanandgowdakr | 0:3d89509fadb7 | 123 | dislay[1][filled]=0x00; |
shivanandgowdakr | 0:3d89509fadb7 | 124 | (filled)++; |
shivanandgowdakr | 0:3d89509fadb7 | 125 | } |
shivanandgowdakr | 0:3d89509fadb7 | 126 | |
shivanandgowdakr | 0:3d89509fadb7 | 127 | } |
shivanandgowdakr | 0:3d89509fadb7 | 128 | while(filled<32*numberofpanels) |
shivanandgowdakr | 0:3d89509fadb7 | 129 | { |
shivanandgowdakr | 0:3d89509fadb7 | 130 | dislay[0][filled]=0x00; |
shivanandgowdakr | 0:3d89509fadb7 | 131 | dislay[1][filled]=0x00; |
shivanandgowdakr | 0:3d89509fadb7 | 132 | (filled)++; |
shivanandgowdakr | 0:3d89509fadb7 | 133 | } |
shivanandgowdakr | 0:3d89509fadb7 | 134 | } |
shivanandgowdakr | 0:3d89509fadb7 | 135 | |
shivanandgowdakr | 0:3d89509fadb7 | 136 | void LedP10 :: filldisplaysingle() |
shivanandgowdakr | 0:3d89509fadb7 | 137 | { |
shivanandgowdakr | 0:3d89509fadb7 | 138 | char nextchar; |
shivanandgowdakr | 0:3d89509fadb7 | 139 | uint16_t widthpos,width,datapos; |
shivanandgowdakr | 0:3d89509fadb7 | 140 | int no_of_char=pgm_read_byte_near(font_lib+5); |
shivanandgowdakr | 0:3d89509fadb7 | 141 | int first_char = pgm_read_byte_near(font_lib+4); |
shivanandgowdakr | 0:3d89509fadb7 | 142 | while(filled<buffersize&&(scroll>0||always==1)) |
shivanandgowdakr | 0:3d89509fadb7 | 143 | { |
shivanandgowdakr | 0:3d89509fadb7 | 144 | if(index==strlen(msg)) |
shivanandgowdakr | 0:3d89509fadb7 | 145 | { |
shivanandgowdakr | 0:3d89509fadb7 | 146 | scroll--; |
shivanandgowdakr | 0:3d89509fadb7 | 147 | index=0; |
shivanandgowdakr | 0:3d89509fadb7 | 148 | nextchar=' '; |
shivanandgowdakr | 0:3d89509fadb7 | 149 | } |
shivanandgowdakr | 0:3d89509fadb7 | 150 | else |
shivanandgowdakr | 0:3d89509fadb7 | 151 | { |
shivanandgowdakr | 0:3d89509fadb7 | 152 | nextchar=msg[index++]; |
shivanandgowdakr | 0:3d89509fadb7 | 153 | } |
shivanandgowdakr | 0:3d89509fadb7 | 154 | widthpos= 6+nextchar-first_char; |
shivanandgowdakr | 0:3d89509fadb7 | 155 | uint16_t sum=0; |
shivanandgowdakr | 0:3d89509fadb7 | 156 | for(int i=0;i<nextchar-first_char;i++) |
shivanandgowdakr | 0:3d89509fadb7 | 157 | { |
shivanandgowdakr | 0:3d89509fadb7 | 158 | sum+= 2*pgm_read_byte_near(font_lib+6+i); |
shivanandgowdakr | 0:3d89509fadb7 | 159 | } |
shivanandgowdakr | 0:3d89509fadb7 | 160 | datapos= 6+no_of_char+sum; |
shivanandgowdakr | 0:3d89509fadb7 | 161 | width=pgm_read_byte_near(font_lib+widthpos); |
shivanandgowdakr | 0:3d89509fadb7 | 162 | if(filled+width+1<=buffersize) |
shivanandgowdakr | 0:3d89509fadb7 | 163 | { |
shivanandgowdakr | 0:3d89509fadb7 | 164 | word count=0; |
shivanandgowdakr | 0:3d89509fadb7 | 165 | for(count=0;count<width;count++) |
shivanandgowdakr | 0:3d89509fadb7 | 166 | { |
shivanandgowdakr | 0:3d89509fadb7 | 167 | dislay[0][filled]=pgm_read_byte_near(font_lib+datapos+count); |
shivanandgowdakr | 0:3d89509fadb7 | 168 | dislay[1][filled]=pgm_read_byte_near(font_lib+datapos+count+width); |
shivanandgowdakr | 0:3d89509fadb7 | 169 | (filled)++; |
shivanandgowdakr | 0:3d89509fadb7 | 170 | } |
shivanandgowdakr | 0:3d89509fadb7 | 171 | dislay[0][filled]=0x00; |
shivanandgowdakr | 0:3d89509fadb7 | 172 | dislay[1][filled]=0x00; |
shivanandgowdakr | 0:3d89509fadb7 | 173 | (filled)++; |
shivanandgowdakr | 0:3d89509fadb7 | 174 | } |
shivanandgowdakr | 0:3d89509fadb7 | 175 | else |
shivanandgowdakr | 0:3d89509fadb7 | 176 | { |
shivanandgowdakr | 0:3d89509fadb7 | 177 | if(index>0) |
shivanandgowdakr | 0:3d89509fadb7 | 178 | index--; |
shivanandgowdakr | 0:3d89509fadb7 | 179 | else |
shivanandgowdakr | 0:3d89509fadb7 | 180 | { |
shivanandgowdakr | 0:3d89509fadb7 | 181 | index=strlen(msg); |
shivanandgowdakr | 0:3d89509fadb7 | 182 | scroll++; |
shivanandgowdakr | 0:3d89509fadb7 | 183 | } |
shivanandgowdakr | 0:3d89509fadb7 | 184 | break; |
shivanandgowdakr | 0:3d89509fadb7 | 185 | } |
shivanandgowdakr | 0:3d89509fadb7 | 186 | } |
shivanandgowdakr | 0:3d89509fadb7 | 187 | } |
shivanandgowdakr | 0:3d89509fadb7 | 188 | |
shivanandgowdakr | 0:3d89509fadb7 | 189 | void LedP10 :: filldisplaydouble_static() |
shivanandgowdakr | 0:3d89509fadb7 | 190 | { |
shivanandgowdakr | 0:3d89509fadb7 | 191 | filled1=0;filled2=0;index1=0;index2=0; |
shivanandgowdakr | 0:3d89509fadb7 | 192 | char nextchar1,nextchar2; |
shivanandgowdakr | 0:3d89509fadb7 | 193 | int no_of_char=pgm_read_byte_near(font_lib+5); |
shivanandgowdakr | 0:3d89509fadb7 | 194 | int first_char = pgm_read_byte_near(font_lib+4); |
shivanandgowdakr | 0:3d89509fadb7 | 195 | uint16_t widthpos1,width1,datapos1,widthpos2,width2,datapos2; |
shivanandgowdakr | 0:3d89509fadb7 | 196 | while(index1!=strlen(msg1)&&filled1<32*numberofpanels) |
shivanandgowdakr | 0:3d89509fadb7 | 197 | { |
shivanandgowdakr | 0:3d89509fadb7 | 198 | nextchar1=msg1[index1++]; |
shivanandgowdakr | 0:3d89509fadb7 | 199 | widthpos1= 6+nextchar1-first_char; |
shivanandgowdakr | 0:3d89509fadb7 | 200 | uint16_t sum1=0; |
shivanandgowdakr | 0:3d89509fadb7 | 201 | for(int i=0;i<nextchar1-first_char;i++) |
shivanandgowdakr | 0:3d89509fadb7 | 202 | { |
shivanandgowdakr | 0:3d89509fadb7 | 203 | sum1+= pgm_read_byte_near(font_lib+6+i); |
shivanandgowdakr | 0:3d89509fadb7 | 204 | } |
shivanandgowdakr | 0:3d89509fadb7 | 205 | datapos1= 6+no_of_char+sum1; |
shivanandgowdakr | 0:3d89509fadb7 | 206 | width1=pgm_read_byte_near(font_lib+widthpos1); |
shivanandgowdakr | 0:3d89509fadb7 | 207 | if(filled1+width1+1<=32*numberofpanels) |
shivanandgowdakr | 0:3d89509fadb7 | 208 | { |
shivanandgowdakr | 0:3d89509fadb7 | 209 | word count1=0; |
shivanandgowdakr | 0:3d89509fadb7 | 210 | for(count1=0;count1<width1;count1++) |
shivanandgowdakr | 0:3d89509fadb7 | 211 | { |
shivanandgowdakr | 0:3d89509fadb7 | 212 | dislay[0][filled1]=pgm_read_byte_near(font_lib+datapos1+count1); |
shivanandgowdakr | 0:3d89509fadb7 | 213 | (filled1)++; |
shivanandgowdakr | 0:3d89509fadb7 | 214 | } |
shivanandgowdakr | 0:3d89509fadb7 | 215 | dislay[0][filled1]=0x00; |
shivanandgowdakr | 0:3d89509fadb7 | 216 | } |
shivanandgowdakr | 0:3d89509fadb7 | 217 | |
shivanandgowdakr | 0:3d89509fadb7 | 218 | } |
shivanandgowdakr | 0:3d89509fadb7 | 219 | while(filled1<32*numberofpanels) |
shivanandgowdakr | 0:3d89509fadb7 | 220 | { |
shivanandgowdakr | 0:3d89509fadb7 | 221 | dislay[0][filled1++]=0x00; |
shivanandgowdakr | 0:3d89509fadb7 | 222 | } |
shivanandgowdakr | 0:3d89509fadb7 | 223 | while(index2!=strlen(msg2)&&filled2<32*numberofpanels) |
shivanandgowdakr | 0:3d89509fadb7 | 224 | { |
shivanandgowdakr | 0:3d89509fadb7 | 225 | nextchar2=msg2[index2++]; |
shivanandgowdakr | 0:3d89509fadb7 | 226 | widthpos2= 6+nextchar2-first_char; |
shivanandgowdakr | 0:3d89509fadb7 | 227 | uint16_t sum2=0; |
shivanandgowdakr | 0:3d89509fadb7 | 228 | for(int i=0;i<nextchar2-first_char;i++) |
shivanandgowdakr | 0:3d89509fadb7 | 229 | { |
shivanandgowdakr | 0:3d89509fadb7 | 230 | sum2+= pgm_read_byte_near(font_lib+6+i); |
shivanandgowdakr | 0:3d89509fadb7 | 231 | } |
shivanandgowdakr | 0:3d89509fadb7 | 232 | datapos2= 6+no_of_char+sum2; |
shivanandgowdakr | 0:3d89509fadb7 | 233 | width2=pgm_read_byte_near(font_lib+widthpos2); |
shivanandgowdakr | 0:3d89509fadb7 | 234 | if(filled2+width2+1<=32*numberofpanels) |
shivanandgowdakr | 0:3d89509fadb7 | 235 | { |
shivanandgowdakr | 0:3d89509fadb7 | 236 | word count2=0; |
shivanandgowdakr | 0:3d89509fadb7 | 237 | for(count2=0;count2<width2;count2++) |
shivanandgowdakr | 0:3d89509fadb7 | 238 | { |
shivanandgowdakr | 0:3d89509fadb7 | 239 | dislay[1][filled2]=pgm_read_byte_near(font_lib+datapos2+count2); |
shivanandgowdakr | 0:3d89509fadb7 | 240 | (filled2)++; |
shivanandgowdakr | 0:3d89509fadb7 | 241 | } |
shivanandgowdakr | 0:3d89509fadb7 | 242 | dislay[1][filled2++]=0x00; |
shivanandgowdakr | 0:3d89509fadb7 | 243 | } |
shivanandgowdakr | 0:3d89509fadb7 | 244 | |
shivanandgowdakr | 0:3d89509fadb7 | 245 | } |
shivanandgowdakr | 0:3d89509fadb7 | 246 | while(filled2<32*numberofpanels) |
shivanandgowdakr | 0:3d89509fadb7 | 247 | { |
shivanandgowdakr | 0:3d89509fadb7 | 248 | dislay[1][filled2++]=0x00; |
shivanandgowdakr | 0:3d89509fadb7 | 249 | } |
shivanandgowdakr | 0:3d89509fadb7 | 250 | |
shivanandgowdakr | 0:3d89509fadb7 | 251 | } |
shivanandgowdakr | 0:3d89509fadb7 | 252 | |
shivanandgowdakr | 0:3d89509fadb7 | 253 | |
shivanandgowdakr | 0:3d89509fadb7 | 254 | void LedP10 :: filldisplaydouble() |
shivanandgowdakr | 0:3d89509fadb7 | 255 | { |
shivanandgowdakr | 0:3d89509fadb7 | 256 | char nextchar1,nextchar2; |
shivanandgowdakr | 0:3d89509fadb7 | 257 | uint16_t widthpos1,width1,datapos1,widthpos2,width2,datapos2; |
shivanandgowdakr | 0:3d89509fadb7 | 258 | int no_of_char=pgm_read_byte_near(font_lib+5); |
shivanandgowdakr | 0:3d89509fadb7 | 259 | int first_char = pgm_read_byte_near(font_lib+4); |
shivanandgowdakr | 0:3d89509fadb7 | 260 | while(filled1<buffersize&&(scroll1>0||always1==1)) |
shivanandgowdakr | 0:3d89509fadb7 | 261 | { |
shivanandgowdakr | 0:3d89509fadb7 | 262 | if(index1==strlen(msg1)) |
shivanandgowdakr | 0:3d89509fadb7 | 263 | { |
shivanandgowdakr | 0:3d89509fadb7 | 264 | scroll1--; |
shivanandgowdakr | 0:3d89509fadb7 | 265 | index1=0; |
shivanandgowdakr | 0:3d89509fadb7 | 266 | nextchar1=' '; |
shivanandgowdakr | 0:3d89509fadb7 | 267 | } |
shivanandgowdakr | 0:3d89509fadb7 | 268 | else |
shivanandgowdakr | 0:3d89509fadb7 | 269 | { |
shivanandgowdakr | 0:3d89509fadb7 | 270 | nextchar1=msg1[index1++]; |
shivanandgowdakr | 0:3d89509fadb7 | 271 | } |
shivanandgowdakr | 0:3d89509fadb7 | 272 | widthpos1= 6+nextchar1-first_char; |
shivanandgowdakr | 0:3d89509fadb7 | 273 | uint16_t sum1=0; |
shivanandgowdakr | 0:3d89509fadb7 | 274 | for(int i=0;i<nextchar1-first_char;i++) |
shivanandgowdakr | 0:3d89509fadb7 | 275 | { |
shivanandgowdakr | 0:3d89509fadb7 | 276 | sum1+= pgm_read_byte_near(font_lib+6+i); |
shivanandgowdakr | 0:3d89509fadb7 | 277 | } |
shivanandgowdakr | 0:3d89509fadb7 | 278 | datapos1= 6+no_of_char+sum1; |
shivanandgowdakr | 0:3d89509fadb7 | 279 | width1=pgm_read_byte_near(font_lib+widthpos1); |
shivanandgowdakr | 0:3d89509fadb7 | 280 | if(filled1+width1+1<=buffersize) |
shivanandgowdakr | 0:3d89509fadb7 | 281 | { |
shivanandgowdakr | 0:3d89509fadb7 | 282 | word count1=0; |
shivanandgowdakr | 0:3d89509fadb7 | 283 | for(count1=0;count1<width1;count1++) |
shivanandgowdakr | 0:3d89509fadb7 | 284 | { |
shivanandgowdakr | 0:3d89509fadb7 | 285 | dislay[0][filled1]=pgm_read_byte_near(font_lib+datapos1+count1); |
shivanandgowdakr | 0:3d89509fadb7 | 286 | (filled1)++; |
shivanandgowdakr | 0:3d89509fadb7 | 287 | } |
shivanandgowdakr | 0:3d89509fadb7 | 288 | dislay[0][filled1]=0x00; |
shivanandgowdakr | 0:3d89509fadb7 | 289 | (filled1)++; |
shivanandgowdakr | 0:3d89509fadb7 | 290 | } |
shivanandgowdakr | 0:3d89509fadb7 | 291 | else |
shivanandgowdakr | 0:3d89509fadb7 | 292 | { |
shivanandgowdakr | 0:3d89509fadb7 | 293 | if(index1>0) |
shivanandgowdakr | 0:3d89509fadb7 | 294 | index1--; |
shivanandgowdakr | 0:3d89509fadb7 | 295 | else |
shivanandgowdakr | 0:3d89509fadb7 | 296 | { |
shivanandgowdakr | 0:3d89509fadb7 | 297 | scroll1++; |
shivanandgowdakr | 0:3d89509fadb7 | 298 | index1=strlen(msg1); |
shivanandgowdakr | 0:3d89509fadb7 | 299 | } |
shivanandgowdakr | 0:3d89509fadb7 | 300 | break; |
shivanandgowdakr | 0:3d89509fadb7 | 301 | } |
shivanandgowdakr | 0:3d89509fadb7 | 302 | } |
shivanandgowdakr | 0:3d89509fadb7 | 303 | while(filled2<buffersize&&(scroll2>0||always2==1)) |
shivanandgowdakr | 0:3d89509fadb7 | 304 | { |
shivanandgowdakr | 0:3d89509fadb7 | 305 | if(index2==strlen(msg2)) |
shivanandgowdakr | 0:3d89509fadb7 | 306 | { |
shivanandgowdakr | 0:3d89509fadb7 | 307 | scroll2--; |
shivanandgowdakr | 0:3d89509fadb7 | 308 | index2=0; |
shivanandgowdakr | 0:3d89509fadb7 | 309 | nextchar2=' '; |
shivanandgowdakr | 0:3d89509fadb7 | 310 | } |
shivanandgowdakr | 0:3d89509fadb7 | 311 | else |
shivanandgowdakr | 0:3d89509fadb7 | 312 | { |
shivanandgowdakr | 0:3d89509fadb7 | 313 | nextchar2=msg2[index2++]; |
shivanandgowdakr | 0:3d89509fadb7 | 314 | } |
shivanandgowdakr | 0:3d89509fadb7 | 315 | widthpos2= 6+nextchar2-first_char; |
shivanandgowdakr | 0:3d89509fadb7 | 316 | uint16_t sum2=0; |
shivanandgowdakr | 0:3d89509fadb7 | 317 | for(int i=0;i<nextchar2-first_char;i++) |
shivanandgowdakr | 0:3d89509fadb7 | 318 | { |
shivanandgowdakr | 0:3d89509fadb7 | 319 | sum2+= pgm_read_byte_near(font_lib+6+i); |
shivanandgowdakr | 0:3d89509fadb7 | 320 | } |
shivanandgowdakr | 0:3d89509fadb7 | 321 | datapos2= 6+no_of_char+sum2; |
shivanandgowdakr | 0:3d89509fadb7 | 322 | width2=pgm_read_byte_near(font_lib+widthpos2); |
shivanandgowdakr | 0:3d89509fadb7 | 323 | if(filled2+width2+1<=buffersize) |
shivanandgowdakr | 0:3d89509fadb7 | 324 | { |
shivanandgowdakr | 0:3d89509fadb7 | 325 | word count2=0; |
shivanandgowdakr | 0:3d89509fadb7 | 326 | for(count2=0;count2<width2;count2++) |
shivanandgowdakr | 0:3d89509fadb7 | 327 | { |
shivanandgowdakr | 0:3d89509fadb7 | 328 | dislay[1][filled2]=pgm_read_byte_near(font_lib+datapos2+count2); |
shivanandgowdakr | 0:3d89509fadb7 | 329 | (filled2)++; |
shivanandgowdakr | 0:3d89509fadb7 | 330 | } |
shivanandgowdakr | 0:3d89509fadb7 | 331 | dislay[1][filled2]=0x00; |
shivanandgowdakr | 0:3d89509fadb7 | 332 | (filled2)++; |
shivanandgowdakr | 0:3d89509fadb7 | 333 | } |
shivanandgowdakr | 0:3d89509fadb7 | 334 | else |
shivanandgowdakr | 0:3d89509fadb7 | 335 | { |
shivanandgowdakr | 0:3d89509fadb7 | 336 | if(index2>0) |
shivanandgowdakr | 0:3d89509fadb7 | 337 | index2--; |
shivanandgowdakr | 0:3d89509fadb7 | 338 | else |
shivanandgowdakr | 0:3d89509fadb7 | 339 | { |
shivanandgowdakr | 0:3d89509fadb7 | 340 | index2=strlen(msg2); |
shivanandgowdakr | 0:3d89509fadb7 | 341 | scroll2++; |
shivanandgowdakr | 0:3d89509fadb7 | 342 | } |
shivanandgowdakr | 0:3d89509fadb7 | 343 | break; |
shivanandgowdakr | 0:3d89509fadb7 | 344 | } |
shivanandgowdakr | 0:3d89509fadb7 | 345 | } |
shivanandgowdakr | 0:3d89509fadb7 | 346 | } |
shivanandgowdakr | 0:3d89509fadb7 | 347 | |
shivanandgowdakr | 0:3d89509fadb7 | 348 | void LedP10 :: slide() |
shivanandgowdakr | 0:3d89509fadb7 | 349 | { |
shivanandgowdakr | 0:3d89509fadb7 | 350 | int i; |
shivanandgowdakr | 0:3d89509fadb7 | 351 | if(speed1!=0) |
shivanandgowdakr | 0:3d89509fadb7 | 352 | { |
shivanandgowdakr | 0:3d89509fadb7 | 353 | speedcount1++; |
shivanandgowdakr | 0:3d89509fadb7 | 354 | if(speedcount1==30/speed1) |
shivanandgowdakr | 0:3d89509fadb7 | 355 | { |
shivanandgowdakr | 0:3d89509fadb7 | 356 | speedcount1=0; |
shivanandgowdakr | 0:3d89509fadb7 | 357 | for(i=0;i<buffersize-1 ;i++) |
shivanandgowdakr | 0:3d89509fadb7 | 358 | { |
shivanandgowdakr | 0:3d89509fadb7 | 359 | dislay[0][i]= dislay[0][i+1]; |
shivanandgowdakr | 0:3d89509fadb7 | 360 | } |
shivanandgowdakr | 0:3d89509fadb7 | 361 | filled1--; |
shivanandgowdakr | 0:3d89509fadb7 | 362 | } |
shivanandgowdakr | 0:3d89509fadb7 | 363 | } |
shivanandgowdakr | 0:3d89509fadb7 | 364 | if(speed2!=0) |
shivanandgowdakr | 0:3d89509fadb7 | 365 | { |
shivanandgowdakr | 0:3d89509fadb7 | 366 | speedcount2++; |
shivanandgowdakr | 0:3d89509fadb7 | 367 | if(speedcount2==30/speed2) |
shivanandgowdakr | 0:3d89509fadb7 | 368 | { |
shivanandgowdakr | 0:3d89509fadb7 | 369 | speedcount2=0; |
shivanandgowdakr | 0:3d89509fadb7 | 370 | for(i=0;i<buffersize-1 ;i++) |
shivanandgowdakr | 0:3d89509fadb7 | 371 | { |
shivanandgowdakr | 0:3d89509fadb7 | 372 | dislay[1][i]= dislay[1][i+1]; |
shivanandgowdakr | 0:3d89509fadb7 | 373 | } |
shivanandgowdakr | 0:3d89509fadb7 | 374 | filled2--; |
shivanandgowdakr | 0:3d89509fadb7 | 375 | } |
shivanandgowdakr | 0:3d89509fadb7 | 376 | } |
shivanandgowdakr | 0:3d89509fadb7 | 377 | |
shivanandgowdakr | 0:3d89509fadb7 | 378 | //if(speed1==speed2&&speed1!=0) |
shivanandgowdakr | 0:3d89509fadb7 | 379 | filled--; |
shivanandgowdakr | 0:3d89509fadb7 | 380 | } |
shivanandgowdakr | 0:3d89509fadb7 | 381 | |
shivanandgowdakr | 0:3d89509fadb7 | 382 | void LedP10 ::slidesingle() |
shivanandgowdakr | 0:3d89509fadb7 | 383 | { |
shivanandgowdakr | 0:3d89509fadb7 | 384 | int i; |
shivanandgowdakr | 0:3d89509fadb7 | 385 | if(speed!=0) |
shivanandgowdakr | 0:3d89509fadb7 | 386 | { |
shivanandgowdakr | 0:3d89509fadb7 | 387 | speedcount++; |
shivanandgowdakr | 0:3d89509fadb7 | 388 | if(speedcount==30/speed) |
shivanandgowdakr | 0:3d89509fadb7 | 389 | { |
shivanandgowdakr | 0:3d89509fadb7 | 390 | speedcount=0; |
shivanandgowdakr | 0:3d89509fadb7 | 391 | for(i=0;i<buffersize-1 ;i++) |
shivanandgowdakr | 0:3d89509fadb7 | 392 | { |
shivanandgowdakr | 0:3d89509fadb7 | 393 | dislay[0][i]= dislay[0][i+1]; |
shivanandgowdakr | 0:3d89509fadb7 | 394 | dislay[1][i]= dislay[1][i+1]; |
shivanandgowdakr | 0:3d89509fadb7 | 395 | } |
shivanandgowdakr | 0:3d89509fadb7 | 396 | filled--; |
shivanandgowdakr | 0:3d89509fadb7 | 397 | } |
shivanandgowdakr | 0:3d89509fadb7 | 398 | } |
shivanandgowdakr | 0:3d89509fadb7 | 399 | else |
shivanandgowdakr | 0:3d89509fadb7 | 400 | { |
shivanandgowdakr | 0:3d89509fadb7 | 401 | speedcount++; |
shivanandgowdakr | 0:3d89509fadb7 | 402 | if(speedcount==30/speed) |
shivanandgowdakr | 0:3d89509fadb7 | 403 | { |
shivanandgowdakr | 0:3d89509fadb7 | 404 | speedcount=0; |
shivanandgowdakr | 0:3d89509fadb7 | 405 | for(i=0;i<buffersize-1 ;i++) |
shivanandgowdakr | 0:3d89509fadb7 | 406 | { |
shivanandgowdakr | 0:3d89509fadb7 | 407 | dislay[0][i]= dislay[0][i]; |
shivanandgowdakr | 0:3d89509fadb7 | 408 | dislay[1][i]= dislay[1][i]; |
shivanandgowdakr | 0:3d89509fadb7 | 409 | } |
shivanandgowdakr | 0:3d89509fadb7 | 410 | filled--; |
shivanandgowdakr | 0:3d89509fadb7 | 411 | } |
shivanandgowdakr | 0:3d89509fadb7 | 412 | } |
shivanandgowdakr | 0:3d89509fadb7 | 413 | } |
shivanandgowdakr | 0:3d89509fadb7 | 414 | void LedP10 :: showgroup(int p,int q) |
shivanandgowdakr | 0:3d89509fadb7 | 415 | { |
shivanandgowdakr | 0:3d89509fadb7 | 416 | int i,j,k,row,col,byt; |
shivanandgowdakr | 0:3d89509fadb7 | 417 | byte temp,data=0x00; |
shivanandgowdakr | 0:3d89509fadb7 | 418 | for(col=0;col<4*numberofpanels;col++) |
shivanandgowdakr | 0:3d89509fadb7 | 419 | { |
shivanandgowdakr | 0:3d89509fadb7 | 420 | row=12+p+2*q; |
shivanandgowdakr | 0:3d89509fadb7 | 421 | byt=row/8; |
shivanandgowdakr | 0:3d89509fadb7 | 422 | for(i=0;i<4;i++) |
shivanandgowdakr | 0:3d89509fadb7 | 423 | { |
shivanandgowdakr | 0:3d89509fadb7 | 424 | data=0x00; |
shivanandgowdakr | 0:3d89509fadb7 | 425 | for(k=0;k<8;k++) |
shivanandgowdakr | 0:3d89509fadb7 | 426 | { |
shivanandgowdakr | 0:3d89509fadb7 | 427 | data=data<<1; |
shivanandgowdakr | 0:3d89509fadb7 | 428 | temp=0x01; |
shivanandgowdakr | 0:3d89509fadb7 | 429 | temp&=(dislay[row/8][8*col+k]>>(row%8)); |
shivanandgowdakr | 0:3d89509fadb7 | 430 | data|=temp; |
shivanandgowdakr | 0:3d89509fadb7 | 431 | } |
shivanandgowdakr | 0:3d89509fadb7 | 432 | row-=4; |
shivanandgowdakr | 0:3d89509fadb7 | 433 | byt=row/8; |
shivanandgowdakr | 0:3d89509fadb7 | 434 | SPI.transfer(~data); |
shivanandgowdakr | 0:3d89509fadb7 | 435 | } |
shivanandgowdakr | 0:3d89509fadb7 | 436 | } |
shivanandgowdakr | 0:3d89509fadb7 | 437 | digitalWrite(outputenablepin,LOW); |
shivanandgowdakr | 0:3d89509fadb7 | 438 | LedP10 ::store(); |
shivanandgowdakr | 0:3d89509fadb7 | 439 | } |
shivanandgowdakr | 0:3d89509fadb7 | 440 | |
shivanandgowdakr | 0:3d89509fadb7 | 441 | void LedP10 :: showmsg_single_scroll(char msg_[],int no_of_times, int speed_, int font_) |
shivanandgowdakr | 0:3d89509fadb7 | 442 | { |
shivanandgowdakr | 0:3d89509fadb7 | 443 | if(font_==0) |
shivanandgowdakr | 0:3d89509fadb7 | 444 | font_lib=Arial_Black_16; |
shivanandgowdakr | 0:3d89509fadb7 | 445 | else if(font_==1) |
shivanandgowdakr | 0:3d89509fadb7 | 446 | font_lib=Arial_14; |
shivanandgowdakr | 0:3d89509fadb7 | 447 | scroll= no_of_times; |
shivanandgowdakr | 0:3d89509fadb7 | 448 | msg=msg_; |
shivanandgowdakr | 0:3d89509fadb7 | 449 | speed=speed_; |
shivanandgowdakr | 0:3d89509fadb7 | 450 | speed1=speed; |
shivanandgowdakr | 0:3d89509fadb7 | 451 | speed2=speed; |
shivanandgowdakr | 0:3d89509fadb7 | 452 | speedcount1=0; |
shivanandgowdakr | 0:3d89509fadb7 | 453 | speedcount2=0; |
shivanandgowdakr | 0:3d89509fadb7 | 454 | font=font_; |
shivanandgowdakr | 0:3d89509fadb7 | 455 | if(no_of_times<0) |
shivanandgowdakr | 0:3d89509fadb7 | 456 | always=1; |
shivanandgowdakr | 0:3d89509fadb7 | 457 | else |
shivanandgowdakr | 0:3d89509fadb7 | 458 | always=0; |
shivanandgowdakr | 0:3d89509fadb7 | 459 | Timer1.initialize(100); |
shivanandgowdakr | 0:3d89509fadb7 | 460 | Timer1.attachInterrupt(callback4); |
shivanandgowdakr | 0:3d89509fadb7 | 461 | } |
shivanandgowdakr | 0:3d89509fadb7 | 462 | |
shivanandgowdakr | 0:3d89509fadb7 | 463 | |
shivanandgowdakr | 0:3d89509fadb7 | 464 | |
shivanandgowdakr | 0:3d89509fadb7 | 465 | void LedP10 :: callback() |
shivanandgowdakr | 0:3d89509fadb7 | 466 | { |
shivanandgowdakr | 0:3d89509fadb7 | 467 | digitalWrite(outputenablepin,LOW); |
shivanandgowdakr | 0:3d89509fadb7 | 468 | LedP10 ::filldisplaysingle_static(); |
shivanandgowdakr | 0:3d89509fadb7 | 469 | LedP10 ::showone(); |
shivanandgowdakr | 0:3d89509fadb7 | 470 | |
shivanandgowdakr | 0:3d89509fadb7 | 471 | } |
shivanandgowdakr | 0:3d89509fadb7 | 472 | void LedP10 :: callback2() |
shivanandgowdakr | 0:3d89509fadb7 | 473 | { |
shivanandgowdakr | 0:3d89509fadb7 | 474 | digitalWrite(outputenablepin,LOW); |
shivanandgowdakr | 0:3d89509fadb7 | 475 | LedP10 ::filldisplaydouble_static(); |
shivanandgowdakr | 0:3d89509fadb7 | 476 | LedP10 ::showone(); |
shivanandgowdakr | 0:3d89509fadb7 | 477 | |
shivanandgowdakr | 0:3d89509fadb7 | 478 | } |
shivanandgowdakr | 0:3d89509fadb7 | 479 | void LedP10 :: showone() |
shivanandgowdakr | 0:3d89509fadb7 | 480 | { |
shivanandgowdakr | 0:3d89509fadb7 | 481 | if(x==0&&y==0) |
shivanandgowdakr | 0:3d89509fadb7 | 482 | { |
shivanandgowdakr | 0:3d89509fadb7 | 483 | LedP10 ::showgroup(0,0); |
shivanandgowdakr | 0:3d89509fadb7 | 484 | digitalWrite(a,LOW); |
shivanandgowdakr | 0:3d89509fadb7 | 485 | digitalWrite(b,LOW); |
shivanandgowdakr | 0:3d89509fadb7 | 486 | analogWrite(outputenablepin, brightness); |
shivanandgowdakr | 0:3d89509fadb7 | 487 | x=1;y=0; |
shivanandgowdakr | 0:3d89509fadb7 | 488 | } |
shivanandgowdakr | 0:3d89509fadb7 | 489 | else if(x==1&&y==0) |
shivanandgowdakr | 0:3d89509fadb7 | 490 | { |
shivanandgowdakr | 0:3d89509fadb7 | 491 | LedP10 ::showgroup(1,0); |
shivanandgowdakr | 0:3d89509fadb7 | 492 | digitalWrite(a,HIGH); |
shivanandgowdakr | 0:3d89509fadb7 | 493 | digitalWrite(b,LOW); |
shivanandgowdakr | 0:3d89509fadb7 | 494 | analogWrite(outputenablepin,brightness); |
shivanandgowdakr | 0:3d89509fadb7 | 495 | x=0;y=1; |
shivanandgowdakr | 0:3d89509fadb7 | 496 | } |
shivanandgowdakr | 0:3d89509fadb7 | 497 | else if(x==0&&y==1) |
shivanandgowdakr | 0:3d89509fadb7 | 498 | { |
shivanandgowdakr | 0:3d89509fadb7 | 499 | LedP10 ::showgroup(0,1); |
shivanandgowdakr | 0:3d89509fadb7 | 500 | digitalWrite(a,LOW); |
shivanandgowdakr | 0:3d89509fadb7 | 501 | digitalWrite(b,HIGH); |
shivanandgowdakr | 0:3d89509fadb7 | 502 | analogWrite(outputenablepin,brightness); |
shivanandgowdakr | 0:3d89509fadb7 | 503 | x=1;y=1; |
shivanandgowdakr | 0:3d89509fadb7 | 504 | } |
shivanandgowdakr | 0:3d89509fadb7 | 505 | else if(x==1&&y==1) |
shivanandgowdakr | 0:3d89509fadb7 | 506 | { |
shivanandgowdakr | 0:3d89509fadb7 | 507 | LedP10 ::showgroup(1,1); |
shivanandgowdakr | 0:3d89509fadb7 | 508 | digitalWrite(a,HIGH); |
shivanandgowdakr | 0:3d89509fadb7 | 509 | digitalWrite(b,HIGH); |
shivanandgowdakr | 0:3d89509fadb7 | 510 | analogWrite(outputenablepin, brightness); |
shivanandgowdakr | 0:3d89509fadb7 | 511 | x=0;y=0; |
shivanandgowdakr | 0:3d89509fadb7 | 512 | } |
shivanandgowdakr | 0:3d89509fadb7 | 513 | } |
shivanandgowdakr | 0:3d89509fadb7 | 514 | void LedP10 :: showmsg_single_static(long int msg_,int font_) |
shivanandgowdakr | 0:3d89509fadb7 | 515 | { |
shivanandgowdakr | 0:3d89509fadb7 | 516 | String thisString1 = String(msg_); |
shivanandgowdakr | 0:3d89509fadb7 | 517 | thisString1.toCharArray(sts_dis,thisString1.length()+1); |
shivanandgowdakr | 0:3d89509fadb7 | 518 | //free(&thisString1); |
shivanandgowdakr | 0:3d89509fadb7 | 519 | //showmsg_single_static(newmsg1,font_); |
shivanandgowdakr | 0:3d89509fadb7 | 520 | digitalWrite(outputenablepin,LOW); |
shivanandgowdakr | 0:3d89509fadb7 | 521 | Timer1.stop(); |
shivanandgowdakr | 0:3d89509fadb7 | 522 | if(font_==0) |
shivanandgowdakr | 0:3d89509fadb7 | 523 | font_lib=Arial_Black_16; |
shivanandgowdakr | 0:3d89509fadb7 | 524 | else if(font_==1) |
shivanandgowdakr | 0:3d89509fadb7 | 525 | font_lib=Arial_14; |
shivanandgowdakr | 0:3d89509fadb7 | 526 | msg=sts_dis; |
shivanandgowdakr | 0:3d89509fadb7 | 527 | font=font_; |
shivanandgowdakr | 0:3d89509fadb7 | 528 | filled=0; |
shivanandgowdakr | 0:3d89509fadb7 | 529 | Timer1.initialize(5500); |
shivanandgowdakr | 0:3d89509fadb7 | 530 | Timer1.attachInterrupt(callback); |
shivanandgowdakr | 0:3d89509fadb7 | 531 | LedP10 ::filldisplaysingle_static(); |
shivanandgowdakr | 0:3d89509fadb7 | 532 | } |
shivanandgowdakr | 0:3d89509fadb7 | 533 | |
shivanandgowdakr | 0:3d89509fadb7 | 534 | |
shivanandgowdakr | 0:3d89509fadb7 | 535 | |
shivanandgowdakr | 0:3d89509fadb7 | 536 | void LedP10 :: showmsg_single_static(char msg_[],int font_) |
shivanandgowdakr | 0:3d89509fadb7 | 537 | { |
shivanandgowdakr | 0:3d89509fadb7 | 538 | digitalWrite(outputenablepin,LOW); |
shivanandgowdakr | 0:3d89509fadb7 | 539 | Timer1.stop(); |
shivanandgowdakr | 0:3d89509fadb7 | 540 | if(font_==0) |
shivanandgowdakr | 0:3d89509fadb7 | 541 | font_lib=Arial_Black_16; |
shivanandgowdakr | 0:3d89509fadb7 | 542 | else if(font_==1) |
shivanandgowdakr | 0:3d89509fadb7 | 543 | font_lib=Arial_14; |
shivanandgowdakr | 0:3d89509fadb7 | 544 | msg=msg_; |
shivanandgowdakr | 0:3d89509fadb7 | 545 | font=font_; |
shivanandgowdakr | 0:3d89509fadb7 | 546 | filled=0; |
shivanandgowdakr | 0:3d89509fadb7 | 547 | Timer1.initialize(5500); |
shivanandgowdakr | 0:3d89509fadb7 | 548 | Timer1.attachInterrupt(callback); |
shivanandgowdakr | 0:3d89509fadb7 | 549 | LedP10 ::filldisplaysingle_static(); |
shivanandgowdakr | 0:3d89509fadb7 | 550 | } |
shivanandgowdakr | 0:3d89509fadb7 | 551 | void LedP10 :: showmsg_double_static(long int msg1_,long int msg2_,int font_) |
shivanandgowdakr | 0:3d89509fadb7 | 552 | { |
shivanandgowdakr | 0:3d89509fadb7 | 553 | String thisString1 = String(msg1_); |
shivanandgowdakr | 0:3d89509fadb7 | 554 | thisString1.toCharArray(sts_dis1,thisString1.length()+1); |
shivanandgowdakr | 0:3d89509fadb7 | 555 | String thisString2 = String(msg2_); |
shivanandgowdakr | 0:3d89509fadb7 | 556 | thisString2.toCharArray(sts_dis2,thisString2.length()+1); |
shivanandgowdakr | 0:3d89509fadb7 | 557 | showmsg_double_static(sts_dis1,sts_dis2, font_); |
shivanandgowdakr | 0:3d89509fadb7 | 558 | } |
shivanandgowdakr | 0:3d89509fadb7 | 559 | |
shivanandgowdakr | 0:3d89509fadb7 | 560 | void LedP10 :: showmsg_double_static(long int msg1_,char msg2_[],int font_) |
shivanandgowdakr | 0:3d89509fadb7 | 561 | { |
shivanandgowdakr | 0:3d89509fadb7 | 562 | String thisString1 = String(msg1_); |
shivanandgowdakr | 0:3d89509fadb7 | 563 | thisString1.toCharArray(sts_dis1,thisString1.length()+1); |
shivanandgowdakr | 0:3d89509fadb7 | 564 | |
shivanandgowdakr | 0:3d89509fadb7 | 565 | showmsg_double_static(sts_dis1,msg2_, font_); |
shivanandgowdakr | 0:3d89509fadb7 | 566 | } |
shivanandgowdakr | 0:3d89509fadb7 | 567 | |
shivanandgowdakr | 0:3d89509fadb7 | 568 | void LedP10 :: showmsg_double_static(char msg1_[],long int msg2_,int font_) |
shivanandgowdakr | 0:3d89509fadb7 | 569 | { |
shivanandgowdakr | 0:3d89509fadb7 | 570 | String thisString2 = String(msg2_); |
shivanandgowdakr | 0:3d89509fadb7 | 571 | thisString2.toCharArray(sts_dis2,thisString2.length()+1); |
shivanandgowdakr | 0:3d89509fadb7 | 572 | showmsg_double_static(msg1_,sts_dis2, font_); |
shivanandgowdakr | 0:3d89509fadb7 | 573 | } |
shivanandgowdakr | 0:3d89509fadb7 | 574 | void LedP10 :: showmsg_double_static(char msg1_[],char msg2_[],int font_) |
shivanandgowdakr | 0:3d89509fadb7 | 575 | { |
shivanandgowdakr | 0:3d89509fadb7 | 576 | digitalWrite(outputenablepin,LOW); |
shivanandgowdakr | 0:3d89509fadb7 | 577 | Timer1.stop(); |
shivanandgowdakr | 0:3d89509fadb7 | 578 | if(font_==0) |
shivanandgowdakr | 0:3d89509fadb7 | 579 | font_lib=font_lib=Led_half_1; |
shivanandgowdakr | 0:3d89509fadb7 | 580 | else if(font_==1) |
shivanandgowdakr | 0:3d89509fadb7 | 581 | {} |
shivanandgowdakr | 0:3d89509fadb7 | 582 | msg1=msg1_; |
shivanandgowdakr | 0:3d89509fadb7 | 583 | msg2=msg2_; |
shivanandgowdakr | 0:3d89509fadb7 | 584 | font=font_; |
shivanandgowdakr | 0:3d89509fadb7 | 585 | filled1=0; |
shivanandgowdakr | 0:3d89509fadb7 | 586 | filled2=0; |
shivanandgowdakr | 0:3d89509fadb7 | 587 | Timer1.initialize(6500); |
shivanandgowdakr | 0:3d89509fadb7 | 588 | Timer1.attachInterrupt(callback2); |
shivanandgowdakr | 0:3d89509fadb7 | 589 | LedP10 ::filldisplaydouble_static(); |
shivanandgowdakr | 0:3d89509fadb7 | 590 | } |
shivanandgowdakr | 0:3d89509fadb7 | 591 | void LedP10 :: callback3() |
shivanandgowdakr | 0:3d89509fadb7 | 592 | { |
shivanandgowdakr | 0:3d89509fadb7 | 593 | |
shivanandgowdakr | 0:3d89509fadb7 | 594 | LedP10 ::showone(); |
shivanandgowdakr | 0:3d89509fadb7 | 595 | if(x==1&&y==1) |
shivanandgowdakr | 0:3d89509fadb7 | 596 | LedP10 ::slide(); |
shivanandgowdakr | 0:3d89509fadb7 | 597 | LedP10 ::filldisplaydouble(); |
shivanandgowdakr | 0:3d89509fadb7 | 598 | |
shivanandgowdakr | 0:3d89509fadb7 | 599 | if(filled1==0&&filled2==0&&scroll1==0&&scroll2==0) |
shivanandgowdakr | 0:3d89509fadb7 | 600 | { |
shivanandgowdakr | 0:3d89509fadb7 | 601 | digitalWrite(outputenablepin,LOW); |
shivanandgowdakr | 0:3d89509fadb7 | 602 | Timer1.stop(); |
shivanandgowdakr | 0:3d89509fadb7 | 603 | } |
shivanandgowdakr | 0:3d89509fadb7 | 604 | } |
shivanandgowdakr | 0:3d89509fadb7 | 605 | void LedP10 :: callback4() |
shivanandgowdakr | 0:3d89509fadb7 | 606 | { |
shivanandgowdakr | 0:3d89509fadb7 | 607 | |
shivanandgowdakr | 0:3d89509fadb7 | 608 | LedP10 ::showone(); |
shivanandgowdakr | 0:3d89509fadb7 | 609 | if(x==1&&y==1) |
shivanandgowdakr | 0:3d89509fadb7 | 610 | { |
shivanandgowdakr | 0:3d89509fadb7 | 611 | LedP10 ::slidesingle(); |
shivanandgowdakr | 0:3d89509fadb7 | 612 | } |
shivanandgowdakr | 0:3d89509fadb7 | 613 | |
shivanandgowdakr | 0:3d89509fadb7 | 614 | filldisplaysingle(); |
shivanandgowdakr | 0:3d89509fadb7 | 615 | |
shivanandgowdakr | 0:3d89509fadb7 | 616 | if(filled==0&&scroll==0) |
shivanandgowdakr | 0:3d89509fadb7 | 617 | { |
shivanandgowdakr | 0:3d89509fadb7 | 618 | digitalWrite(outputenablepin,LOW); |
shivanandgowdakr | 0:3d89509fadb7 | 619 | Timer1.stop(); |
shivanandgowdakr | 0:3d89509fadb7 | 620 | } |
shivanandgowdakr | 0:3d89509fadb7 | 621 | } |
shivanandgowdakr | 0:3d89509fadb7 | 622 | void LedP10 :: showmsg_double_scroll(char msg1_[],char msg2_[],int no_of_times1,int no_of_times2, int speed1_,int speed2_, int font_) |
shivanandgowdakr | 0:3d89509fadb7 | 623 | { |
shivanandgowdakr | 0:3d89509fadb7 | 624 | if(font_==0) |
shivanandgowdakr | 0:3d89509fadb7 | 625 | font_lib=font_lib=Led_half_1; |
shivanandgowdakr | 0:3d89509fadb7 | 626 | else if(font_==1) |
shivanandgowdakr | 0:3d89509fadb7 | 627 | {} |
shivanandgowdakr | 0:3d89509fadb7 | 628 | msg1=msg1_; |
shivanandgowdakr | 0:3d89509fadb7 | 629 | msg2=msg2_; |
shivanandgowdakr | 0:3d89509fadb7 | 630 | speed1=speed1_; |
shivanandgowdakr | 0:3d89509fadb7 | 631 | speed2=speed2_; |
shivanandgowdakr | 0:3d89509fadb7 | 632 | font=font_; |
shivanandgowdakr | 0:3d89509fadb7 | 633 | scroll1= no_of_times1; |
shivanandgowdakr | 0:3d89509fadb7 | 634 | scroll2= no_of_times2; |
shivanandgowdakr | 0:3d89509fadb7 | 635 | if(scroll1<0) |
shivanandgowdakr | 0:3d89509fadb7 | 636 | always1=1; |
shivanandgowdakr | 0:3d89509fadb7 | 637 | else |
shivanandgowdakr | 0:3d89509fadb7 | 638 | always1=0; |
shivanandgowdakr | 0:3d89509fadb7 | 639 | if(scroll2<0) |
shivanandgowdakr | 0:3d89509fadb7 | 640 | always2=1; |
shivanandgowdakr | 0:3d89509fadb7 | 641 | else |
shivanandgowdakr | 0:3d89509fadb7 | 642 | always2=0; |
shivanandgowdakr | 0:3d89509fadb7 | 643 | LedP10 ::filldisplaydouble(); |
shivanandgowdakr | 0:3d89509fadb7 | 644 | Timer1.initialize(100); |
shivanandgowdakr | 0:3d89509fadb7 | 645 | Timer1.attachInterrupt(callback3); |
shivanandgowdakr | 0:3d89509fadb7 | 646 | } |
shivanandgowdakr | 0:3d89509fadb7 | 647 | |
shivanandgowdakr | 0:3d89509fadb7 | 648 | void LedP10 :: setbrightness(uint8_t brightness_) |
shivanandgowdakr | 0:3d89509fadb7 | 649 | { |
shivanandgowdakr | 0:3d89509fadb7 | 650 | brightness=brightness_; |
shivanandgowdakr | 0:3d89509fadb7 | 651 | } |