Actually reading from ADS7846 but not correctly

This commit is contained in:
meepingsnesroms
2018-06-29 16:22:57 -07:00
parent 4adf636f3c
commit 4e63ca2340
2 changed files with 11 additions and 2 deletions

View File

@@ -63,6 +63,12 @@ uint16_t ads7846GetValue(uint8_t channel, Boolean referenceMode, Boolean mode8bi
config |= channel << 4 & 0x70;
/*misc configs from HwrADC*/
*((volatile uint8_t*)0xFFFFF431) &= 0xFB;
*((volatile uint8_t*)0xFFFFF420) |= 0x01;
*((volatile uint8_t*)0xFFFFF421) &= 0xFE;
*((volatile uint8_t*)0xFFFFF422) &= 0xFE;
/*enable SPI 2 if disabled*/
writeArbitraryMemory16(HW_REG_ADDR(SPICONT2), 0x4207);
@@ -83,6 +89,9 @@ uint16_t ads7846GetValue(uint8_t channel, Boolean referenceMode, Boolean mode8bi
/*disable SPI2*/
writeArbitraryMemory16(HW_REG_ADDR(SPICONT2), 0xE000);
/*misc configs from HwrADC*/
*((uint8_t*)0xFFFFF431) |= 0x04;
return value;
}

View File

@@ -371,8 +371,8 @@ uint8_t getHwRegister8(uint32_t address){
#endif
switch(address){
case PADATA:
//read outputs as is and inputs as true, floating pins are high
return (registerArrayRead8(PADATA) & registerArrayRead8(PADIR)) | ~registerArrayRead8(PADIR);
//not attached, used as data lines
return 0x00;
case PBDATA:
//read outputs as is and inputs as true, floating pins are high