Пример #1
0
ICACHE_FLASH_ATTR struct shoutcast_info* getStation(uint8_t position) {
	uint8_t* buffer = malloc(256);
	if(buffer) {
		eeGetData((position+1)*256, buffer, 256);
		return (struct shoutcast_info*)buffer;
	} else return NULL;
}
Пример #2
0
ICACHE_FLASH_ATTR struct device_settings* getDeviceSettings() {
	uint8_t* buffer = malloc(256);
	if(buffer) {
		eeGetData(0, buffer, 256);
		return (struct device_settings*)buffer;
	} else return NULL;
}
Пример #3
0
ICACHE_FLASH_ATTR struct shoutcast_info* getStation(uint8_t position) {
	if (position > NBSTATIONS-1) {printf("getStation fails position=%d\n",position); return NULL;}
	uint8_t* buffer = malloc(256);
	while (buffer== NULL)
	{
		buffer = malloc(256);
        if ( buffer == NULL ){
			int i = 0;
			do { 
			i++;		
			printf ("Heap size: %d\n",xPortGetFreeHeapSize( ));
			vTaskDelay(10);
			printf("getstation malloc fails for %d\n",256 );
			}
			while (i<10);
			if (i >=10) { /*free(string);*/ return NULL;}
		} 		
	}
	eeGetData((position+1)*256, buffer, 256);
	return (struct shoutcast_info*)buffer;
}