Skip to content

Commit

Permalink
Misc updates from PIPBOY branch
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Dec 6, 2024
1 parent acf9482 commit 31ae87c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 20 deletions.
10 changes: 6 additions & 4 deletions libs/filesystem/fat_sd/sdio_diskio.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// USED FOR SDIO-BASED SD CARDS
/*
* @author: ickle
* @author: ickle
* @source: http://www.61ic.com/code/archiver/?tid-27986.html
*/

Expand Down Expand Up @@ -175,10 +175,12 @@ DRESULT disk_ioctl (
res = RES_OK;
break;

case GET_SECTOR_COUNT : // Get number of sectors on the disk (DWORD)
*(DWORD*)buff = 131072; // 4*1024*32 = 131072
case GET_SECTOR_COUNT : { // Get number of sectors on the disk (DWORD)
SD_CardInfo SDCardInfo;
SD_GetCardInfo(&SDCardInfo);
*(DWORD*)buff = SDCardInfo.CardCapacity>>9;
res = RES_OK;
break;
} break;

case GET_SECTOR_SIZE : // Get R/W sector size (WORD)
*(WORD*)buff = 512;
Expand Down
20 changes: 10 additions & 10 deletions libs/pipboy/stm32_i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,25 +174,25 @@ void STM32_I2S_Init() {
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA1, ENABLE);

GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13; // PB12=LRCK, PB13=SCLK
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;//100MHz
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Speed = GPIO_Low_Speed; // SCLK runs at 1.04 MHz - ST datasheet says "Low Speed" is OK at 8 MHz if VDD>2.7V and pin load capacitance < 10pF
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
GPIO_Init(GPIOB, &GPIO_InitStructure);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_6;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3 | GPIO_Pin_6; // PC2=ASDOUT (ouput from IC, so should not be set as STM32 output), PC3=DSDIN, PC6=MCLK
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;//100MHz
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Speed = GPIO_Low_Speed; // MCLK runs at 4.16 MHz - ST datasheet says "Low Speed" is OK at 8 MHz if VDD>2.7V and pin load capacitance < 10pF
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
GPIO_Init(GPIOC, &GPIO_InitStructure);

GPIO_PinAFConfig(GPIOB,GPIO_PinSource12,GPIO_AF_SPI2); // PB12,AF5 I2S_LRCK
GPIO_PinAFConfig(GPIOB,GPIO_PinSource13,GPIO_AF_SPI2); // PB13,AF5 I2S_SCLK
GPIO_PinAFConfig(GPIOC,GPIO_PinSource3,GPIO_AF_SPI2); // PC3 ,AF5 I2S_DACDATA
GPIO_PinAFConfig(GPIOC,GPIO_PinSource6,GPIO_AF_SPI2); // PC6 ,AF5 I2S_MCK
GPIO_PinAFConfig(GPIOC,GPIO_PinSource2,GPIO_AF_SPI3); // PC2 ,AF6 I2S_ADCDATA (AF6 apparently?)
GPIO_PinAFConfig(GPIOC,GPIO_PinSource3,GPIO_AF_SPI2); // PC3 ,AF5 I2S_DACDATA
GPIO_PinAFConfig(GPIOC,GPIO_PinSource6,GPIO_AF_SPI2); // PC6 ,AF5 I2S_MCK
GPIO_PinAFConfig(GPIOC,GPIO_PinSource2,GPIO_AF_SPI3); // PC2 ,AF6 I2S_ADCDATA (AF6 apparently?) - RB 2024-11-25: we're not using this, so should we remove it?

I2S_InitStructure.I2S_Mode=I2S_Mode_MasterTx;
I2S_InitStructure.I2S_Standard=I2S_Standard_Phillips;
Expand Down Expand Up @@ -231,7 +231,7 @@ void STM32_I2S_Kill() {
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_6;
GPIO_Init(GPIOC, &GPIO_InitStructure);
Expand Down
5 changes: 2 additions & 3 deletions src/jsinteractive.c
Original file line number Diff line number Diff line change
Expand Up @@ -1332,9 +1332,8 @@ void jsiCheckErrors() {
}
}


void jsiAppendStringToInputLine(const char *strToAppend) {
// Add the string to our input line
/// Add the given string to our input line
static void jsiAppendStringToInputLine(const char *strToAppend) {
jsiIsAboutToEditInputLine();

size_t strSize = 1;
Expand Down
4 changes: 2 additions & 2 deletions src/jsinteractive.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ typedef enum {
BUSY_INTERACTIVE = 1,
BUSY_TRANSMIT = 2,
// ??? = 4
} JsiBusyDevice;
} PACKED_FLAGS JsiBusyDevice;
/// Shows a busy indicator, if one is set up
void jsiSetBusy(JsiBusyDevice device, bool isBusy);

Expand All @@ -130,7 +130,7 @@ typedef enum {
JSI_SLEEP_AWAKE = 0,
JSI_SLEEP_ASLEEP = 1,
JSI_SLEEP_DEEP = 2,
} JsiSleepType;
} PACKED_FLAGS JsiSleepType;

/// Shows a sleep indicator, if one is set up
void jsiSetSleep(JsiSleepType isSleep);
Expand Down
2 changes: 1 addition & 1 deletion targets/stm32/jshardware.c
Original file line number Diff line number Diff line change
Expand Up @@ -1554,7 +1554,7 @@ void jshIdle() {
if (wasUSBConnected != USBConnected) {
wasUSBConnected = USBConnected;
if (USBConnected)
jshClearUSBIdleTimeout();
jshUSBReceiveLastActive = JSH_USB_MAX_INACTIVITY_TICKS; // set to max so we're not connected until the first data request
if (USBConnected && jsiGetConsoleDevice()!=EV_LIMBO) {
if (!jsiIsConsoleDeviceForced())
jsiSetConsoleDevice(EV_USBSERIAL, false);
Expand Down

0 comments on commit 31ae87c

Please sign in to comment.