/*********************************************************************************************************************** * Function Name: R_Systeminit * Description : This function initializes all peripherals used in this demo. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void R_Systeminit(void) { /* Configure port pin assignments */ PIOR = 0x00U; /* Configure the LCD */ R_LCD_Create(); /* Configure system clocks */ R_CGC_Create(); /* Configure ADC */ R_ADC_Create(); /* Configure timer unit 0 */ R_TAU0_Create(); /* Configure the interval timer */ R_IT_Create(); /* Configure RTC */ //R_RTC_Create(); /* Configure external interrupts */ R_INTC_Create(); /* Disable CRC operations */ CRC0CTL = 0x00U; /* Disable RAM and SFR protections */ IAWCTL = 0x00U; /* Disable RAM parity */ RPECTL = 0x80; }
/*********************************************************************************************************************** * Function Name: R_Systeminit * Description : This function initializes every macro. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void R_Systeminit(void) { volatile uint32_t w_count; PIOR0 = 0x00U; PIOR1 = 0x00U; R_CGC_Create(); R_PORT_Create(); R_SAU0_Create(); R_ADC_Create(); R_TAU0_Create(); R_RTC_Create(); R_PCLBUZ0_Create(); R_INTC_Create(); R_TMR_RJ0_Create(); R_TMR_RD0_Create(); IAWCTL = 0x00U; /* Start data flash control */ DFLEN = 1U; for (w_count = 0U; w_count < 6U; w_count++) { NOP(); } /* End data flash control */ }
/*********************************************************************************************************************** * Function Name: R_Systeminit * Description : This function initializes every macro. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void R_Systeminit(void) { PIOR0 = 0x00U; PIOR1 = 0x00U; R_CGC_Create(); R_PORT_Create(); R_SAU0_Create(); R_TAU0_Create(); IAWCTL = 0x00U; }
/*********************************************************************************************************************** * Function Name: R_Systeminit * Description : This function initializes every macro. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void R_Systeminit(void) { PIOR = 0x00U; R_CGC_Get_ResetSource(); R_CGC_Create(); R_PORT_Create(); R_TAU0_Create(); R_INTC_Create(); IAWCTL = 0x00U; }
/*********************************************************************************************************************** * Function Name: R_Systeminit * Description : This function initializes every macro. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void R_Systeminit(void) { PIOR = 0x00U; R_CGC_Get_ResetSource(); R_PORT_Create(); R_CGC_Create(); R_SAU0_Create(); R_IICA0_Create(); R_TAU0_Create(); R_IT_Create(); CRC0CTL = 0x00U; IAWCTL = 0x00U; }
/*********************************************************************************************************************** * Function Name: R_Systeminit * Description : This function initializes every macro. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void R_Systeminit(void) { PIOR0 = 0x00U; PIOR1 = 0x00U; R_PORT_Create(); R_CGC_Create(); R_SAU1_Create(); R_ADC_Create(); R_TAU0_Create(); R_IT_Create(); CRC0CTL = 0x00U; IAWCTL = 0x00U; PMS = 0x00U; }
/*********************************************************************************************************************** * Function Name: R_Systeminit * Description : This function initializes every macro. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void R_Systeminit(void) { PIOR = 0x00U; R_CGC_Get_ResetSource(); R_PORT_Create(); R_CGC_Create(); R_TAU0_Create(); R_TAU1_Create(); DMAC0_Create(); DMAC1_Create(); DMAC2_Create(); DMAC3_Create(); R_INTC_Create(); R_SAU0_Create(); R_UART1_Create(); CRC0CTL = 0x00U; IAWCTL = 0x00U; }
/*********************************************************************************************************************** * Function Name: main * Description : This function implements main function. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void main(void) { R_MAIN_UserInit(); /* Start user code. Do not edit comment generated here */ int transmit_count = 0; R_UART2_Create(); R_UART2_Start(); uart2Status = R_UART2_Receive(&uart2RxBuf[0],1); // Prime UART2 Rx R_TAU0_Create(); R_TAU0_Channel0_Start(); R_PORT_Create(); R_ADC_Create(); while (1U) { if(oneSec) { if(transmit) uart2Status = R_UART2_Send(uart2TxBuf, 1); counter++; oneSec = !oneSec; } if(uart2RxFlag) { uart2RxFlag = 0U; if(uart2RxBuf[0] == 'b') { uart2TxBuf[0] = counter; transmit_count = convertToNum(uart2TxBuf); //convert the ASCII symbols to integers instead. uart2Status = R_UART2_Send(uart2TxBuf, transmit_count); } else if(uart2RxBuf[0] == 'l') P7_bit.no7 = !P7_bit.no7; else if(uart2RxBuf[0] == 'a') { uint8_t adcvalue = 0; R_ADC_Start(); while(!adc_done_flag); //wait for interrupt adc_done_flag = 0; R_ADC_Get_Result_8bit(&adcvalue); uart2TxBuf[0] = adcvalue; transmit_count = convertToNum(uart2TxBuf); //convert the ASCII symbols to integers instead. R_ADC_Stop(); uart2Status = R_UART2_Send(uart2TxBuf, transmit_count); } else if(uart2RxBuf[0] == 't') transmit = !transmit; else uart2TxBuf[0] = uart2RxBuf[0]; // Prime UART2 Rx uart2Status = R_UART2_Receive(uart2RxBuf, 1); } //If a character has been transmitted if (uart2TxFlag) { // End of UART2 transmit uart2TxFlag = 0U; // clear tx flag } } R_UART2_Stop(); R_TAU0_Channel0_Stop(); //R_ADC_Stop(); /* End user code. Do not edit comment generated here */ }