Fix whitespace

This commit is contained in:
Sam Kent 2018-07-06 16:57:59 +01:00
parent 36dff6e73f
commit e13d31c27a
6 changed files with 38 additions and 38 deletions

View file

@ -221,7 +221,7 @@ class MicroBitBLEManager : MicroBitComponent
void stopAdvertising();
/**
* A member function used to defer writes to flash, in order to prevent a write collision with
* A member function used to defer writes to flash, in order to prevent a write collision with
* softdevice.
* @param handle The handle offered by soft device during pairing.
* */
@ -312,7 +312,7 @@ class MicroBitBLEManager : MicroBitComponent
void showManagementModeAnimation(MicroBitDisplay &display);
#define MICROBIT_BLE_DISCONNECT_AFTER_PAIRING_DELAY 500
unsigned long pairing_completed_at_time;
unsigned long pairing_completed_at_time;
int pairingStatus;
ManagedString passKey;

View file

@ -83,17 +83,17 @@ DEALINGS IN THE SOFTWARE.
*
* All components should inherit from this class.
*
* If a component requires regular updates, then that component can be added to the
* If a component requires regular updates, then that component can be added to the
* to the systemTick and/or idleTick queues. This provides a simple, extensible mechanism
* for code that requires periodic/occasional background processing but does not warrant
* the complexity of maintaining its own thread.
* the complexity of maintaining its own thread.
*
* Two levels of support are available.
* Two levels of support are available.
*
* systemTick() provides a periodic callback during the
* micro:bit's system timer interrupt. This provides a guaranteed periodic callback, but in interrupt context
* and is suitable for code with lightweight processing requirements, but strict time constraints.
*
*
* idleTick() provides a periodic callback whenever the scheduler is idle. This provides occasional, callbacks
* in the main thread context, but with no guarantees of frequency. This is suitable for non-urgent background tasks.
*
@ -130,7 +130,7 @@ class MicroBitComponent
/**
* The idle thread will call this member function once the component has been added to the array
* of idle components using fiber_add_idle_component.
* of idle components using fiber_add_idle_component.
*/
virtual void idleTick()
{

View file

@ -79,10 +79,10 @@ DEALINGS IN THE SOFTWARE.
// Defines where in memory persistent data is stored.
#ifndef KEY_VALUE_STORE_PAGE
#define KEY_VALUE_STORE_PAGE (PAGE_SIZE * (NRF_FICR->CODESIZE - 17))
#define KEY_VALUE_STORE_PAGE (PAGE_SIZE * (NRF_FICR->CODESIZE - 17))
#endif
#ifndef BLE_BOND_DATA_PAGE
#ifndef BLE_BOND_DATA_PAGE
#define BLE_BOND_DATA_PAGE (PAGE_SIZE * (NRF_FICR->CODESIZE - 18))
#endif
@ -383,7 +383,7 @@ extern uint32_t __etext;
// Should be <= MBFS_BLOCK_SIZE.
//
#ifndef MBFS_CACHE_SIZE
#define MBFS_CACHE_SIZE 0
#define MBFS_CACHE_SIZE 0
#endif
//

View file

@ -42,7 +42,7 @@ class MicroBitFlash
* @return non-zero if erase required, zero otherwise.
*/
int need_erase(uint8_t* source, uint8_t* flash_addr, int len);
public:
/**
* Default constructor.
@ -53,12 +53,12 @@ class MicroBitFlash
* Writes the given number of bytes to the address in flash specified.
* Neither address nor buffer need be word-aligned.
* @param address location in flash to write to.
* @param buffer location in memory to write from.
* @param buffer location in memory to write from.
* @length number of bytes to burn
* @param scratch_addr if specified, scratch page to use. Use default
* @param scratch_addr if specified, scratch page to use. Use default
* otherwise.
* @return non-zero on sucess, zero on error.
*
*
* Example:
* @code
* MicroBitFlash flash();
@ -66,7 +66,7 @@ class MicroBitFlash
* flash.flash_write((uint8_t*)0x38000, &word, sizeof(word))
* @endcode
*/
int flash_write(void* address, void* buffer, int length,
int flash_write(void* address, void* buffer, int length,
void* scratch_addr = NULL);
/**
@ -78,8 +78,8 @@ class MicroBitFlash
/**
* Write to flash memory, assuming that a write is valid
* (using need_erase).
*
* @param page_address address of memory to write to.
*
* @param page_address address of memory to write to.
* Must be word aligned.
* @param buffer address to write from, must be word-aligned.
* @param len number of uint32_t words to write.

View file

@ -1,4 +1,6 @@
/*
The MIT License (MIT)
Copyright (c) 2016 British Broadcasting Corporation.
This software is provided by Lancaster University by arrangement with the BBC.
@ -269,7 +271,7 @@ void MicroBitBLEManager::advertise()
}
/**
* A member function used to defer writes to flash, in order to prevent a write collision with
* A member function used to defer writes to flash, in order to prevent a write collision with
* softdevice.
* @param handle The handle offered by soft device during pairing.
* */
@ -378,14 +380,12 @@ void MicroBitBLEManager::init(ManagedString deviceName, ManagedString serialNumb
// Configure the radio at our default power level
setTransmitPower(MICROBIT_BLE_DEFAULT_TX_POWER);
// Bring up core BLE services.
#if CONFIG_ENABLED(MICROBIT_BLE_DFU_SERVICE)
new MicroBitDFUService(*ble);
new MicroBitPartialFlashingService(*ble, messageBus);
#endif
#if CONFIG_ENABLED(MICROBIT_BLE_DEVICE_INFORMATION_SERVICE)
DeviceInformationService ble_device_information_service(*ble, MICROBIT_BLE_MANUFACTURER, MICROBIT_BLE_MODEL, serialNumber.toCharArray(), MICROBIT_BLE_HARDWARE_VERSION, MICROBIT_BLE_FIRMWARE_VERSION, MICROBIT_BLE_SOFTWARE_VERSION);
#else

View file

@ -57,14 +57,14 @@ static volatile bool flash_op_complete = false;
static void nvmc_event_handler(uint32_t evt)
{
if(evt == NRF_EVT_FLASH_OPERATION_SUCCESS)
if(evt == NRF_EVT_FLASH_OPERATION_SUCCESS)
flash_op_complete = true;
}
/**
* Default Constructor
*/
MicroBitFlash::MicroBitFlash()
MicroBitFlash::MicroBitFlash()
{
if (!evt_handler_registered)
{
@ -84,13 +84,13 @@ MicroBitFlash::MicroBitFlash()
* @param len number of uint8_t to check.
* @return non-zero if erase required, zero otherwise.
*/
int MicroBitFlash::need_erase(uint8_t* source, uint8_t* flash_addr, int len)
int MicroBitFlash::need_erase(uint8_t* source, uint8_t* flash_addr, int len)
{
// Erase is necessary if for any byte:
// O & ~N != 0
// Where O = original, and N = new byte.
for(;len>0;len--)
for(;len>0;len--)
{
if((~*(flash_addr++) & *(source++)) != 0x00) return 1;
}
@ -101,7 +101,7 @@ int MicroBitFlash::need_erase(uint8_t* source, uint8_t* flash_addr, int len)
* Erase an entire page
* @param page_address address of first word of page
*/
void MicroBitFlash::erase_page(uint32_t* pg_addr)
void MicroBitFlash::erase_page(uint32_t* pg_addr)
{
if (ble_running())
{
@ -111,7 +111,6 @@ void MicroBitFlash::erase_page(uint32_t* pg_addr)
if (sd_flash_page_erase(((uint32_t)pg_addr)/PAGE_SIZE) == NRF_SUCCESS)
break;
wait_ms(10);
}
// Wait for SoftDevice to diable the write operation when it completes...
@ -132,7 +131,7 @@ void MicroBitFlash::erase_page(uint32_t* pg_addr)
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) { }
}
}
/**
* Write to flash memory, assuming that a write is valid
* (using need_erase).
@ -142,8 +141,8 @@ void MicroBitFlash::erase_page(uint32_t* pg_addr)
* @param buffer address to write from, must be word-aligned.
* @param len number of uint32_t words to write.
*/
void MicroBitFlash::flash_burn(uint32_t* addr, uint32_t* buffer, int size)
{
void MicroBitFlash::flash_burn(uint32_t* addr, uint32_t* buffer, int size)
{
if (ble_running())
{
// Schedule SoftDevice to write this memory for us, and wait for it to complete.
@ -167,7 +166,7 @@ void MicroBitFlash::flash_burn(uint32_t* addr, uint32_t* buffer, int size)
NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos);
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {};
for(int i=0;i<size;i++)
for(int i=0;i<size;i++)
{
*(addr+i) = *(buffer+i);
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {};
@ -178,7 +177,7 @@ void MicroBitFlash::flash_burn(uint32_t* addr, uint32_t* buffer, int size)
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {};
}
}
/**
* Writes the given number of bytes to the address in flash specified.
* Neither address nor buffer need be word-aligned.
@ -196,7 +195,7 @@ void MicroBitFlash::flash_burn(uint32_t* addr, uint32_t* buffer, int size)
* flash.flash_write((uint8_t*)0x38000, &word, sizeof(word))
* @endcode
*/
int MicroBitFlash::flash_write(void* address, void* from_buffer,
int MicroBitFlash::flash_write(void* address, void* from_buffer,
int length, void* scratch_addr)
{
// If no scratch_addr has been supplied use the default
@ -205,7 +204,7 @@ int MicroBitFlash::flash_write(void* address, void* from_buffer,
// Ensure that scratch_addr is aligned on a page boundary.
if((uint32_t)scratch_addr & 0x3FF)
if((uint32_t)scratch_addr & 0x3FF)
return MICROBIT_INVALID_PARAMETER;
// Locate the hardware FLASH page used by this operation.
@ -221,7 +220,7 @@ int MicroBitFlash::flash_write(void* address, void* from_buffer,
int erase = need_erase((uint8_t *)from_buffer, (uint8_t *)address, length);
// Preserve the data by writing to the scratch page.
if(erase)
if(erase)
{
if (!scratch_addr)
return MICROBIT_INVALID_PARAMETER;
@ -237,21 +236,21 @@ int MicroBitFlash::flash_write(void* address, void* from_buffer,
uint32_t writeWord = 0;
for(int i=start;i<end;i++)
for(int i=start;i<end;i++)
{
int byteOffset = i%4;
if(i >= offset && i < (offset + length))
if(i >= offset && i < (offset + length))
{
// Write from buffer.
writeWord |= (((uint8_t *)from_buffer)[i-offset] << ((byteOffset)*8));
}
else
else
{
writeWord |= (writeFrom[i] << ((byteOffset)*8));
}
if( ((i+1)%4) == 0)
if( ((i+1)%4) == 0)
{
this->flash_burn(pgAddr + (i/4), &writeWord, 1);
writeWord = 0;
@ -260,3 +259,4 @@ int MicroBitFlash::flash_write(void* address, void* from_buffer,
return MICROBIT_OK;
}