Skip to content

Commit

Permalink
Merge pull request #8591 from 0xc0170/fix_coding_style_features
Browse files Browse the repository at this point in the history
features: fix coding style
  • Loading branch information
Cruz Monrreal authored Nov 9, 2018
2 parents 44ee9a7 + 20646d3 commit 9d95d46
Show file tree
Hide file tree
Showing 124 changed files with 1,511 additions and 1,402 deletions.
11 changes: 8 additions & 3 deletions .astyleignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@ cmsis
features/cryptocell
features/mbedtls
features/lwipstack/lwip
features/lwipstack/lwip-sys
rtos/TARGET_CORTEX/rtx4
features/storage/filesystem/littlefs/littlefs/
features/storage/filesystem/fat/ChaN
features/storage/FEATURE_STORAGE
features/frameworks
features/FEATURE_BLE/targets
features/FEATURE_BLE
features/unsupported/
features/netsocket/emac-drivers
hal/storage_abstraction
FEATURE_NANOSTACK/coap-service
FEATURE_NANOSTACK/sal-stack-nanostack
TESTS/mbed_hal/trng/pithy
features/nanostack/coap-service
features/nanostack/sal-stack-nanostack
rtos/TARGET_CORTEX/rtx5
TESTS/mbed_hal/trng/pithy
targets
components/802.15.4_RF
components/wifi
tools
5 changes: 3 additions & 2 deletions TESTS/mbed_hal/minimum_requirements/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static void minimum_data_test()
}


utest::v1::status_t greentea_test_setup(const size_t number_of_cases)
utest::v1::status_t greentea_test_setup(const size_t number_of_cases)
{
GREENTEA_SETUP(30, "default_auto");
return greentea_test_setup_handler(number_of_cases);
Expand All @@ -66,6 +66,7 @@ Case cases[] = {

Specification specification(greentea_test_setup, cases, greentea_test_teardown_handler);

int main() {
int main()
{
Harness::run(specification);
}
4 changes: 2 additions & 2 deletions TESTS/network/wifi/wifi_connect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void wifi_connect(void)
{
WiFiInterface *wifi = get_interface();

char ssid[SSID_MAX_LEN+1] = MBED_CONF_APP_WIFI_UNSECURE_SSID;
char ssid[SSID_MAX_LEN + 1] = MBED_CONF_APP_WIFI_UNSECURE_SSID;

TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->set_credentials(ssid, NULL));
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->connect());
Expand All @@ -42,7 +42,7 @@ void wifi_connect(void)
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->disconnect());

// Driver is expected to cache the credentials
memset(ssid, 0, SSID_MAX_LEN+1);
memset(ssid, 0, SSID_MAX_LEN + 1);

TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->connect());
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->disconnect());
Expand Down
46 changes: 23 additions & 23 deletions UNITTESTS/features/lorawan/loraphy/Test_LoRaPHY.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class my_LoRaPHY : public LoRaPHY {
phy_params.adr_ack_delay = 1;
}

virtual ~my_LoRaPHY()
virtual ~my_LoRaPHY()
{
}

Expand All @@ -40,19 +40,19 @@ class my_LoRaPHY : public LoRaPHY {
class my_radio : public LoRaRadio {
public:

virtual void init_radio(radio_events_t *events)
virtual void init_radio(radio_events_t *events)
{
};

virtual void radio_reset()
virtual void radio_reset()
{
};

virtual void sleep(void)
virtual void sleep(void)
{
};

virtual void standby(void)
virtual void standby(void)
{
};

Expand All @@ -62,31 +62,31 @@ class my_radio : public LoRaRadio {
uint16_t symb_timeout, bool fix_len,
uint8_t payload_len,
bool crc_on, bool freq_hop_on, uint8_t hop_period,
bool iq_inverted, bool rx_continuous)
bool iq_inverted, bool rx_continuous)
{
};

virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
uint32_t bandwidth, uint32_t datarate,
uint8_t coderate, uint16_t preamble_len,
bool fix_len, bool crc_on, bool freq_hop_on,
uint8_t hop_period, bool iq_inverted, uint32_t timeout)
uint8_t hop_period, bool iq_inverted, uint32_t timeout)
{
};

virtual void send(uint8_t *buffer, uint8_t size)
virtual void send(uint8_t *buffer, uint8_t size)
{
};

virtual void receive(void)
virtual void receive(void)
{
};

virtual void set_channel(uint32_t freq)
virtual void set_channel(uint32_t freq)
{
};

virtual uint32_t random(void)
virtual uint32_t random(void)
{
};

Expand All @@ -95,15 +95,15 @@ class my_radio : public LoRaRadio {
return uint8_value;
};

virtual void set_max_payload_length(radio_modems_t modem, uint8_t max)
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max)
{
};

virtual void set_public_network(bool enable)
virtual void set_public_network(bool enable)
{
};

virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len)
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len)
{
};

Expand All @@ -115,7 +115,7 @@ class my_radio : public LoRaRadio {
return bool_value;
};

virtual void start_cad(void)
virtual void start_cad(void)
{
};

Expand All @@ -124,15 +124,15 @@ class my_radio : public LoRaRadio {
return bool_value;
};

virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time)
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time)
{
};

virtual void lock(void)
virtual void lock(void)
{
};

virtual void unlock(void)
virtual void unlock(void)
{
};

Expand Down Expand Up @@ -422,10 +422,10 @@ TEST_F(Test_LoRaPHY, compute_rx_win_params)
list[0] = 125000;
object->get_phy_params().bandwidths.table = list;
uint8_t list2[1];
list2[0]= 12;
list2[0] = 12;
object->get_phy_params().datarates.table = &list2;
channel_params_t ch_lst[16];
memset(ch_lst, 0, sizeof(channel_params_t)*16);
memset(ch_lst, 0, sizeof(channel_params_t) * 16);
ch_lst[0].band = 0;
ch_lst[0].dr_range.fields.min = DR_0;
ch_lst[0].dr_range.fields.max = DR_5;
Expand Down Expand Up @@ -513,7 +513,7 @@ TEST_F(Test_LoRaPHY, link_ADR_request)

object->get_phy_params().max_channel_cnt = 16;
channel_params_t li[16];
memset(li, 0, sizeof(channel_params_t)*16);
memset(li, 0, sizeof(channel_params_t) * 16);
object->get_phy_params().channels.channel_list = li;
li[0].frequency = 0;
li[1].frequency = 5;
Expand Down Expand Up @@ -673,7 +673,7 @@ TEST_F(Test_LoRaPHY, set_next_channel)
ch = 5;
t1 = 16;
t2 = 32;
memset(b, 0, sizeof(band_t)*4);
memset(b, 0, sizeof(band_t) * 4);
object->get_phy_params().bands.size = 2;
object->get_phy_params().bands.table = &b;
b[0].off_time = 0;
Expand Down Expand Up @@ -767,7 +767,7 @@ TEST_F(Test_LoRaPHY, set_tx_cont_mode)

cw_mode_params_t p;
p.max_eirp = 0;
p.channel=0;
p.channel = 0;
p.tx_power = -1;
p.datarate = 0;
p.antenna_gain = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ class my_radio : public LoRaRadio {
uint8_t payload_len,
bool crc_on, bool freq_hop_on, uint8_t hop_period,
bool iq_inverted, bool rx_continuous)
{
{

};
};

virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
uint32_t bandwidth, uint32_t datarate,
Expand Down
66 changes: 42 additions & 24 deletions events/equeue/equeue_mbed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ using namespace mbed;
// Ticker operations
#if MBED_CONF_RTOS_PRESENT

unsigned equeue_tick() {
unsigned equeue_tick()
{
return osKernelGetTickCount();
}

Expand All @@ -55,20 +56,22 @@ unsigned equeue_tick() {
static bool equeue_tick_inited = false;
static volatile unsigned equeue_minutes = 0;
static unsigned equeue_timer[
(sizeof(ALIAS_TIMER)+sizeof(unsigned)-1)/sizeof(unsigned)];
(sizeof(ALIAS_TIMER) + sizeof(unsigned) - 1) / sizeof(unsigned)];
static unsigned equeue_ticker[
(sizeof(ALIAS_TICKER)+sizeof(unsigned)-1)/sizeof(unsigned)];
(sizeof(ALIAS_TICKER) + sizeof(unsigned) - 1) / sizeof(unsigned)];

static void equeue_tick_update() {
equeue_minutes += reinterpret_cast<ALIAS_TIMER*>(equeue_timer)->read_ms();
reinterpret_cast<ALIAS_TIMER*>(equeue_timer)->reset();
static void equeue_tick_update()
{
equeue_minutes += reinterpret_cast<ALIAS_TIMER *>(equeue_timer)->read_ms();
reinterpret_cast<ALIAS_TIMER *>(equeue_timer)->reset();
}

static void equeue_tick_init() {
static void equeue_tick_init()
{
MBED_STATIC_ASSERT(sizeof(equeue_timer) >= sizeof(ALIAS_TIMER),
"The equeue_timer buffer must fit the class Timer");
"The equeue_timer buffer must fit the class Timer");
MBED_STATIC_ASSERT(sizeof(equeue_ticker) >= sizeof(ALIAS_TICKER),
"The equeue_ticker buffer must fit the class Ticker");
"The equeue_ticker buffer must fit the class Ticker");
ALIAS_TIMER *timer = new (equeue_timer) ALIAS_TIMER;
ALIAS_TICKER *ticker = new (equeue_ticker) ALIAS_TICKER;

Expand All @@ -79,7 +82,8 @@ static void equeue_tick_init() {
equeue_tick_inited = true;
}

unsigned equeue_tick() {
unsigned equeue_tick()
{
if (!equeue_tick_inited) {
equeue_tick_init();
}
Expand All @@ -89,7 +93,7 @@ unsigned equeue_tick() {

do {
minutes = equeue_minutes;
ms = reinterpret_cast<ALIAS_TIMER*>(equeue_timer)->read_ms();
ms = reinterpret_cast<ALIAS_TIMER *>(equeue_timer)->read_ms();
} while (minutes != equeue_minutes);

return minutes + ms;
Expand All @@ -98,22 +102,28 @@ unsigned equeue_tick() {
#endif

// Mutex operations
int equeue_mutex_create(equeue_mutex_t *m) { return 0; }
int equeue_mutex_create(equeue_mutex_t *m)
{
return 0;
}
void equeue_mutex_destroy(equeue_mutex_t *m) { }

void equeue_mutex_lock(equeue_mutex_t *m) {
void equeue_mutex_lock(equeue_mutex_t *m)
{
core_util_critical_section_enter();
}

void equeue_mutex_unlock(equeue_mutex_t *m) {
void equeue_mutex_unlock(equeue_mutex_t *m)
{
core_util_critical_section_exit();
}


// Semaphore operations
#ifdef MBED_CONF_RTOS_PRESENT

int equeue_sema_create(equeue_sema_t *s) {
int equeue_sema_create(equeue_sema_t *s)
{
osEventFlagsAttr_t attr;
memset(&attr, 0, sizeof(attr));
attr.cb_mem = &s->mem;
Expand All @@ -123,15 +133,18 @@ int equeue_sema_create(equeue_sema_t *s) {
return !s->id ? -1 : 0;
}

void equeue_sema_destroy(equeue_sema_t *s) {
void equeue_sema_destroy(equeue_sema_t *s)
{
osEventFlagsDelete(s->id);
}

void equeue_sema_signal(equeue_sema_t *s) {
void equeue_sema_signal(equeue_sema_t *s)
{
osEventFlagsSet(s->id, 1);
}

bool equeue_sema_wait(equeue_sema_t *s, int ms) {
bool equeue_sema_wait(equeue_sema_t *s, int ms)
{
if (ms < 0) {
ms = osWaitForever;
}
Expand All @@ -142,29 +155,34 @@ bool equeue_sema_wait(equeue_sema_t *s, int ms) {
#else

// Semaphore operations
int equeue_sema_create(equeue_sema_t *s) {
int equeue_sema_create(equeue_sema_t *s)
{
*s = false;
return 0;
}

void equeue_sema_destroy(equeue_sema_t *s) {
void equeue_sema_destroy(equeue_sema_t *s)
{
}

void equeue_sema_signal(equeue_sema_t *s) {
void equeue_sema_signal(equeue_sema_t *s)
{
*s = 1;
}

static void equeue_sema_timeout(equeue_sema_t *s) {
static void equeue_sema_timeout(equeue_sema_t *s)
{
*s = -1;
}

bool equeue_sema_wait(equeue_sema_t *s, int ms) {
bool equeue_sema_wait(equeue_sema_t *s, int ms)
{
int signal = 0;
ALIAS_TIMEOUT timeout;
if (ms == 0) {
return false;
} else if (ms > 0) {
timeout.attach_us(callback(equeue_sema_timeout, s), (us_timestamp_t)ms*1000);
timeout.attach_us(callback(equeue_sema_timeout, s), (us_timestamp_t)ms * 1000);
}

core_util_critical_section_enter();
Expand Down
4 changes: 2 additions & 2 deletions features/cellular/TESTS/api/cellular_information/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ static void test_information_interface()
TEST_ASSERT(info->get_model(buf, kbuf_size) == NSAPI_ERROR_OK);
TEST_ASSERT(info->get_revision(buf, kbuf_size) == NSAPI_ERROR_OK);
TEST_ASSERT((info->get_serial_number(buf, kbuf_size, CellularInformation::SN) == NSAPI_ERROR_OK) ||
((((AT_CellularInformation *)info)->get_device_error().errType == 3) && // 3 == CME error from the modem
(((AT_CellularInformation *)info)->get_device_error().errCode == 4))); // 4 == "operation not supported"
((((AT_CellularInformation *)info)->get_device_error().errType == 3) && // 3 == CME error from the modem
(((AT_CellularInformation *)info)->get_device_error().errCode == 4))); // 4 == "operation not supported"

nsapi_error_t err = info->get_serial_number(buf, kbuf_size, CellularInformation::IMEI);
TEST_ASSERT(err == NSAPI_ERROR_UNSUPPORTED || err == NSAPI_ERROR_OK);
Expand Down
Loading

0 comments on commit 9d95d46

Please sign in to comment.