all aboard the God object!
This commit is contained in:
parent
70cc334eb2
commit
5c2477752e
|
@ -13,21 +13,14 @@
|
|||
|
||||
EXTERN_ENGINE;
|
||||
|
||||
// todo: move this into PinRepository class
|
||||
static const char *PIN_USED[BRAIN_PIN_TOTAL_PINS];
|
||||
|
||||
unsigned int getBrainPinTotalNum(void) {
|
||||
return BRAIN_PIN_TOTAL_PINS;
|
||||
}
|
||||
|
||||
void initBrainUsedPins(void) {
|
||||
memset(PIN_USED, 0, sizeof(PIN_USED));
|
||||
}
|
||||
|
||||
const char* & getBrainUsedPin(unsigned int idx DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
/*if (idx >= getBrainPinTotalNum())
|
||||
return NULL;*/
|
||||
return PIN_USED[idx];
|
||||
return ENGINE(pinRepository).PIN_USED[idx];
|
||||
}
|
||||
|
||||
/* Common for firmware and unit tests */
|
||||
|
@ -112,7 +105,7 @@ PinRepository::PinRepository() {
|
|||
msObjectInit(&portNameStream, (uint8_t*) portNameBuffer, sizeof(portNameBuffer), 0);
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
initBrainUsedPins();
|
||||
memset(PIN_USED, 0, sizeof(PIN_USED));
|
||||
}
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
|
|
|
@ -23,6 +23,7 @@ class PinRepository {
|
|||
*/
|
||||
PinRepository();
|
||||
int totalPinsUsed = 0;
|
||||
const char *PIN_USED[BRAIN_PIN_TOTAL_PINS];
|
||||
};
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
@ -55,7 +56,6 @@ ioportid_t getBrainPinPort(brain_pin_e brainPin);
|
|||
int getBrainPinIndex(brain_pin_e brainPin);
|
||||
unsigned int getBrainPinOnchipNum(void);
|
||||
unsigned int getBrainPinTotalNum(void);
|
||||
void initBrainUsedPins(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
const char* & getBrainUsedPin(unsigned int idx DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
|
|
Loading…
Reference in New Issue