备份新仓库
This commit is contained in:
+6
-95
@@ -18,32 +18,10 @@
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
#include "main_task.h"
|
||||
#include "drv_i2c.h"
|
||||
#include "drv_tim.h"
|
||||
#include "drv_adc.h"
|
||||
#include "drv_led.h"
|
||||
#include "drv_key.h"
|
||||
#include "drv_uart.h"
|
||||
|
||||
|
||||
#include "pmw3901.h"
|
||||
|
||||
|
||||
/* Global typedef */
|
||||
|
||||
/* Global define */
|
||||
|
||||
/* Global Variable */
|
||||
uint8_t Red_Count = 0;
|
||||
uint8_t Green_Count = 0;
|
||||
uint8_t Blue_Count = 0;
|
||||
|
||||
uint8_t tx[20] = "123467890asdfghjklq";
|
||||
uint8_t rx[150] = {0};
|
||||
|
||||
/*********************************************************************
|
||||
* @fn main
|
||||
@@ -54,83 +32,16 @@ uint8_t rx[150] = {0};
|
||||
*/
|
||||
int main(void)
|
||||
{
|
||||
uint32_t tick = 0;
|
||||
|
||||
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
|
||||
|
||||
//USART_Printf_Init(115200);
|
||||
//printf("SystemClk:%d\t\n", SystemCoreClock);
|
||||
//硬件初始化
|
||||
bsp_init();
|
||||
|
||||
|
||||
//ÍâÉè³õʼ»¯
|
||||
led_init();
|
||||
tim_init();
|
||||
adc_init();
|
||||
key_init();
|
||||
|
||||
usart_init();
|
||||
i2c_init();
|
||||
|
||||
//É豸³õʼ»¯
|
||||
pmw3901_init();
|
||||
|
||||
|
||||
|
||||
i2c_write(&i2c2, 0x00,tx, sizeof(tx));
|
||||
|
||||
delay_ms(500);
|
||||
|
||||
i2c_read(&i2c2, 0x00,rx, sizeof(tx));
|
||||
|
||||
tick = get_ticks();
|
||||
//主循环,
|
||||
main_loop();
|
||||
|
||||
while(1)
|
||||
{
|
||||
delay_ms(5);
|
||||
tick = get_ticks();
|
||||
|
||||
adc_thread(tick);
|
||||
key_thread();
|
||||
|
||||
/*
|
||||
size_t len = usart_read(&uart3, rx, sizeof(rx));
|
||||
|
||||
if (len) {
|
||||
usart_write(&uart1, rx, len);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
pmw3901_thread();
|
||||
|
||||
|
||||
//usart_write(&uart1, tx, 20);
|
||||
|
||||
printf( "pmw3901 %f,%f,%f,%d\r\n",pmw3901_1.dx,pmw3901_1.dy,pmw3901_1.dz,pmw3901_1.quality);
|
||||
//printf("keys:%d,%d,%d,%d\n",keys[0],keys[1],keys[2],keys[3]);
|
||||
//printf("keys:%d,%d,%d,%d\tadc:%4.4f,%4.4f,%4.4f,%4.4f\t tick:%u\n",key1.state,key2.state,key3.state,key4.state, voltage.Voltage[0],voltage.Voltage[1],voltage.Voltage[2],voltage.Voltage[3],tick);
|
||||
|
||||
Red_Count += 1;
|
||||
Green_Count += 1;
|
||||
Blue_Count += 1;
|
||||
|
||||
if(Red_Count % 2){
|
||||
led_setToggle(0);
|
||||
|
||||
led_setToggle(3);
|
||||
led_setToggle(4);
|
||||
led_setToggle(5);
|
||||
led_setToggle(6);
|
||||
}
|
||||
|
||||
if(Green_Count % 3){
|
||||
led_setToggle(1);
|
||||
}
|
||||
|
||||
if(Blue_Count % 5){
|
||||
led_setToggle(2);
|
||||
}
|
||||
|
||||
//一般不能运行到这,如果运行到这肯定是程序有错
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user