int main(void)
{
/* Define and initialize all Variables */
uint8_t memory_s[16]={1,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
uint8_t memory_r[16]={0};
/* Reset of all peripherals, Initializes the Systick. */
SystemTick_Init();
/* Initializes all peripherals clock you need */
SystemClock_Reconfig();
/* Initialize all configured peripherals */
GPIO_Init();
DMA_Init();
Timer1_Init();
OLED_Init();
ADCx_Init();
#if USED_IIC_SOFT
// I2C_WritePage(SLAVE_ADDRESS0,5,0,memory_s);
// delay_ms(100);
I2C_ReadPageBytes(SLAVE_ADDRESS0,5,0,memory_r);
#else
I2C1_Init();
delay_ms(10);
I2C_WriteOneByte(SLAVE_ADDRESS0,5,5,138);
#endif
/* trigger start ADCx_channels conversion */
adc_software_trigger_enable(ADC0, ADC_REGULAR_CHANNEL);
adc_software_trigger_enable(ADC2, ADC_REGULAR_CHANNEL);
while(1)
{
if(Module.LED_REFRESH)
{
gpio_bit_set(GPIOB,GPIO_PIN_4);
}
else
{
gpio_bit_reset(GPIOB,GPIO_PIN_4);
}
if(Module.OLED_REFRESH)
{
Module.OLED_REFRESH = 0;
// memory_r[3] = I2C_ReadOneByte(SLAVE_ADDRESS0,5,5);
I2C_ReadPageBytes(SLAVE_ADDRESS0,5,0,memory_r);
OLED_ShowNum(24,0,ADC0_Buffer[0][0],5,16);
OLED_ShowNum(24,2,ADC0_Buffer[2][0],5,16);
OLED_ShowNum(24,4,ADC2_Buffer[1][0],5,16);
OLED_ShowNum(24,6,memory_r[3],5,16);
OLED_ShowNum(96,0,ADC0_Buffer[1][0],4,16);
OLED_ShowNum(96,2,ADC2_Buffer[0][0],4,16);
OLED_ShowNum(96,4,memory_r[2],4,16);
OLED_ShowNum(96,6,memory_r[4],4,16);
}
}
return 0;
}