Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure header files and .cpp files use the codal namespace appropriately #437

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions inc/MicroBitBLEChar.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ DEALINGS IN THE SOFTWARE.

#include "MicroBitBLETypes.h"

namespace codal
{

/**
* Class definition for MicroBitBLEChar.
Expand Down Expand Up @@ -67,6 +69,7 @@ class MicroBitBLEChar
uint16_t cccd;
};

} // namespace codal

#endif
#endif
#endif // CONFIG_ENABLED(DEVICE_BLE)
#endif // MICROBIT_BLE_CHAR_H
8 changes: 6 additions & 2 deletions inc/MicroBitBLEService.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ DEALINGS IN THE SOFTWARE.

#include "MicroBitBLEChar.h"

namespace codal
{

/**
* Class definition for MicroBitBLEService.
* Provides a base class for the BLE sevices.
Expand Down Expand Up @@ -141,6 +144,7 @@ class MicroBitBLEService
static const uint8_t bs_base_uuid[16];
};

} // namespace codal

#endif
#endif
#endif // CONFIG_ENABLED(DEVICE_BLE)
#endif // MICROBIT_BLE_SERVICE_H
7 changes: 5 additions & 2 deletions inc/MicroBitBLEServices.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ DEALINGS IN THE SOFTWARE.
#define MICROBIT_BLE_SERVICES_OBSERVER_PRIO 2
#endif

namespace codal
{

/**
* Class definition for MicroBitBLEServices.
Expand Down Expand Up @@ -74,6 +76,7 @@ class MicroBitBLEServices
MicroBitBLEService *bs_services[ MICROBIT_BLE_SERVICES_MAX];
};

} // namespace codal

#endif
#endif
#endif // CONFIG_ENABLED(DEVICE_BLE)
#endif // MICROBIT_BLE_SERVICES_H
2 changes: 0 additions & 2 deletions inc/MicroBitDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,4 @@ namespace codal

extern codal::MicroBitDevice *microbit_device_instance;

using namespace codal;

#endif
5 changes: 5 additions & 0 deletions inc/MicroBitFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ DEALINGS IN THE SOFTWARE.
#define READ_AND_WRITE READ | WRITE
#define CREATE MB_CREAT

namespace codal
{

class MicroBitFile
{

Expand Down Expand Up @@ -192,4 +195,6 @@ class MicroBitFile
~MicroBitFile();
};

} // namespace codal

#endif
4 changes: 4 additions & 0 deletions inc/MicroBitFileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ DEALINGS IN THE SOFTWARE.
#define MBFS_BLOCK_TYPE_DIRECTORY 2
#define MBFS_BLOCK_TYPE_FILETABLE 3

namespace codal
{

//
// Every file in the file system has a file descriptor.
Expand Down Expand Up @@ -517,4 +519,6 @@ class MicroBitFileSystem
int createDirectory(char const *name);
};

} // namespace codal

#endif
5 changes: 5 additions & 0 deletions inc/MicroBitFlash.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ DEALINGS IN THE SOFTWARE.

#include "nrf.h"

namespace codal
{

class MicroBitFlash
{
private:
Expand Down Expand Up @@ -86,4 +89,6 @@ class MicroBitFlash

};

} // namespace codal

#endif
5 changes: 5 additions & 0 deletions inc/MicroBitMemoryMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ DEALINGS IN THE SOFTWARE.
#define REGION_MAKECODE 2
#define REGION_PYTHON 3

namespace codal
{

/**
* Structure definition for the reserved, noinit memory segment placed at the end of memory.
*/
Expand Down Expand Up @@ -142,4 +145,6 @@ class MicroBitMemoryMap
int processRecord(uint32_t *address);
};

} // namespace codal

#endif
5 changes: 5 additions & 0 deletions inc/MicroBitPowerManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ typedef struct {
#define CONFIG_MINIMUM_POWER_ON_TIME 500
#endif

namespace codal
{

/**
* Class definition for MicroBitPowerManager.
Expand Down Expand Up @@ -479,4 +481,7 @@ class MicroBitPowerManager : public CodalComponent
*/
int simpleDeepSleep( bool wakeOnTime, CODAL_TIMESTAMP wakeUpTime, bool wakeUpSources, NRF52Pin *wakeUpPin);
};

} // namespace codal

#endif
6 changes: 6 additions & 0 deletions inc/MicroBitUSBFlashManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ DEALINGS IN THE SOFTWARE.
#define MICROBIT_USB_FLASH_WRITE_CMD 0x0B // Perform a WRITE operation from applicaiton FLASH memory.
#define MICROBIT_USB_FLASH_ERASE_CMD 0x0C // Perform a ERASE operation from applicaiton FLASH memory.

namespace codal
{

typedef struct
{
ManagedString fileName; // MUST be in 8.3 format
Expand Down Expand Up @@ -290,4 +293,7 @@ class MicroBitUSBFlashManager : public CodalComponent, public NVMController
bool isValidChar(char c);

};

} // namespace codal

#endif
7 changes: 5 additions & 2 deletions inc/bluetooth/MicroBitAccelerometerService.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ DEALINGS IN THE SOFTWARE.
#include "MicroBitAccelerometer.h"
#include "EventModel.h"

namespace codal
{

/**
* Class definition for a MicroBit BLE Accelerometer Service.
Expand Down Expand Up @@ -110,6 +112,7 @@ class MicroBitAccelerometerService : public MicroBitBLEService
MicroBitBLEChar *characteristicPtr( int idx) { return &chars[ idx]; };
};

} // namespace codal

#endif
#endif
#endif // CONFIG_ENABLED(DEVICE_BLE)
#endif // MICROBIT_ACCELEROMETER_SERVICE_H
9 changes: 7 additions & 2 deletions inc/bluetooth/MicroBitBLEManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ DEALINGS IN THE SOFTWARE.
#define MICROBIT_MODE_PAIRING 0
#define MICROBIT_MODE_APPLICATION 1

namespace codal
{

class MicroBitBLEManager;
typedef MicroBitBLEManager BLEDevice;

Expand Down Expand Up @@ -322,6 +325,8 @@ class MicroBitBLEManager : public CodalComponent
bool advertiseOnDisconnect = true;
};

#endif
} // namespace codal

#endif
#endif // CONFIG_ENABLED(DEVICE_BLE)

#endif // MICROBIT_BLE_MANAGER_H
9 changes: 7 additions & 2 deletions inc/bluetooth/MicroBitBLETypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ DEALINGS IN THE SOFTWARE.
#include "ble.h"
#include "ble_gatts.h"

namespace codal
{

typedef uint32_t microbit_ble_ret_code_t;
typedef uint16_t microbit_gaphandle_t;
typedef uint16_t microbit_servicehandle_t;
Expand Down Expand Up @@ -142,6 +145,8 @@ extern microbit_ble_ret_code_t microbit_ble_on_error( microbit_ble_ret_code_t er
#define MICROBIT_BLE_ECHK( err) (err)
#endif

#endif
} // namespace codal

#endif
#endif // CONFIG_ENABLED(DEVICE_BLE)

#endif // MICROBIT_BLE_TYPES_H
7 changes: 5 additions & 2 deletions inc/bluetooth/MicroBitButtonService.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ DEALINGS IN THE SOFTWARE.
#include "MicroBitBLEService.h"
#include "EventModel.h"

namespace codal
{

/**
* Class definition for a MicroBit BLE Button Service.
Expand Down Expand Up @@ -102,6 +104,7 @@ class MicroBitButtonService : public MicroBitBLEService
MicroBitBLEChar *characteristicPtr( int idx) { return &chars[ idx]; };
};

} // namespace codal

#endif
#endif
#endif // CONFIG_ENABLED(DEVICE_BLE)
#endif // MICROBIT_BUTTON_SERVICE_H
9 changes: 7 additions & 2 deletions inc/bluetooth/MicroBitEddystone.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ DEALINGS IN THE SOFTWARE.

#include "MicroBitBLEManager.h"

namespace codal
{

/**
* Class definition for the MicroBitEddystone.
*
Expand Down Expand Up @@ -109,5 +112,7 @@ class MicroBitEddystone
static MicroBitEddystone *_instance;
};

#endif
#endif
} // namespace codal

#endif // CONFIG_ENABLED(DEVICE_BLE)
#endif // MICROBIT_EDDYSTONE_H
7 changes: 5 additions & 2 deletions inc/bluetooth/MicroBitEventService.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ DEALINGS IN THE SOFTWARE.
#include "MicroBitEvent.h"
#include "EventModel.h"

namespace codal
{

struct EventServiceEvent
{
Expand Down Expand Up @@ -121,6 +123,7 @@ class MicroBitEventService : public MicroBitBLEService, MicroBitComponent
MicroBitBLEChar *characteristicPtr( int idx) { return &chars[ idx]; };
};

} // namespace codal

#endif
#endif
#endif // CONFIG_ENABLED(DEVICE_BLE)
#endif // MICROBIT_EVENT_SERVICE_H
9 changes: 7 additions & 2 deletions inc/bluetooth/MicroBitIOPinService.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ DEALINGS IN THE SOFTWARE.
#define MICROBIT_IO_PIN_SERVICE_DATA_SIZE 10
#define MICROBIT_PWM_PIN_SERVICE_DATA_SIZE 2

namespace codal
{

/**
* Name value pair definition, as used to read and write pin values over BLE.
*/
Expand Down Expand Up @@ -172,5 +175,7 @@ class MicroBitIOPinService : public MicroBitBLEService, MicroBitComponent
MicroBitBLEChar *characteristicPtr( int idx) { return &chars[ idx]; };
};

#endif
#endif
} // namespace codal

#endif // CONFIG_ENABLED(DEVICE_BLE)
#endif // MICROBIT_IO_PIN_SERVICE_H
7 changes: 5 additions & 2 deletions inc/bluetooth/MicroBitLEDService.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ DEALINGS IN THE SOFTWARE.
// the maximum string length that can be scrolled via the BLE service.
#define MICROBIT_BLE_MAXIMUM_SCROLLTEXT 20

namespace codal
{

/**
* Class definition for the custom MicroBit LED Service.
Expand Down Expand Up @@ -98,6 +100,7 @@ class MicroBitLEDService : public MicroBitBLEService
MicroBitBLEChar *characteristicPtr( int idx) { return &chars[ idx]; };
};

} // namespace codal

#endif
#endif
#endif // CONFIG_ENABLED(DEVICE_BLE)
#endif // MICROBIT_LED_SERVICE_H
8 changes: 6 additions & 2 deletions inc/bluetooth/MicroBitMagnetometerService.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ DEALINGS IN THE SOFTWARE.
#define COMPASS_CALIBRATION_COMPLETED_OK 2
#define COMPASS_CALIBRATION_COMPLETED_ERR 3

namespace codal
{

/**
* Class definition for the MicroBit BLE Magnetometer Service.
Expand Down Expand Up @@ -138,5 +140,7 @@ class MicroBitMagnetometerService : public MicroBitBLEService
MicroBitBLEChar *characteristicPtr( int idx) { return &chars[ idx]; };
};

#endif
#endif
} // namespace codal

#endif // CONFIG_ENABLED(DEVICE_BLE)
#endif // MICROBIT_MAGNETOMETER_SERVICE_H
7 changes: 5 additions & 2 deletions inc/bluetooth/MicroBitPartialFlashingService.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ DEALINGS IN THE SOFTWARE.
#define MICROBIT_STATUS 0xEE
#define MICROBIT_RESET 0xFF

namespace codal
{

/**
* Class definition for the custom MicroBit Partial Flash Service.
Expand Down Expand Up @@ -129,6 +131,7 @@ class MicroBitPartialFlashingService : public MicroBitBLEService
MicroBitBLEChar *characteristicPtr( int idx) { return &chars[ idx]; };
};

} // namespace

#endif
#endif
#endif // CONFIG_ENABLED(DEVICE_BLE)
#endif // MICROBIT_PARTIAL_FLASH_SERVICE_H
7 changes: 5 additions & 2 deletions inc/bluetooth/MicroBitTemperatureService.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ DEALINGS IN THE SOFTWARE.
#include "MicroBitThermometer.h"
#include "EventModel.h"

namespace codal
{

/**
* Class definition for the custom MicroBit Temperature Service.
Expand Down Expand Up @@ -106,6 +108,7 @@ class MicroBitTemperatureService : public MicroBitBLEService
MicroBitBLEChar *characteristicPtr( int idx) { return &chars[ idx]; };
};

} // namespace codal

#endif
#endif
#endif // CONFIG_ENABLED(DEVICE_BLE)
#endif // MICROBIT_TEMPERATURE_SERVICE_H
Loading
Loading