Skip to content

Commit 7ec9f4f

Browse files
Fixed some interrupt and keypad things
1 parent a869d99 commit 7ec9f4f

File tree

10 files changed

+57
-18
lines changed

10 files changed

+57
-18
lines changed

CEdev/examples/demo_7/src/main.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
void interrupt isr_timer1(void);
1919
void interrupt isr_on(void);
2020

21-
/* Global status flag */
22-
bool exit_loop = false;
2321
/* Location of memory-mapped screen */
2422
uint16_t *lcd_vramArray = (uint16_t*)0xD40000;
2523

Binary file not shown.
Binary file not shown.

CEdev/examples/library_examples/keypad/demo_2/src/main.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void interrupt isr_keyboard(void);
2222

2323
/* Global Flag */
2424
uint8_t exit_loop = false;
25-
25+
int a;
2626
/* Main Function */
2727
void main(void) {
2828
/* Initialize the interrupt handlers */
@@ -37,7 +37,7 @@ void main(void) {
3737
kb_EnableInt = KB_DATA_CHANGED;
3838

3939
/* Configure the keypad to be continously scanning */
40-
kb_Config = MODE_3_CONTINUOUS | DEFAULT_SCAN_CYCLES;
40+
kb_SetMode(MODE_3_CONTINUOUS);
4141

4242
/* Interrupts can now generate after this */
4343
int_Enable();
@@ -47,6 +47,7 @@ void main(void) {
4747

4848
/* Reset the interrupt handler and cleanup the program */
4949
int_Reset();
50+
kb_Reset();
5051
prgm_CleanUp();
5152
}
5253

@@ -71,5 +72,5 @@ void interrupt isr_keyboard(void) {
7172
/* Must acknowledge that the interrupt occured to clear the flag */
7273
int_Acknowledge = INT_KEYBOARD;
7374
/* Acknowledge in the keypad controller (Not technically required because interrupt controller handles signal) */
74-
//kb_IntAcknowledge = KB_DATA_CHANGED;
75+
kb_IntAcknowledge = KB_DATA_CHANGED;
7576
}
Binary file not shown.

CEdev/examples/library_examples/keypad/demo_3/src/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void main(void) {
3737
kb_EnableInt = KB_MODE_1_PRESS;
3838

3939
/* Configure the keypad to be continously scanning */
40-
kb_Config = MODE_1_INDISCRIMINATE | DEFAULT_SCAN_CYCLES;
40+
kb_SetMode(MODE_1_INDISCRIMINATE);
4141

4242
/* Interrupts can now generate after this */
4343
int_Enable();
@@ -47,6 +47,7 @@ void main(void) {
4747

4848
/* Reset the interrupt handler and cleanup the program */
4949
int_Reset();
50+
kb_Reset();
5051
prgm_CleanUp();
5152
}
5253

CEdev/include/lib/ce/keypadc.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,18 @@ void kb_Scan(void);
6868
*/
6969
void kb_Reset(void);
7070

71-
#define kb_EnableInt (*(uint8_t*)0xF5000C)
72-
#define kb_IntAcknowledge (*(volatile uint8_t*)0xF50008)
73-
#define kb_IntStatus (*(volatile uint8_t*)0xF50008)
74-
#define kb_Config (*(uint32_t*)0xF50000)
75-
#define kb_DataArray ((uint16_t*)0xF50010)
71+
#define kb_SetMode(mode) (kb_Config = (kb_Config & ~3)|mode)
7672

7773
#define MODE_0_IDLE (0)
7874
#define MODE_1_INDISCRIMINATE (1)
7975
#define MODE_2_SINGLE (2)
8076
#define MODE_3_CONTINUOUS (3)
81-
#define DEFAULT_SCAN_CYCLES (0x0F0F0000)
77+
78+
#define kb_EnableInt (*(uint8_t*)0xF5000C)
79+
#define kb_IntAcknowledge (*(volatile uint8_t*)0xF50008)
80+
#define kb_IntStatus (*(volatile uint8_t*)0xF50008)
81+
#define kb_Config (*(uint8_t*)0xF50000)
82+
#define kb_DataArray ((uint16_t*)0xF50010)
8283

8384
#define KB_SCAN_COMPLETE 1<<0
8485
#define KB_DATA_CHANGED 1<<1

CEdev/include/lib/ce/tice.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,41 @@
1515
/* RTC define -- useful for srand() */
1616
#define rtc_Time() (*(volatile uint32_t*)0xF30044)
1717

18+
/* RTC definitions */
19+
#define RTC_UNFREEZE (1<<7)
20+
#define RTC_FREEZE (0<<7)
21+
#define RTC_LOAD (1<<6)
22+
#define RTC_ALARM_INT_SOURCE (1<<5)
23+
#define RTC_DAY_INT_SOURCE (1<<4)
24+
#define RTC_HR_INT_SOURCE (1<<3)
25+
#define RTC_MIN_INT_SOURCE (1<<2)
26+
#define RTC_SEC_INT_SOURCE (1<<1)
27+
#define RTC_ENABLE (1<<0)|RTC_UNFREEZE
28+
#define RTC_DISABLE (0<<0)
29+
30+
#define RTC_LOAD_INT (1<<5)
31+
#define RTC_ALARM_INT (1<<4)
32+
#define RTC_DAY_INT (1<<3)
33+
#define RTC_HR_INT (1<<2)
34+
#define RTC_MIN_INT (1<<1)
35+
#define RTC_SEC_INT (1<<0)
36+
37+
#define rtc_Seconds (*(volatile uint8_t*)0xF30000)
38+
#define rtc_Minutes (*(volatile uint8_t*)0xF30004)
39+
#define rtc_Hours (*(volatile uint8_t*)0xF30008)
40+
#define rtc_Days (*(volatile uint16_t*)0xF3000C)
41+
#define rtc_AlarmSeconds (*(uint8_t*)0xF30010)
42+
#define rtc_AlarmMinutes (*(uint8_t*)0xF30014)
43+
#define rtc_AlarmHours (*(uint8_t*)0xF30018)
44+
#define rtc_Control (*(uint8_t*)0xF30020)
45+
#define rtc_LoadSeconds (*(uint8_t*)0xF30024)
46+
#define rtc_LoadMinutes (*(uint8_t*)0xF30028)
47+
#define rtc_LoadHours (*(uint8_t*)0xF3002C)
48+
#define rtc_LoadDays (*(uint16_t*)0xF30030)
49+
#define rtc_IntStatus (*(volatile uint8_t*)0xF30037)
50+
#define rtc_IntAcknowledge (*(volatile uint8_t*)0xF30034)
51+
#define rtc_IsBusy() (rtc_Control & RTC_LOAD)
52+
1853
/**
1954
* Resets the RTC back to its original values
2055
* If enable is true, the RTC will be enabled during this function

CEdev/lib/src/ce/interrupts.asm

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ intRtc equ 1000h
2525
;-------------------------------------------------------------------------------
2626
_int_Initialize:
2727
di
28+
ld de,lconf
29+
ld hl,mpIntMask
30+
ld bc,16
31+
ldir
2832
ld hl,cconf
2933
ld de,mpIntMask
3034
ld bc,16
@@ -125,12 +129,11 @@ _int_Reset:
125129
ldir
126130
im 1
127131
ret
128-
129-
lconf: db 011h,030h,000h,000h
132+
segment bss
133+
lconf: ds 16
134+
segment data
135+
cconf: ; Mask
130136
db 000h,000h,000h,000h
131-
db 019h,000h,000h,000h
132-
; Mask
133-
cconf: db 000h,000h,000h,000h
134137
; ACK
135138
db 0FFh,0FFh,0FFh,0FFh
136139
; Latch

CEdev/lib/src/libraries/fileio_src/v2/fileio_lib.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
.beginDependencies
3636
.endDependencies
3737

38-
resizeBytes equ 0E30C0Eh
38+
resizeBytes equ 0E30C0Ch
3939
currSlot equ 0E30C11h
4040
charIn equ 0E30C12h
4141

0 commit comments

Comments
 (0)