mirror of
https://github.com/libretro/Mu.git
synced 2026-07-20 15:46:45 +00:00
Actually reading from ADS7846 but not correctly
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user