[Horus] Mouse analogs hex values now OK

This commit is contained in:
Bertrand Songis
2016-06-25 08:36:51 +02:00
parent f69295b8f9
commit 6861d6c8a4
3 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -150,7 +150,7 @@ bool menuStatsAnalogs(evt_t event)
{
MENU("Analogs", STATS_ICONS, menuTabStats, e_StatsAnalogs, 0, { 0 });
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_MOUSE_ANALOGS; i++) {
for (uint8_t i=0; i<NUMBER_ANALOG; i++) {
coord_t y = MENU_CONTENT_TOP + (i/2)*FH;
coord_t x = MENUS_MARGIN_LEFT + (i & 1 ? LCD_W/2 : 0);
lcdDrawNumber(x, y, i+1, LEADING0|LEFT, 2, NULL, ":");
+2 -2
View File
@@ -119,8 +119,8 @@ void adcInit()
ADC3->SQR2 = 0;
ADC3->SQR3 = ADC_IN_MOUSE1 + (ADC_IN_MOUSE2<<5);
ADC3->SMPR1 = 0;
ADC3->SMPR2 = 3 + (3<<3); // TODO SAMPTIME constant
ADC->CCR = 0; // ADC_CCR_ADCPRE_0; Clock div 2
ADC3->SMPR2 = (ADC_SAMPTIME<<(3*ADC_IN_MOUSE1)) + (ADC_SAMPTIME<<(3*ADC_IN_MOUSE2));
ADC->CCR = 0;
// Enable the DMA channel here, DMA2 stream 1, channel 2
ADC_DMA_Stream->CR = DMA_SxCR_PL | DMA_SxCR_CHSEL_1 | DMA_SxCR_MSIZE_0 | DMA_SxCR_PSIZE_0 | DMA_SxCR_MINC;
+1
View File
@@ -130,6 +130,7 @@
#define ADC_IN_MOUSE2 7
#define ADC_DMA DMA2
#define ADC_DMA_Stream DMA2_Stream0
#define ADC_SAMPTIME 3
// Power
#define PWR_RCC_AHB1Periph RCC_AHB1Periph_GPIOJ