98 lines
1.6 KiB
C
98 lines
1.6 KiB
C
|
#include "utils_ctboard.h"
|
||
|
|
||
|
uint8_t getData7Segment(uint8_t digit);
|
||
|
uint16_t getData7SegmentTwoDigits(uint8_t digit);
|
||
|
|
||
|
int main(void) {
|
||
|
/* initializations go here */
|
||
|
uint8_t rotationSwitchData;
|
||
|
while (1) {
|
||
|
/*Connect LEDs to Switchs */
|
||
|
write_word(0x60000100, read_word(0x60000200));
|
||
|
/*Connect Rotation Switch to 7 Segment */
|
||
|
rotationSwitchData = read_byte(0x60000211) & 0x0F;
|
||
|
/*write_word(0x60000110, getData7Segment(rotationSwitchData) | 0xFFFF0000); */
|
||
|
write_byte(0x60000110, getData7Segment(rotationSwitchData));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
uint8_t getData7Segment(uint8_t digit) {
|
||
|
switch(digit) {
|
||
|
case 0x0:
|
||
|
return 0xC0;
|
||
|
case 0x1:
|
||
|
return 0xF9;
|
||
|
case 0x2:
|
||
|
return 0xA4;
|
||
|
case 0x3:
|
||
|
return 0xB0;
|
||
|
case 0x4:
|
||
|
return 0x99;
|
||
|
case 0x5:
|
||
|
return 0x92;
|
||
|
case 0x6:
|
||
|
return 0x82;
|
||
|
case 0x7:
|
||
|
return 0xF8;
|
||
|
case 0x8:
|
||
|
return 0x80;
|
||
|
case 0x9:
|
||
|
return 0x90;
|
||
|
case 0xA:
|
||
|
return 0x88;
|
||
|
case 0xB:
|
||
|
return 0x83;
|
||
|
case 0xC:
|
||
|
return 0xC6;
|
||
|
case 0xD:
|
||
|
return 0xA1;
|
||
|
case 0xE:
|
||
|
return 0x86;
|
||
|
case 0xF:
|
||
|
return 0x8E;
|
||
|
default:
|
||
|
return 0xFF;
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
uint16_t getData7SegmentTwoDigits(uint8_t digit) {
|
||
|
switch(digit) {
|
||
|
case 0x0:
|
||
|
return 0xFFC0;
|
||
|
case 0x1:
|
||
|
return 0xFFF9;
|
||
|
case 0x2:
|
||
|
return 0xFFA4;
|
||
|
case 0x3:
|
||
|
return 0xFFB0;
|
||
|
case 0x4:
|
||
|
return 0xFF99;
|
||
|
case 0x5:
|
||
|
return 0xFF92;
|
||
|
case 0x6:
|
||
|
return 0xFF82;
|
||
|
case 0x7:
|
||
|
return 0xFFF8;
|
||
|
case 0x8:
|
||
|
return 0xFF80;
|
||
|
case 0x9:
|
||
|
return 0xFF90;
|
||
|
case 0xA:
|
||
|
return 0xF9C0;
|
||
|
case 0xB:
|
||
|
return 0xF9F9;
|
||
|
case 0xC:
|
||
|
return 0xF9A4;
|
||
|
case 0xD:
|
||
|
return 0xF9B0;
|
||
|
case 0xE:
|
||
|
return 0xF999;
|
||
|
case 0xF:
|
||
|
return 0xF992;
|
||
|
default:
|
||
|
return 0xFFFF;
|
||
|
|
||
|
}
|
||
|
}
|