1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 06:15:16 +03:00

Update to incorporate hardware revision detection for BJF4 target

This commit is contained in:
blckmn 2016-07-30 11:27:04 +10:00
parent 22ded4fea0
commit 0e8d375a1c
8 changed files with 153 additions and 13 deletions

View file

@ -196,12 +196,26 @@ static bool m25p16_readIdentification()
* Attempts to detect a connected m25p16. If found, true is returned and device capacity can be fetched with
* m25p16_getGeometry().
*/
bool m25p16_init()
bool m25p16_init(ioTag_t csTag)
{
/*
if we have already detected a flash device we can simply exit
TODO: change the init param in favour of flash CFG when ParamGroups work is done
then cs pin can be specified in hardware_revision.c or config.c (dependent on revision).
*/
if (geometry.sectors) {
return true;
}
if (csTag) {
m25p16CsPin = IOGetByTag(csTag);
} else {
#ifdef M25P16_CS_PIN
m25p16CsPin = IOGetByTag(IO_TAG(M25P16_CS_PIN));
m25p16CsPin = IOGetByTag(IO_TAG(M25P16_CS_PIN));
#else return false;
#endif
}
IOInit(m25p16CsPin, OWNER_FLASH, RESOURCE_SPI_CS, 0);
IOConfigGPIO(m25p16CsPin, SPI_IO_CS_CFG);