generated from hulk/gd32e23x_template
new function
This commit is contained in:
41
src/main.c
41
src/main.c
@@ -9,12 +9,37 @@
|
||||
#include "gd32e23x.h"
|
||||
#include "systick.h"
|
||||
#include "gd32e23x_libopt.h"
|
||||
|
||||
#include "peripheral.h"
|
||||
|
||||
#include "RS485.h"
|
||||
#include "LDC1612.h"
|
||||
|
||||
void led_config(void)
|
||||
{
|
||||
rcu_periph_clock_enable(LED_RCU);
|
||||
|
||||
gpio_mode_set(LED_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, LED_PIN);
|
||||
gpio_output_options_set(LED_PORT, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, LED_PIN);
|
||||
gpio_bit_write(LED_PORT, LED_PIN, SET);
|
||||
|
||||
rcu_periph_clock_enable(LED_TIMER_RCU);
|
||||
timer_deinit(LED_TIMER);
|
||||
|
||||
timer_parameter_struct timer_initpara;
|
||||
timer_struct_para_init(&timer_initpara);
|
||||
timer_initpara.prescaler = 799;
|
||||
timer_initpara.alignedmode = TIMER_COUNTER_EDGE;
|
||||
timer_initpara.counterdirection = TIMER_COUNTER_UP;
|
||||
timer_initpara.period = 999;
|
||||
timer_initpara.clockdivision = TIMER_CKDIV_DIV1;
|
||||
timer_init(LED_TIMER, &timer_initpara);
|
||||
|
||||
timer_auto_reload_shadow_enable(LED_TIMER);
|
||||
timer_interrupt_enable(LED_TIMER, TIMER_INT_UP);
|
||||
|
||||
timer_enable(LED_TIMER);
|
||||
|
||||
nvic_irq_enable(LED_IRQ, 2);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief main function
|
||||
\param[in] none
|
||||
@@ -28,7 +53,7 @@ int main(void)
|
||||
RS485_config();
|
||||
led_config();
|
||||
|
||||
delay_ms(5000);
|
||||
// delay_ms(5000);
|
||||
printf("\r\n");
|
||||
printf("XLSW-3DP-LDC1612! V0.0.1\r\n");
|
||||
printf("\r\n");
|
||||
@@ -36,13 +61,11 @@ int main(void)
|
||||
LDC1612_I2CConfig();
|
||||
// LDC1612_Init();
|
||||
// I2C_Scan();
|
||||
int ret = 0;
|
||||
ret = LDC_getID();
|
||||
printf("ret:%d\r\n",ret);
|
||||
LDC1612_read_sensor_infomation();
|
||||
|
||||
|
||||
|
||||
|
||||
uint8_t data[2] = {0};
|
||||
uint32_t value = 0;
|
||||
|
||||
while(1){
|
||||
// LDC1612_read_reg(LDC1612_ADDR, 0x7f, data, 2);
|
||||
|
Reference in New Issue
Block a user