mirror of
https://github.com/isometimes/rpi4-osdev
synced 2024-11-22 10:10:45 +00:00
Added template to samples directory for ease of development
This commit is contained in:
parent
e7af63ed34
commit
88e258e685
2 changed files with 57 additions and 4 deletions
57
part12-wgt/samples/template.c
Normal file
57
part12-wgt/samples/template.c
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
#include "include/wgt.h"
|
||||||
|
#include "include/mem.h"
|
||||||
|
#include "include/multicore.h"
|
||||||
|
|
||||||
|
// ######## REQUIRED FUNCTIONS ########
|
||||||
|
|
||||||
|
unsigned long state0 = 1000;
|
||||||
|
unsigned long state1 = 2000;
|
||||||
|
|
||||||
|
unsigned long rand(void)
|
||||||
|
{
|
||||||
|
unsigned long s1 = state0;
|
||||||
|
unsigned long s0 = state1;
|
||||||
|
|
||||||
|
state0 = s0;
|
||||||
|
s1 ^= s1 << 23;
|
||||||
|
s1 ^= s1 >> 17;
|
||||||
|
s1 ^= s0;
|
||||||
|
s1 ^= s0 >> 26;
|
||||||
|
state1 = s1;
|
||||||
|
|
||||||
|
return state0 + state1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ######## STUB FUNCTIONS ########
|
||||||
|
|
||||||
|
unsigned int kb = 0;
|
||||||
|
|
||||||
|
unsigned int kbhit(void) {
|
||||||
|
kb++;
|
||||||
|
return kb / 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
void getch(void) {
|
||||||
|
wait_msec(0x500000);
|
||||||
|
kb = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ######## WGT EXAMPLES ########
|
||||||
|
|
||||||
|
void wgt37()
|
||||||
|
{
|
||||||
|
set_clock_rate(get_max_clock());
|
||||||
|
mem_init();
|
||||||
|
vga256 (); /* Initialize graphics mode */
|
||||||
|
|
||||||
|
start_core2(minit); // Start the comms engine (core 2)
|
||||||
|
while (!comms_up); // Wait for comms up
|
||||||
|
|
||||||
|
mdeinit (); /* Deinitialize the mouse handler */
|
||||||
|
}
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
wgt37();
|
||||||
|
while (1);
|
||||||
|
}
|
|
@ -38,10 +38,6 @@ void getch(void) {
|
||||||
|
|
||||||
// ######## WGT EXAMPLES ########
|
// ######## WGT EXAMPLES ########
|
||||||
|
|
||||||
#define NUM_IN 5 /* number of random points */
|
|
||||||
#define NUM_OUT 30 /* number of points of bezier curve */
|
|
||||||
/* Fewer points will make more chunky line */
|
|
||||||
|
|
||||||
int ox, oy; /* old mouse coordinates */
|
int ox, oy; /* old mouse coordinates */
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue