nrf: Clean up source by removing tabs, trailing spaces, non-ASCII chars.

pull/5003/head
Damien George 2019-08-28 13:34:45 +10:00
rodzic 5635b96461
commit 1fe1ff935b
21 zmienionych plików z 70 dodań i 71 usunięć

Wyświetl plik

@ -256,15 +256,15 @@ static const uint16_t render_timings[] =
// The scale is (approximately) exponential,
// each step is approx x1.9 greater than the previous.
{ 0, // Bright, Ticks Duration, Relative power
2, // 1, 2, 32µs, inf
2, // 2, 4, 64µs, 200%
4, // 3, 8, 128µs, 200%
7, // 4, 15, 240µs, 187%
13, // 5, 28, 448µs, 187%
25, // 6, 53, 848µs, 189%
49, // 7, 102, 1632µs, 192%
97, // 8, 199, 3184µs, 195%
// Always on 9, 375, 6000µs, 188%
2, // 1, 2, 32us, inf
2, // 2, 4, 64us, 200%
4, // 3, 8, 128us, 200%
7, // 4, 15, 240us, 187%
13, // 5, 28, 448us, 187%
25, // 6, 53, 848us, 189%
49, // 7, 102, 1632us, 192%
97, // 8, 199, 3184us, 195%
// Always on 9, 375, 6000us, 188%
};
#define DISPLAY_TICKER_SLOT 1
@ -281,7 +281,7 @@ static int32_t callback(void) {
return -1;
}
display->previous_brightness = brightness;
// Return interval (in 16µs ticks) until next callback
// Return interval (in 16us ticks) until next callback
return render_timings[brightness];
}

Wyświetl plik

@ -962,7 +962,7 @@ const mp_obj_type_t microbit_facade_iterator_type = {
};
mp_obj_t microbit_facade_iterator(mp_obj_t iterable_in, mp_obj_iter_buf_t *iter_buf) {
(void)iter_buf;
(void)iter_buf;
facade_iterator_t *result = m_new_obj(facade_iterator_t);
string_image_facade_t *iterable = (string_image_facade_t *)iterable_in;
result->base.type = &microbit_facade_iterator_type;

Wyświetl plik

@ -418,7 +418,7 @@ bool ble_drv_advertise_data(ubluepy_advertise_data_t * p_adv_params) {
p_adv_params->p_device_name,
p_adv_params->device_name_len) != 0) {
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError,
"Can not apply device name in the stack."));
"Can not apply device name in the stack."));
}
BLE_DRIVER_LOG("Device name applied\n");

Wyświetl plik

@ -190,7 +190,7 @@ void ble_uart_init0(void) {
ble_uart_char_tx.service_handle = ble_uart_service.handle;
bool retval = ble_drv_characteristic_add(&ble_uart_char_tx);
if (retval) {
ble_uart_char_tx.p_service = &ble_uart_service;
ble_uart_char_tx.p_service = &ble_uart_service;
}
mp_obj_list_append(ble_uart_service.char_list, MP_OBJ_FROM_PTR(&ble_uart_char_tx));
@ -198,7 +198,7 @@ void ble_uart_init0(void) {
ble_uart_char_rx.service_handle = ble_uart_service.handle;
retval = ble_drv_characteristic_add(&ble_uart_char_rx);
if (retval) {
ble_uart_char_rx.p_service = &ble_uart_service;
ble_uart_char_rx.p_service = &ble_uart_service;
}
mp_obj_list_append(ble_uart_service.char_list, MP_OBJ_FROM_PTR(&ble_uart_char_rx));

Wyświetl plik

@ -35,7 +35,7 @@
#define __MICROPY_INCLUDED_LIB_TICKER_H__
/*************************************
* 62.5kHz (16µs cycle time) ticker.
* 62.5kHz (16us cycle time) ticker.
************************************/
#include "nrf.h"

Wyświetl plik

@ -28,6 +28,6 @@
#include "lib/oofatfs/ff.h"
DWORD get_fattime(void) {
// TODO: Implement this function. For now, fake it.
// TODO: Implement this function. For now, fake it.
return ((2016 - 1980) << 25) | ((12) << 21) | ((4) << 16) | ((00) << 11) | ((18) << 5) | (23 / 2);
}

Wyświetl plik

@ -185,8 +185,8 @@ pin_init0();
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_sd));
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_sd_slash_lib));
// use SD card as current directory
f_chdrive("/sd");
// use SD card as current directory
f_chdrive("/sd");
}
no_mem_for_sd:;
}
@ -293,18 +293,17 @@ MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open);
void HardFault_Handler(void)
{
#if defined(NRF52_SERIES)
static volatile uint32_t reg;
static volatile uint32_t reg2;
static volatile uint32_t bfar;
reg = SCB->HFSR;
reg2 = SCB->CFSR;
bfar = SCB->BFAR;
for (int i = 0; i < 0; i++)
{
(void)reg;
(void)reg2;
(void)bfar;
}
static volatile uint32_t reg;
static volatile uint32_t reg2;
static volatile uint32_t bfar;
reg = SCB->HFSR;
reg2 = SCB->CFSR;
bfar = SCB->BFAR;
for (int i = 0; i < 0; i++) {
(void)reg;
(void)reg2;
(void)bfar;
}
#endif
}

Wyświetl plik

@ -127,12 +127,12 @@ const pin_obj_t *pin_find(mp_obj_t user_obj) {
const pin_obj_t *pin_obj;
// If pin is SMALL_INT
if (mp_obj_is_small_int(user_obj)) {
uint8_t value = MP_OBJ_SMALL_INT_VALUE(user_obj);
uint8_t value = MP_OBJ_SMALL_INT_VALUE(user_obj);
for (uint8_t i = 0; i < machine_pin_num_of_pins; i++) {
if (machine_pin_obj[i].pin == value) {
return &machine_pin_obj[i];
}
}
}
}
}
// If a pin was provided, then use it
@ -365,7 +365,7 @@ STATIC mp_obj_t pin_obj_init_helper(const pin_obj_t *self, mp_uint_t n_args, con
// Connect input or not
nrf_gpio_pin_input_t input = (mode == NRF_GPIO_PIN_DIR_INPUT) ? NRF_GPIO_PIN_INPUT_CONNECT
: NRF_GPIO_PIN_INPUT_DISCONNECT;
: NRF_GPIO_PIN_INPUT_DISCONNECT;
if (mode == NRF_GPIO_PIN_DIR_OUTPUT || mode == NRF_GPIO_PIN_DIR_INPUT) {
nrf_gpio_cfg(self->pin,
@ -496,7 +496,7 @@ STATIC void pin_common_irq_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t
}
STATIC mp_obj_t pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum {ARG_handler, ARG_trigger, ARG_wake};
enum {ARG_handler, ARG_trigger, ARG_wake};
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_handler, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = mp_const_none} },
{ MP_QSTR_trigger, MP_ARG_INT, {.u_int = NRF_GPIOTE_POLARITY_LOTOHI | NRF_GPIOTE_POLARITY_HITOLO} },

Wyświetl plik

@ -154,9 +154,9 @@ STATIC int spi_find(mp_obj_t id) {
void spi_transfer(const machine_hard_spi_obj_t * self, size_t len, const void * src, void * dest) {
nrfx_spi_xfer_desc_t xfer_desc = {
.p_tx_buffer = src,
.tx_length = len,
.p_rx_buffer = dest,
.rx_length = len
.tx_length = len,
.p_rx_buffer = dest,
.rx_length = len
};
nrfx_spi_xfer(self->p_spi, &xfer_desc, 0);
@ -340,7 +340,7 @@ STATIC void machine_hard_spi_init(mp_obj_t self_in, mp_arg_val_t *args) {
// Active high
if (args[ARG_INIT_polarity].u_int == 0) {
if (args[ARG_INIT_phase].u_int == 0) {
if (args[ARG_INIT_phase].u_int == 0) {
// First clock edge
self->p_config->mode = NRF_SPI_MODE_0;
} else {
@ -349,7 +349,7 @@ STATIC void machine_hard_spi_init(mp_obj_t self_in, mp_arg_val_t *args) {
}
// Active low
} else {
if (args[ARG_INIT_phase].u_int == 0) {
if (args[ARG_INIT_phase].u_int == 0) {
// First clock edge
self->p_config->mode = NRF_SPI_MODE_2;
} else {

Wyświetl plik

@ -72,7 +72,7 @@ uint32_t machine_rng_generate_random_word(void) {
status = sd_rand_application_vector_get((uint8_t *)&retval, 4); // Extract 4 bytes
} while (status != 0);
return retval;
return retval;
}
#endif

Wyświetl plik

@ -72,7 +72,7 @@ STATIC const mp_rom_map_elem_t ubluepy_delegate_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_handleConnection), MP_ROM_PTR(&ubluepy_delegate_handle_conn_obj) },
{ MP_ROM_QSTR(MP_QSTR_handleNotification), MP_ROM_PTR(&ubluepy_delegate_handle_notif_obj) },
#if 0
{ MP_ROM_QSTR(MP_QSTR_handleDiscovery), MP_ROM_PTR(&ubluepy_delegate_handle_disc_obj) },
{ MP_ROM_QSTR(MP_QSTR_handleDiscovery), MP_ROM_PTR(&ubluepy_delegate_handle_disc_obj) },
#endif
};

Wyświetl plik

@ -481,7 +481,7 @@ STATIC const mp_rom_map_elem_t ubluepy_peripheral_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_advertise), MP_ROM_PTR(&ubluepy_peripheral_advertise_obj) },
#endif
#if MICROPY_PY_UBLUEPY_OBSERVER
// Nothing yet.
// Nothing yet.
#endif
};

Wyświetl plik

@ -162,7 +162,7 @@ STATIC const mp_rom_map_elem_t ubluepy_service_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_addCharacteristic), MP_ROM_PTR(&ubluepy_service_add_char_obj) },
{ MP_ROM_QSTR(MP_QSTR_getCharacteristics), MP_ROM_PTR(&ubluepy_service_get_chars_obj) },
#if 0
// Properties
// Properties
{ MP_ROM_QSTR(MP_QSTR_peripheral), MP_ROM_PTR(&ubluepy_service_get_peripheral_obj) },
#endif
{ MP_ROM_QSTR(MP_QSTR_uuid), MP_ROM_PTR(&ubluepy_service_get_uuid_obj) },

Wyświetl plik

@ -42,7 +42,7 @@ typedef enum
} HAL_StatusTypeDef;
static inline uint32_t hal_tick_fake(void) {
return 0;
return 0;
}
#define mp_hal_ticks_ms hal_tick_fake // TODO: implement. Right now, return 0 always

Wyświetl plik

@ -53,9 +53,9 @@ enum {
};
#define PIN_DEFS_PORT_AF_UNION \
NRF_UART_Type *UART;
// NRF_SPI_Type *SPIM;
// NRF_SPIS_Type *SPIS;
NRF_UART_Type *UART;
// NRF_SPI_Type *SPIM;
// NRF_SPIS_Type *SPIS;
typedef NRF_GPIO_Type pin_gpio_t;