Skip to content

Commit

Permalink
Merge pull request #1 from tainfante/master
Browse files Browse the repository at this point in the history
sending data: long time
  • Loading branch information
opetany93 authored Jan 20, 2018
2 parents ac20939 + 367e3d4 commit 3fb4c9b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,19 @@

int main()
{
unsigned long long time;

//time - 36 bits result

alt_putstr("KCC Project!\n");

// register the timer irq to be serviced by handle_timer_interrupt() function
// alt_irq_register(SYS_TIMER_IRQ, 0, handle_timer_interrupt);

while (1)
{
SendLong(time);

PIO_SetBit(LED_PORT, LED_0);
delayMs(400);
PIO_ClearBit(LED_PORT, LED_0);
Expand Down
16 changes: 16 additions & 0 deletions src/uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,19 @@ void sendData(uint8_t* data, uint16_t size)
sendByte((char)*data++);
}
}
void sendOneByte(uint8_t data)
{
sendByte((char) data);

}
void sendLong(unsigned long long time){
time=time|0x0000010000000000;

sendOneByte((uint8_t)((time >> 40)&0xFF));
sendOneByte((uint8_t)((time >> 32)&0xFF));
sendOneByte((uint8_t)((time >> 24)&0xFF));
sendOneByte((uint8_t)((time >> 16)&0xFF));
sendOneByte((uint8_t)((time >> 8)&0xFF));
sendOneByte((uint8_t)(time&0xFF));

}

0 comments on commit 3fb4c9b

Please sign in to comment.