sort of working

This commit is contained in:
Lucas Pleß 2018-01-14 19:16:26 +01:00
parent 4099b7dea9
commit bb11ddd447
2 changed files with 25 additions and 10 deletions

View file

@ -5,8 +5,8 @@
# Compiler options here.
ifeq ($(USE_OPT),)
# USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
USE_OPT = -ggdb -fomit-frame-pointer -falign-functions=16
USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
# USE_OPT = -ggdb -fomit-frame-pointer -falign-functions=16
endif
# C specific options here (added to USE_OPT).

View file

@ -32,7 +32,7 @@ THD_FUNCTION(dfiFunc, p) {
while(true) {
if(ST2MS(chVTTimeElapsedSinceX(last_time_simul)) > 20) {
if(ST2MS(chVTTimeElapsedSinceX(last_time_simul)) > 5) {
for(int dataline = 0; dataline < DATA_LINES; dataline++) {
@ -115,14 +115,20 @@ static void refreshDisplay(void *arg) {
palClearPort(GPIOD, 0xff00); // fets off
for (int w = 0; w < 125; w++); // wait ca 8µS
for (int w = 0; w < 125; w++) { // wait ca 8µS /7 125
asm ("nop");
}
palSetPad(GPIOE, GPIOE_PIN1); // latch high
for (int w = 0; w < 25; w++); // wait ca 1,6µS = 25
for (int w = 0; w < 25; w++) { // wait ca 1,6µS = 25
asm ("nop");
}
palClearPad(GPIOE, GPIOE_PIN1); // latch low
for (int w = 0; w < 13; w++); // wait ca 1µS
for (int w = 0; w < 13; w++) { // wait ca 1µS
asm ("nop");
}
// switch fets
//palSetPort(GPIOD, (1 << (fet+8)));
@ -160,10 +166,16 @@ void shiftOut(uint8_t val1, uint8_t val2, uint8_t val3,
palWritePad(GPIOE, GPIOE_PIN6, (val5 & (1 << i)) >> i);
palWritePad(GPIOE, GPIOE_PIN7, (val6 & (1 << i)) >> i);
palSetPad(GPIOE, GPIOE_PIN0); //clock
/* int val = ((val6 & (1 << i) >> i) << 7) |
((val5 & (1 << i) >> i) << 6) |
((val4 & (1 << i) >> i) << 5) |
((val3 & (1 << i) >> i) << 4) |
((val2 & (1 << i) >> i) << 3) |
((val1 & (1 << i) >> i) << 2);
asm ("nop");
asm ("nop"); asm ("nop");
palWriteGroup(GPIOE, 0b11111100, 0, val);
*/
palSetPad(GPIOE, GPIOE_PIN0); //clock
asm ("nop");
asm ("nop");
asm ("nop");
@ -171,6 +183,7 @@ void shiftOut(uint8_t val1, uint8_t val2, uint8_t val3,
asm ("nop");
asm ("nop");
palClearPad(GPIOE, GPIOE_PIN0); //clock
}
}
@ -182,6 +195,8 @@ void init_hw() {
palSetGroupMode(GPIOD, 0xff00, 0, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST);
palSetGroupMode(GPIOE, 0x00ff, 0, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST);
/*
// enable clock
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_GPIOE, ENABLE);