added random number generator driver and stuff

This commit is contained in:
Thomas Klaehn
2016-08-30 17:04:22 +02:00
parent b777ab9e6f
commit d7e6f8b0ee
11 changed files with 233 additions and 6 deletions

38
source/test/rng/main.c Normal file
View File

@@ -0,0 +1,38 @@
/*
* main.c
*
* Created on: Aug 2, 2016
* Author: tkl
*/
#include <stdbool.h>
#include <string.h>
#include <stdio.h>
#include "driver.h"
#include "board.h"
#include "stack.h"
#include "queue.h"
#include "kernel.h"
#include "driver.h"
#include "list.h"
#include "shell.h"
int main(void)
{
char print_buffer[50];
shell_init(&uart_1);
drv_open(&rng);
while(1) {
int random = drv_read(&rng, NULL, 0);
sprintf(print_buffer, "random: %d\r\n", random);
shell_write(print_buffer, strlen(print_buffer));
sleep_ms(1000);
}
return 0;
}

1
source/test/rng/rng.mk Normal file
View File

@@ -0,0 +1 @@
SRC_DIR += source/test/rng