参考main.c
#include "sys.h"
#include "delay.h"
#include "usart.h"
#include "timer.h"
#include "oled.h" /* oled */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "BH1750.h"
unsigned char BUF[8];
int dis_data;
int mcy;
float lightPower;
extern struct ds1302time time;
char xianshi[30];
u8 tmp_buf[33];
void display( void )
{
memset( xianshi, 0, sizeof(xianshi) );
sprintf( xianshi, "%02d:%02d:%02d", time.hour, time.minute, time.second );
OLED_P8x16Str( 0, 2, xianshi, 0 );
memset( xianshi, 0, sizeof(xianshi) );
sprintf( xianshi, "%.1f", lightPower );
OLED_P8x16Str( 0, 4, xianshi, 0 );
}
|