static int eamp_init() { #if !defined(YDA165_SW_I2C) if(i2c_init) return 0; i2c_init=true; EAMP_PRINTK(""); //i2c_register_board_info(EAMP_I2C_CHANNEL,&eamp_dev,1); if (i2c_add_driver(&eamp_i2c_driver)){ EAMP_PRINTK("fail to add device into i2c"); return -1; } #else Init_i2c(); #endif eamp_poweron(); return 0; }
int32_t main(void){ gain g = { 0.0, 0.0, 0.0}; uint32_t index = 0; int32_t size; uint8_t data_rx[64]; uint8_t data_tx = 0x00; uint32_t start, end; //初期化開始 conio_init(57600UL); Init_timer(); InitLED(); rcin_enable(0); Init_i2c(); Init_fram(); Init_DT(); printf("Initialize OK.\r\n"); //初期化終了 i2c->Cfg.SlaveAddr = 0x42; i2c->Cfg.BaudRate = 400000; g.p_gain = read_float(0); g.i_gain = read_float(4); g.d_gain = read_float(8); printf("%f, %f, %f\r\n", g.p_gain, g.i_gain, g.d_gain); while(1){ } }
void main(void) { int8u dec_key; OSCTUNE = 0; OSCCON = 0b01100011;//0b01110011; //TRISA = 0b11000001; //TRISE = 0; //TRISC = 0b0111; TRISA=0b11000001; //TRISAbits.RA6=1; //TRISAbits.RA7=1; TRISC=0b0111; TRISE=0b000000000; TRISB7=0; TRISD3=0; TRISD2=0; TRISD1=0; TRISD0=1; TRISB0=0; TRISB1=0; TRISD4=0; TRISD5=0; TRISD6=0; TRISD7=0; USARTinit(); lcd_init(); Initcustom_char(); cur_gain = 0.25; /*strncpy( Lcd_LINE1 , Lcd_L1 , 16 ) ; strncpy( Lcd_LINE2 , Lcd_L2 , 16 ) ; Display(); strncpy( Lcd_LINE1 , Lcd_L3 , 16 ) ; strncpy( Lcd_LINE2 , Lcd_L4 , 16 ) ; Display();*/ //while(1); Adc_init(); Init_i2c(); Init_stat_isr(); Init_PWM(); dutyvolt = 0; dutycurrent = 0; Set_PWM_Duty(); /*while(1) { Display(); USARTWriteChar('U'); USARTWriteString(" Hi All\n\r"); dec_key = getkey();dispnum( dec_key ,1,2); Get_ADC_Count(); dispnum( ADC_Count,5,7); DelayMs(1000); }*/ FFT_ready_flag = 0; while(1) { if(FFT_ready_flag) { INT0IE = 0; Read_FFT(0,128); FFT_ready_flag = 0; Calc_percentageFull(); Disp_Mill_fill(); INT0IE = 1; } } }