fix warning thanks to adbb9fb9bd

Schoumi 9 months ago
parent 457c572570
commit d5727decf3

@ -40,8 +40,8 @@ class MicroBitIO
{
public:
MicroBitPin pin[0];
MicroBitPin P0;
MicroBitPin *const pin;
MicroBitPin P0;
MicroBitPin P1;
MicroBitPin P2;
MicroBitPin P3;

@ -46,11 +46,14 @@ struct KeyValuePair
uint8_t value[MICROBIT_STORAGE_VALUE_SIZE];
};
struct KeyValueStore
struct KeyValueStoreData
{
uint32_t magic;
uint32_t size;
};
struct KeyValueStore : KeyValueStoreData
{
KeyValueStore(uint32_t magic, uint32_t size)
{
this->magic = magic;

@ -340,8 +340,8 @@ void microbit_free(void *mem)
if(SERIAL_DEBUG) SERIAL_DEBUG->printf("free: %p\n", mem);
#endif
// Sanity check.
if (memory == NULL)
return;
if (memory == NULL)
return;
// If this memory was created from a heap registered with us, free it.
for (int i=0; i < heap_count; i++)
@ -349,11 +349,11 @@ void microbit_free(void *mem)
if(memory > heap[i].heap_start && memory < heap[i].heap_end)
{
// The memory block given is part of this heap, so we can simply
// flag that this memory area is now free, and we're done.
// flag that this memory area is now free, and we're done.
if (*cb == 0 || *cb & MICROBIT_HEAP_BLOCK_FREE)
microbit_panic(MICROBIT_HEAP_ERROR);
*cb |= MICROBIT_HEAP_BLOCK_FREE;
*cb |= MICROBIT_HEAP_BLOCK_FREE;
return;
}
}
@ -427,4 +427,4 @@ int microbit_create_heap(uint32_t start, uint32_t end)
return MICROBIT_OK;
}
#endif
#endif

@ -47,6 +47,7 @@ MicroBitIO::MicroBitIO(int ID_P0, int ID_P1, int ID_P2,
int ID_P12,int ID_P13,int ID_P14,
int ID_P15,int ID_P16,int ID_P19,
int ID_P20) :
pin(&this->P0),
P0 (ID_P0, MICROBIT_PIN_P0, PIN_CAPABILITY_ALL), //P0 is the left most pad (ANALOG/DIGITAL/TOUCH)
P1 (ID_P1, MICROBIT_PIN_P1, PIN_CAPABILITY_ALL), //P1 is the middle pad (ANALOG/DIGITAL/TOUCH)
P2 (ID_P2, MICROBIT_PIN_P2, PIN_CAPABILITY_ALL), //P2 is the right most pad (ANALOG/DIGITAL/TOUCH)

@ -416,7 +416,7 @@ int MicroBitStorage::size()
KeyValueStore store = KeyValueStore();
//read our data!
memcpy(&store, flashBlockPointer, sizeof(KeyValueStore));
memcpy((KeyValueStoreData*)&store, flashBlockPointer, sizeof(KeyValueStoreData));
//if we haven't used flash before, we need to configure it
if(store.magic != MICROBIT_STORAGE_MAGIC)

Loading…
Cancel
Save