[X9D] Full use of the 16 grayscales.
[X9D] BMP 4bits support [X9D] Debug driver
This commit is contained in:
@@ -172,6 +172,9 @@ void boardInit()
|
||||
adcInit();
|
||||
delaysInit();
|
||||
audioInit();
|
||||
#if defined(DEBUG)
|
||||
debugInit();
|
||||
#endif
|
||||
|
||||
// TODO init_ppm() ;
|
||||
|
||||
@@ -184,7 +187,6 @@ void boardInit()
|
||||
__enable_irq() ;
|
||||
|
||||
eepromInit();
|
||||
uartInit();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -124,6 +124,7 @@ void eepromInit(); // TODO check it's not in another include
|
||||
void delaysInit();
|
||||
void adcInit();
|
||||
void audioInit();
|
||||
void debugInit();
|
||||
|
||||
void adcRead();
|
||||
void init_trainer_ppm();
|
||||
|
||||
@@ -34,16 +34,7 @@
|
||||
|
||||
#include "../open9x.h"
|
||||
|
||||
void uartSendChar(uint8_t c)
|
||||
{
|
||||
USART_SendData(UART_DEBUG, c);
|
||||
|
||||
/* Wait for end of previous transfer */
|
||||
while (USART_GetFlagStatus(UART_DEBUG, USART_FLAG_TC) == RESET);
|
||||
}
|
||||
|
||||
|
||||
void uartInit(void)
|
||||
void debugInit(void)
|
||||
{
|
||||
USART_InitTypeDef USART_InitStructure;
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
@@ -72,3 +63,10 @@ void uartInit(void)
|
||||
USART_Cmd(UART_DEBUG, ENABLE);
|
||||
}
|
||||
|
||||
void debugPutc(const char c)
|
||||
{
|
||||
USART_SendData(UART_DEBUG, c);
|
||||
|
||||
/* Wait for end of previous transfer */
|
||||
while (USART_GetFlagStatus(UART_DEBUG, USART_FLAG_TC) == RESET);
|
||||
}
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
#define PIN_TRIM_LV_UP GPIO_Pin_5 //PE.05
|
||||
|
||||
// Switchs
|
||||
#define PIN_SW_F GPIO_Pin_14 //PE.14
|
||||
#define PIN_SW_F GPIO_Pin_14 //PE.14
|
||||
#define PIN_SW_E_L GPIO_Pin_3 //PB.03
|
||||
#define PIN_SW_E_H GPIO_Pin_4 //PB.04
|
||||
#define PIN_SW_B_H GPIO_Pin_5 //PB.05
|
||||
|
||||
@@ -85,6 +85,8 @@ uint32_t readTrims()
|
||||
if (~c & PIN_TRIM_RH_R)
|
||||
result |= 0x80; // RH_R
|
||||
|
||||
// printf("readTrims(): %x %x => %x\n", c, e, result); fflush(stdout);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -105,14 +107,12 @@ void readKeysAndTrims()
|
||||
++enuk;
|
||||
}
|
||||
|
||||
#if !defined(SIMU)
|
||||
in = readTrims();
|
||||
|
||||
for (i = 1; i < 256; i <<= 1) {
|
||||
keys[enuk].input(in & i, (EnumKeys)enuk);
|
||||
++enuk;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t keyState(EnumKeys enuk)
|
||||
|
||||
@@ -23,6 +23,9 @@ void Set_Address(u8 x, u8 y)
|
||||
WriteCommand(((y>>4)&0x0F)|0x70); //Set Row Address MSB RA [7:4]
|
||||
}
|
||||
|
||||
#define PALETTE_IDX(p, x, mask) (((p[x] & mask) ? 0x1 : 0) + ((p[DISPLAY_PLAN_SIZE+x] & mask) ? 0x2 : 0) + ((p[2*DISPLAY_PLAN_SIZE+x] & mask) ? 0x4 : 0) + ((p[3*DISPLAY_PLAN_SIZE+x] & mask) ? 0x8 : 0))
|
||||
const uint8_t lcdPalette[4] = { 0, 0x03, 0x06, 0x0F };
|
||||
|
||||
void lcdRefresh()
|
||||
{
|
||||
for (uint8_t y=0; y<DISPLAY_H; y++) {
|
||||
@@ -31,8 +34,11 @@ void lcdRefresh()
|
||||
Set_Address(0, y);
|
||||
AspiCmd(0xAF);
|
||||
for (uint8_t x=0; x<DISPLAY_W; x+=2) {
|
||||
#if 1
|
||||
#if 0
|
||||
uint8_t data = (p[x] & mask ? 0x80 : 0) + (p[x+1] & mask ? 0x08 : 0) + (p[DISPLAY_PLAN_SIZE+x] & mask ? 0x40 : 0) + (p[DISPLAY_PLAN_SIZE+x+1] & mask ? 0x04 : 0);
|
||||
#elif 1
|
||||
uint8_t data = (PALETTE_IDX(p, x, mask) << 4) + (PALETTE_IDX(p, x+1, mask));
|
||||
//uint8_t data = (lcdPalette(PALETTE_IDX(p, x, mask)) << 4) + lcdPalette(PALETTE_IDX(p, x+1, mask));
|
||||
#else
|
||||
// this code shows the 16 grey tones...
|
||||
uint8_t data = (x * 16) / 212;
|
||||
|
||||
Reference in New Issue
Block a user