Uncrustify.
This commit is contained in:
parent
f576489c6e
commit
096ff72bd9
23
main.c
23
main.c
|
@ -5,22 +5,22 @@ volatile unsigned char ticks = 0;
|
||||||
volatile unsigned char flag_1hz = 0;
|
volatile unsigned char flag_1hz = 0;
|
||||||
|
|
||||||
__attribute__((interrupt))
|
__attribute__((interrupt))
|
||||||
void wdti_handler(void)
|
void
|
||||||
|
wdti_handler(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((interrupt))
|
__attribute__((interrupt))
|
||||||
void it_handler(void)
|
void
|
||||||
|
it_handler(void)
|
||||||
{
|
{
|
||||||
++ticks;
|
++ticks;
|
||||||
LED1 ^= 1;
|
LED1 ^= 1;
|
||||||
if (0 == (0x07 & ticks))
|
if(0 == (0x07 & ticks)) {
|
||||||
{
|
|
||||||
flag_1hz = 1;
|
flag_1hz = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int
|
||||||
int main(void)
|
main(void)
|
||||||
{
|
{
|
||||||
asm ("di");
|
asm ("di");
|
||||||
/* Setup LEDs */
|
/* Setup LEDs */
|
||||||
|
@ -34,8 +34,9 @@ int main(void)
|
||||||
CKC.ckc = 0x00U;
|
CKC.ckc = 0x00U;
|
||||||
/* Delay 1 second */
|
/* Delay 1 second */
|
||||||
register unsigned long int i;
|
register unsigned long int i;
|
||||||
for (i = 0x000FFFFFUL; i; --i)
|
for(i = 0x000FFFFFUL; i; --i) {
|
||||||
asm ("nop");
|
asm ("nop");
|
||||||
|
}
|
||||||
OSMC.osmc = 0x00; /* Supply fsub to peripherals, including Interval Timer */
|
OSMC.osmc = 0x00; /* Supply fsub to peripherals, including Interval Timer */
|
||||||
uart0_init();
|
uart0_init();
|
||||||
/* Setup 12-bit interval timer */
|
/* Setup 12-bit interval timer */
|
||||||
|
@ -47,10 +48,8 @@ int main(void)
|
||||||
ITIF = 0; /* Clear interrupt request flag */
|
ITIF = 0; /* Clear interrupt request flag */
|
||||||
ITMK = 0; /* Enable IT interrupt */
|
ITMK = 0; /* Enable IT interrupt */
|
||||||
asm ("ei"); /* Enable interrupts */
|
asm ("ei"); /* Enable interrupts */
|
||||||
for(;;)
|
for(;;) {
|
||||||
{
|
if(flag_1hz) {
|
||||||
if (flag_1hz)
|
|
||||||
{
|
|
||||||
LED2 = 0;
|
LED2 = 0;
|
||||||
flag_1hz = 0;
|
flag_1hz = 0;
|
||||||
uart0_puts("Hello, RL78! [:");
|
uart0_puts("Hello, RL78! [:");
|
||||||
|
|
22
uart0.c
22
uart0.c
|
@ -2,7 +2,8 @@
|
||||||
#include <iodefine.h>
|
#include <iodefine.h>
|
||||||
#include <iodefine_ext.h>
|
#include <iodefine_ext.h>
|
||||||
|
|
||||||
void uart0_init(void)
|
void
|
||||||
|
uart0_init(void)
|
||||||
{
|
{
|
||||||
/* Reference R01AN0459EJ0100 or hardware manual for details */
|
/* Reference R01AN0459EJ0100 or hardware manual for details */
|
||||||
PIOR.pior = 0U; /* Disable IO redirection */
|
PIOR.pior = 0U; /* Disable IO redirection */
|
||||||
|
@ -71,13 +72,12 @@ void uart0_init(void)
|
||||||
SS0.ss0 |= 0x03U; /* Enable UART0 operation (both channels) */
|
SS0.ss0 |= 0x03U; /* Enable UART0 operation (both channels) */
|
||||||
STIF0 = 1; /* Set buffer empty interrupt request flag */
|
STIF0 = 1; /* Set buffer empty interrupt request flag */
|
||||||
}
|
}
|
||||||
|
int
|
||||||
int uart0_puts(const char __far * s)
|
uart0_puts(const char __far *s)
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
SMR00.smr00 |= 0x0001U; /* Set buffer empty interrupt */
|
SMR00.smr00 |= 0x0001U; /* Set buffer empty interrupt */
|
||||||
while ('\0' != *s)
|
while('\0' != *s) {
|
||||||
{
|
|
||||||
while(0 == STIF0) ;
|
while(0 == STIF0) ;
|
||||||
STIF0 = 0;
|
STIF0 = 0;
|
||||||
SDR00.sdr00 = *s++;
|
SDR00.sdr00 = *s++;
|
||||||
|
@ -98,19 +98,19 @@ int uart0_puts(const char __far * s)
|
||||||
#endif
|
#endif
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((interrupt))
|
__attribute__((interrupt))
|
||||||
void st0_handler(void)
|
void
|
||||||
|
st0_handler(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((interrupt))
|
__attribute__((interrupt))
|
||||||
void sr0_handler(void)
|
void
|
||||||
|
sr0_handler(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is actually INTSRE0 interrupt handler */
|
/* This is actually INTSRE0 interrupt handler */
|
||||||
__attribute__((interrupt))
|
__attribute__((interrupt))
|
||||||
void tm01h_handler(void)
|
void
|
||||||
|
tm01h_handler(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue