Skip to content

Commit 46d5394

Browse files
MateoMateo
authored andcommitted
Added interrupt library and keypad interrupt config
Also added more and more demos
1 parent ab05a2d commit 46d5394

File tree

35 files changed

+815
-72
lines changed

35 files changed

+815
-72
lines changed

CEdev/bin/main_makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ endif
9494
#Define the nesassary headers, along with any the user may have defined, where modification should just trigger a build
9595
USERHEADERS := $(call WINPATH,$(foreach dir,$(ALLDIRS),$(wildcard $(dir)*.h)))
9696
HEADERS := $(subst $(space),;,$(call WINPATH,. $(ALLDIRS) $(addprefix $(CEDEV)/,. include include/asm include/lib/ce include/lib/std $(LIBLOC))))
97-
LIBRARIES := $(call WINPATH,$(addprefix $(CEDEV)/lib/std/,ce/ctice.lib ce/cdebug.lib chelp.lib crt.lib))
97+
LIBRARIES := $(call WINPATH,$(addprefix $(CEDEV)/lib/std/,ce/ctice.lib ce/cdebug.lib ce/cintce.lib chelp.lib crt.lib))
9898
ifneq ($(USE_FLASH_FUNCTIONS),NO)
9999
LIBRARIES += $(call WINPATH,$(addprefix $(CEDEV)/lib/std/,crt_linked.lib))
100100
else

CEdev/examples/demo_1/src/main.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
// stdarg.h, setjmp.h, assert.h, ctype.h, float.h, iso646.h, limits.h, errno.h, debug.h
1515

1616
/* Put function prototypes here */
17-
void fillScreen(unsigned color);
18-
void waitSeconds(uint8_t seconds);
17+
void fillScreen(uint8_t color);
1918

2019
/* Location of memory-mapped screen */
2120
uint16_t *lcd_vramArray = (uint16_t*)0xD40000;
@@ -39,7 +38,7 @@ void main(void) {
3938
}
4039

4140
/* Fill the screen with a given color */
42-
void fillScreen(unsigned color) {
41+
void fillScreen(uint8_t color) {
4342
/* memset_fast is a way faster implementation of memset; either one will work here though */
4443
memset_fast(lcd_vramArray, color, 320*240*2);
4544
}

CEdev/examples/demo_3/bin/DEMO3.8xp

-102 Bytes
Binary file not shown.

CEdev/examples/demo_4/bin/DEMO4.8xp

0 Bytes
Binary file not shown.

CEdev/examples/demo_6/bin/DEMO6.8xp

823 Bytes
Binary file not shown.

CEdev/examples/demo_6/iconc.png

910 Bytes
Loading

CEdev/examples/demo_6/makefile

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#----------------------------
2+
3+
#Change TARGET to specify the output program name
4+
#Change DEBUGMODE to "DEBUG" in order to compile debug.h functions in, and "NDEBUG" to not compile debugging functions
5+
#Change ARCHIVED to "YES" to mark the output as archived, and "NO" to not
6+
#Change APPVAR to "YES" to create the file as an AppVar, otherwise "NO" for programs
7+
#Change ICONPNG to change the name of the png file that should be made into the icon
8+
#Change DESCRIPTION to modify what is displayed within a compatible shell (Not compiled in if icon is not present)
9+
10+
#----------------------------
11+
TARGET ?= DEMO6
12+
DEBUGMODE ?= DEBUG
13+
ARCHIVED ?= NO
14+
APPVAR ?= NO
15+
#----------------------------
16+
ICONPNG := iconc.png
17+
DESCRIPTION ?= "C Toolchain Demo 6"
18+
#----------------------------
19+
20+
#Add shared library names to the L varible, for instance:
21+
# L := graphx fileioc keypadc
22+
L :=
23+
24+
#These directories specify where source and output should go
25+
26+
#----------------------------
27+
SRCDIR := src
28+
OBJDIR := obj
29+
BINDIR := bin
30+
GFXDIR := src/gfx
31+
#----------------------------
32+
33+
#This changes the location of compiled output (Advanced)
34+
35+
#----------------------------
36+
BSSHEAP_LOW := D031F6
37+
BSSHEAP_HIGH := D13FD6
38+
STACK_HIGH := D1A87E
39+
INIT_LOC := D1A87F
40+
#----------------------------
41+
42+
#Use the (slower) OS embedded functions (Advanced)
43+
44+
#----------------------------
45+
USE_FLASH_FUNCTIONS ?= YES
46+
#----------------------------
47+
48+
include $(CEDEV)/bin/main_makefile

CEdev/examples/demo_6/readme.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
-- Demo 6 ------------------------------------------------------------------------
2+
3+
This demo demonstrates how to use basic interrupts such as the [ON] key
4+
5+
-- Compiling ----------------------------------------------------------------------
6+
7+
To compile this demo project, simply run `make` within a shell in
8+
this directory. You can change the name or description for the demo like this:
9+
make TARGET=myprog DESCRIPTION="Some description here"
10+
11+
If you wish to easily delete all the created files outputted by make, type:
12+
make clean
13+
14+
----------------------------------------------------------------------------------
15+
16+
This demo is a part of the C SDK Toolcahin for use on the CE.

CEdev/examples/demo_6/src/main.c

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/* Keep these headers */
2+
#include <stdbool.h>
3+
#include <stddef.h>
4+
#include <stdint.h>
5+
#include <tice.h>
6+
7+
/* Standard headers - it's recommended to leave them included */
8+
#include <math.h>
9+
#include <stdio.h>
10+
#include <stdlib.h>
11+
#include <string.h>
12+
13+
/* Other available headers */
14+
// assert.h stdarg.h, setjmp.h, assert.h, ctype.h, float.h, iso646.h, limits.h, errno.h, debug.h
15+
#include <intce.h>
16+
17+
/* Place function prototypes here */
18+
void interrupt isr_on(void);
19+
20+
/* Global status flag */
21+
bool exit_loop = false;
22+
23+
/* Main function */
24+
void main(void) {
25+
/* Print a little string -- Note that using OS routines doesn't work too well when interrupts are actually running */
26+
prgm_CleanUp();
27+
os_SetCursorPos( 0, 0 );
28+
os_PutStrFull("Press ON");
29+
30+
/* Initialize the interrupt handlers */
31+
int_Initialize();
32+
33+
/* Set the isr_on routine to run when the [ON] key is pressed */
34+
int_SetVector(ON_IVECT, isr_on);
35+
36+
/* Tell the interrupt controller that the ON flag should latch and be enabled */
37+
int_LatchConfig = int_EnableConfig = INT_ON;
38+
39+
/* Interrupts can now generate after this */
40+
int_Enable();
41+
42+
/* Wait for the [ON] key to be pressed */
43+
while( !exit_loop );
44+
45+
/* Reset the interrupt handler and cleanup the program */
46+
int_Reset();
47+
prgm_CleanUp();
48+
}
49+
50+
/* Interrupt routine to run when the [ON] key is pressed */
51+
void interrupt isr_on(void) {
52+
/* Exit the "infinite" loop */
53+
exit_loop = true;
54+
55+
/* Must acknowledge that the interrupt occured to clear the flag */
56+
int_Acknowledge = INT_ON;
57+
}

CEdev/examples/demo_7/bin/DEMO7.8xp

1 KB
Binary file not shown.

0 commit comments

Comments
 (0)