显示部分已驱动
This commit is contained in:
Binary file not shown.
+6303
-3103
File diff suppressed because it is too large
Load Diff
+933
-360
File diff suppressed because it is too large
Load Diff
@@ -1,2 +1,3 @@
|
|||||||
my_main.c:39:6:Send_to_595 24 static
|
my_main.c:35:6:Send_to_595 24 static
|
||||||
my_main.c:73:6:mymain 8 static
|
my_main.c:68:6:display 16 static
|
||||||
|
my_main.c:126:6:mymain 16 static
|
||||||
|
|||||||
+80
-8
@@ -15,12 +15,8 @@
|
|||||||
|
|
||||||
const char d_num_data[2][10]=
|
const char d_num_data[2][10]=
|
||||||
{
|
{
|
||||||
{
|
{0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f},
|
||||||
0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f
|
{0xed,0x48,0xe6,0x6e,0x4b,0x2f,0xaf,0x68,0xef,0x6f}
|
||||||
},
|
|
||||||
{
|
|
||||||
0xed,0x48,0xe6,0x6e,0x4b,0x2f,0xaf,0x68,0xef,0x6f
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct
|
struct
|
||||||
@@ -69,20 +65,96 @@ void Send_to_595(char h,char l)
|
|||||||
HC595_RCK(0);
|
HC595_RCK(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void display()
|
||||||
|
{
|
||||||
|
char h_buff=0,l_buff=0;
|
||||||
|
Send_to_595(h_buff,l_buff);
|
||||||
|
|
||||||
|
h_buff=0,l_buff=0;
|
||||||
|
h_buff=~0x01;
|
||||||
|
l_buff=d_num_data[0][dis_buff.d_num[0]];
|
||||||
|
if(dis_buff.dot1==1)
|
||||||
|
{
|
||||||
|
l_buff|=0x80;
|
||||||
|
}
|
||||||
|
Send_to_595(h_buff,l_buff);
|
||||||
|
|
||||||
|
h_buff=0,l_buff=0;
|
||||||
|
h_buff=~0x80;
|
||||||
|
l_buff=d_num_data[1][dis_buff.d_num[1]];
|
||||||
|
if(dis_buff.dot2==1)
|
||||||
|
{
|
||||||
|
l_buff|=0x10;
|
||||||
|
}
|
||||||
|
Send_to_595(h_buff,l_buff);
|
||||||
|
|
||||||
|
h_buff=0,l_buff=0;
|
||||||
|
h_buff=~0x40;
|
||||||
|
l_buff=d_num_data[0][dis_buff.d_num[2]];
|
||||||
|
if(dis_buff.dot3==1)
|
||||||
|
{
|
||||||
|
l_buff|=0x80;
|
||||||
|
}
|
||||||
|
Send_to_595(h_buff,l_buff);
|
||||||
|
|
||||||
|
h_buff=0,l_buff=0;
|
||||||
|
h_buff=0xC1;
|
||||||
|
l_buff=d_num_data[1][dis_buff.d_num[3]];
|
||||||
|
if(dis_buff.dot4==1)
|
||||||
|
{
|
||||||
|
l_buff|=0x10;
|
||||||
|
}
|
||||||
|
if(dis_buff.led_run==1)
|
||||||
|
{
|
||||||
|
h_buff|=0x10;
|
||||||
|
}
|
||||||
|
if(dis_buff.led_err==1)
|
||||||
|
{
|
||||||
|
h_buff|=0x08;
|
||||||
|
}
|
||||||
|
if(dis_buff.led_n==1)
|
||||||
|
{
|
||||||
|
h_buff|=0x04;
|
||||||
|
}
|
||||||
|
if(dis_buff.led_p==1)
|
||||||
|
{
|
||||||
|
h_buff|=0x02;
|
||||||
|
}
|
||||||
|
Send_to_595(h_buff,l_buff);
|
||||||
|
}
|
||||||
|
|
||||||
void mymain()
|
void mymain()
|
||||||
{
|
{
|
||||||
|
uint32_t runtime=0;
|
||||||
|
|
||||||
MOTA(0);
|
MOTA(0);
|
||||||
MOTB(0);
|
MOTB(0);
|
||||||
HC595_DCK(0);
|
HC595_DCK(0);
|
||||||
HC595_RCK(0);
|
HC595_RCK(0);
|
||||||
HC595_SCK(0);
|
HC595_SCK(0);
|
||||||
|
|
||||||
Send_to_595(0x00,0x6f);
|
|
||||||
dis_buff.d_num[0]=1;
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
|
if(HAL_GetTick()>runtime)
|
||||||
|
{
|
||||||
|
runtime+=1000;
|
||||||
|
|
||||||
|
dis_buff.d_num[0]=rand()%10;
|
||||||
|
dis_buff.d_num[1]=rand()%10;
|
||||||
|
dis_buff.d_num[2]=rand()%10;
|
||||||
|
dis_buff.d_num[3]=rand()%10;
|
||||||
|
dis_buff.dot1=rand()%2;
|
||||||
|
dis_buff.dot2=rand()%2;
|
||||||
|
dis_buff.dot3=rand()%2;
|
||||||
|
dis_buff.dot4=rand()%2;
|
||||||
|
dis_buff.led_err=rand()%2;
|
||||||
|
dis_buff.led_n=rand()%2;
|
||||||
|
dis_buff.led_p=rand()%2;
|
||||||
|
dis_buff.led_run=rand()%2;
|
||||||
|
}
|
||||||
|
|
||||||
|
display();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user