all: Reformat remaining C code that doesn't have a space after a comma.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
aec8db3cd1
commit
5b700b0af9
|
@ -121,9 +121,9 @@ void ICACHE_FLASH_ATTR
|
|||
pwm_start(void) {
|
||||
uint8 i, j;
|
||||
PWM_DBG("--Function pwm_start() is called\n");
|
||||
PWM_DBG("pwm_gpio:%x,pwm_channel_num:%d\n",pwm_gpio,pwm_channel_num);
|
||||
PWM_DBG("pwm_out_io_num[0]:%d,[1]:%d,[2]:%d\n",pwm_out_io_num[0],pwm_out_io_num[1],pwm_out_io_num[2]);
|
||||
PWM_DBG("pwm.period:%d,pwm.duty[0]:%d,[1]:%d,[2]:%d\n",pwm.period,pwm.duty[0],pwm.duty[1],pwm.duty[2]);
|
||||
PWM_DBG("pwm_gpio:%x,pwm_channel_num:%d\n", pwm_gpio, pwm_channel_num);
|
||||
PWM_DBG("pwm_out_io_num[0]:%d,[1]:%d,[2]:%d\n", pwm_out_io_num[0], pwm_out_io_num[1], pwm_out_io_num[2]);
|
||||
PWM_DBG("pwm.period:%d,pwm.duty[0]:%d,[1]:%d,[2]:%d\n", pwm.period, pwm.duty[0], pwm.duty[1], pwm.duty[2]);
|
||||
|
||||
LOCK_PWM(critical); // enter critical
|
||||
|
||||
|
@ -137,7 +137,7 @@ pwm_start(void) {
|
|||
for (i = 0; i < pwm_channel_num; i++) {
|
||||
uint32 us = pwm.period * pwm.duty[i] / PWM_DEPTH;
|
||||
local_single[i].h_time = US_TO_RTC_TIMER_TICKS(us);
|
||||
PWM_DBG("i:%d us:%d ht:%d\n",i,us,local_single[i].h_time);
|
||||
PWM_DBG("i:%d us:%d ht:%d\n", i, us, local_single[i].h_time);
|
||||
local_single[i].gpio_set = 0;
|
||||
local_single[i].gpio_clear = 1 << pin_num[pwm_out_io_num[i]];
|
||||
}
|
||||
|
@ -145,12 +145,12 @@ pwm_start(void) {
|
|||
local_single[pwm_channel_num].h_time = US_TO_RTC_TIMER_TICKS(pwm.period);
|
||||
local_single[pwm_channel_num].gpio_set = pwm_gpio;
|
||||
local_single[pwm_channel_num].gpio_clear = 0;
|
||||
PWM_DBG("i:%d period:%d ht:%d\n",pwm_channel_num,pwm.period,local_single[pwm_channel_num].h_time);
|
||||
PWM_DBG("i:%d period:%d ht:%d\n", pwm_channel_num, pwm.period, local_single[pwm_channel_num].h_time);
|
||||
// step 2: sort, small to big
|
||||
pwm_insert_sort(local_single, pwm_channel_num + 1);
|
||||
|
||||
*local_channel = pwm_channel_num + 1;
|
||||
PWM_DBG("1channel:%d,single[0]:%d,[1]:%d,[2]:%d,[3]:%d\n",*local_channel,local_single[0].h_time,local_single[1].h_time,local_single[2].h_time,local_single[3].h_time);
|
||||
PWM_DBG("1channel:%d,single[0]:%d,[1]:%d,[2]:%d,[3]:%d\n", *local_channel, local_single[0].h_time, local_single[1].h_time, local_single[2].h_time, local_single[3].h_time);
|
||||
// step 3: combine same duty channels
|
||||
for (i = pwm_channel_num; i > 0; i--) {
|
||||
if (local_single[i].h_time == local_single[i - 1].h_time) {
|
||||
|
@ -164,7 +164,7 @@ pwm_start(void) {
|
|||
(*local_channel)--;
|
||||
}
|
||||
}
|
||||
PWM_DBG("2channel:%d,single[0]:%d,[1]:%d,[2]:%d,[3]:%d\n",*local_channel,local_single[0].h_time,local_single[1].h_time,local_single[2].h_time,local_single[3].h_time);
|
||||
PWM_DBG("2channel:%d,single[0]:%d,[1]:%d,[2]:%d,[3]:%d\n", *local_channel, local_single[0].h_time, local_single[1].h_time, local_single[2].h_time, local_single[3].h_time);
|
||||
// step 4: cacl delt time
|
||||
for (i = *local_channel - 1; i > 0; i--) {
|
||||
local_single[i].h_time -= local_single[i - 1].h_time;
|
||||
|
@ -203,7 +203,7 @@ pwm_start(void) {
|
|||
}
|
||||
|
||||
UNLOCK_PWM(critical); // leave critical
|
||||
PWM_DBG("3channel:%d,single[0]:%d,[1]:%d,[2]:%d,[3]:%d\n",*local_channel,local_single[0].h_time,local_single[1].h_time,local_single[2].h_time,local_single[3].h_time);
|
||||
PWM_DBG("3channel:%d,single[0]:%d,[1]:%d,[2]:%d,[3]:%d\n", *local_channel, local_single[0].h_time, local_single[1].h_time, local_single[2].h_time, local_single[3].h_time);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -365,9 +365,9 @@ pwm_init(void) {
|
|||
int ICACHE_FLASH_ATTR
|
||||
pwm_add(uint8_t pin_id, uint32_t pin_mux, uint32_t pin_func) {
|
||||
PWM_DBG("--Function pwm_add() is called. channel:%d\n", channel);
|
||||
PWM_DBG("pwm_gpio:%x,pwm_channel_num:%d\n",pwm_gpio,pwm_channel_num);
|
||||
PWM_DBG("pwm_out_io_num[0]:%d,[1]:%d,[2]:%d\n",pwm_out_io_num[0],pwm_out_io_num[1],pwm_out_io_num[2]);
|
||||
PWM_DBG("pwm.duty[0]:%d,[1]:%d,[2]:%d\n",pwm.duty[0],pwm.duty[1],pwm.duty[2]);
|
||||
PWM_DBG("pwm_gpio:%x,pwm_channel_num:%d\n", pwm_gpio, pwm_channel_num);
|
||||
PWM_DBG("pwm_out_io_num[0]:%d,[1]:%d,[2]:%d\n", pwm_out_io_num[0], pwm_out_io_num[1], pwm_out_io_num[2]);
|
||||
PWM_DBG("pwm.duty[0]:%d,[1]:%d,[2]:%d\n", pwm.duty[0], pwm.duty[1], pwm.duty[2]);
|
||||
int channel = -1;
|
||||
for (int i = 0; i < PWM_CHANNEL; ++i) {
|
||||
if (pin_num[i] == pin_id) {
|
||||
|
@ -401,10 +401,10 @@ pwm_add(uint8_t pin_id, uint32_t pin_mux, uint32_t pin_func) {
|
|||
bool ICACHE_FLASH_ATTR
|
||||
pwm_delete(uint8 channel) {
|
||||
PWM_DBG("--Function pwm_delete() is called. channel:%d\n", channel);
|
||||
PWM_DBG("pwm_gpio:%x,pwm_channel_num:%d\n",pwm_gpio,pwm_channel_num);
|
||||
PWM_DBG("pwm_out_io_num[0]:%d,[1]:%d,[2]:%d\n",pwm_out_io_num[0],pwm_out_io_num[1],pwm_out_io_num[2]);
|
||||
PWM_DBG("pwm.duty[0]:%d,[1]:%d,[2]:%d\n",pwm.duty[0],pwm.duty[1],pwm.duty[2]);
|
||||
uint8 i,j;
|
||||
PWM_DBG("pwm_gpio:%x,pwm_channel_num:%d\n", pwm_gpio, pwm_channel_num);
|
||||
PWM_DBG("pwm_out_io_num[0]:%d,[1]:%d,[2]:%d\n", pwm_out_io_num[0], pwm_out_io_num[1], pwm_out_io_num[2]);
|
||||
PWM_DBG("pwm.duty[0]:%d,[1]:%d,[2]:%d\n", pwm.duty[0], pwm.duty[1], pwm.duty[2]);
|
||||
uint8 i, j;
|
||||
for (i = 0; i < pwm_channel_num; i++) {
|
||||
if (pwm_out_io_num[i] == channel) { // exist
|
||||
LOCK_PWM(critical); // enter critical
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
// 80 / 20 = 4 MHz
|
||||
|
||||
void spi_init(uint8_t spi_no);
|
||||
void spi_mode(uint8_t spi_no, uint8_t spi_cpha,uint8_t spi_cpol);
|
||||
void spi_mode(uint8_t spi_no, uint8_t spi_cpha, uint8_t spi_cpol);
|
||||
void spi_init_gpio(uint8_t spi_no, uint8_t sysclk_as_spiclk);
|
||||
void spi_clock(uint8_t spi_no, uint16_t prediv, uint8_t cntdiv);
|
||||
void spi_tx_byte_order(uint8_t spi_no, uint8_t byte_order);
|
||||
|
|
|
@ -63,7 +63,7 @@ STATIC samd_flash_obj_t samd_flash_obj = {
|
|||
// FLASH stuff
|
||||
STATIC mp_obj_t samd_flash_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
|
||||
// No args required. bdev=Flash(). Start Addr & Size defined in samd_flash_obj.
|
||||
mp_arg_check_num(n_args, n_kw, 0,0, false);
|
||||
mp_arg_check_num(n_args, n_kw, 0, 0, false);
|
||||
|
||||
// Return singleton object.
|
||||
return MP_OBJ_FROM_PTR(&samd_flash_obj);
|
||||
|
@ -90,7 +90,7 @@ STATIC mp_obj_t eraseblock(uint32_t sector_in) {
|
|||
uint32_t DEST_ADDR = sector_in; // Number of pages to be erased.
|
||||
mp_int_t PAGE_SIZE = flash_get_page_size(&flash_desc); // adf4 API call
|
||||
|
||||
flash_erase(&flash_desc,DEST_ADDR,(BLOCK_SIZE / PAGE_SIZE));
|
||||
flash_erase(&flash_desc, DEST_ADDR, (BLOCK_SIZE / PAGE_SIZE));
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ STATIC mp_obj_t samd_flash_readblocks(size_t n_args, const mp_obj_t *args) {
|
|||
}
|
||||
|
||||
// Read data to flash (adf4 API)
|
||||
flash_read(&flash_desc,offset,bufinfo.buf,bufinfo.len);
|
||||
flash_read(&flash_desc, offset, bufinfo.buf, bufinfo.len);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ STATIC mp_obj_t samd_flash_writeblocks(size_t n_args, const mp_obj_t *args) {
|
|||
offset += mp_obj_get_int(args[3]);
|
||||
}
|
||||
// Write data to flash (adf4 API)
|
||||
flash_write(&flash_desc,offset, bufinfo.buf, bufinfo.len);
|
||||
flash_write(&flash_desc, offset, bufinfo.buf, bufinfo.len);
|
||||
// TODO check return value
|
||||
return mp_const_none;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// const uint8_t mboot_pack_sign_secret_key[] = {0xf1,0xd8,0x66,0x08,0xbc,0x78,0x39,0x65,0x6a,0xf4,0x88,0xf4,0x43,0x4d,0x10,0xfe,0x4f,0x79,0xb9,0xc3,0x77,0x36,0x23,0xc8,0xcf,0x62,0xa1,0x90,0xf1,0xdc,0xd9,0xbc,0xb2,0x2e,0x59,0x1e,0x53,0x04,0x54,0xd5,0xd1,0x3a,0x6d,0x2e,0x79,0x3e,0xb5,0x70,0xb4,0x9f,0x33,0xff,0x90,0x1d,0xc3,0x54,0x90,0x12,0x96,0x79,0xf4,0xed,0x56,0x75};
|
||||
const uint8_t mboot_pack_sign_public_key[] = {0xb2,0x2e,0x59,0x1e,0x53,0x04,0x54,0xd5,0xd1,0x3a,0x6d,0x2e,0x79,0x3e,0xb5,0x70,0xb4,0x9f,0x33,0xff,0x90,0x1d,0xc3,0x54,0x90,0x12,0x96,0x79,0xf4,0xed,0x56,0x75};
|
||||
const uint8_t mboot_pack_secretbox_key[] = {0x4a,0xbe,0x9b,0xed,0x55,0x9f,0x74,0xeb,0x1e,0x70,0xde,0xf5,0x19,0x0a,0xeb,0xa5,0x68,0xea,0xb0,0x88,0xe6,0xfe,0x4d,0x10,0x69,0x23,0x06,0x7f,0xdd,0x83,0xf0,0xbf};
|
||||
const uint8_t mboot_pack_sign_public_key[] = {0xb2, 0x2e, 0x59, 0x1e, 0x53, 0x04, 0x54, 0xd5, 0xd1, 0x3a, 0x6d, 0x2e, 0x79, 0x3e, 0xb5, 0x70, 0xb4, 0x9f, 0x33, 0xff, 0x90, 0x1d, 0xc3, 0x54, 0x90, 0x12, 0x96, 0x79, 0xf4, 0xed, 0x56, 0x75};
|
||||
const uint8_t mboot_pack_secretbox_key[] = {0x4a, 0xbe, 0x9b, 0xed, 0x55, 0x9f, 0x74, 0xeb, 0x1e, 0x70, 0xde, 0xf5, 0x19, 0x0a, 0xeb, 0xa5, 0x68, 0xea, 0xb0, 0x88, 0xe6, 0xfe, 0x4d, 0x10, 0x69, 0x23, 0x06, 0x7f, 0xdd, 0x83, 0xf0, 0xbf};
|
||||
|
||||
// The above keys are for demonstration purposes only, do not use them in production!
|
||||
|
|
|
@ -541,7 +541,7 @@ void i2c_er_irq_handler(mp_uint_t i2c_id) {
|
|||
// I2C Acknowledge failure
|
||||
if (sr1 & I2C_FLAG_AF) {
|
||||
hi2c->ErrorCode |= HAL_I2C_ERROR_AF;
|
||||
SET_BIT(hi2c->Instance->CR1,I2C_CR1_STOP);
|
||||
SET_BIT(hi2c->Instance->CR1, I2C_CR1_STOP);
|
||||
__HAL_I2C_CLEAR_FLAG(hi2c, I2C_FLAG_AF);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#define USBULPI_TIMEOUT_COUNT (100)
|
||||
|
||||
#define USB_OTG_READ_REG32(reg) (*(__IO uint32_t *)(reg))
|
||||
#define USB_OTG_WRITE_REG32(reg,value) (*(__IO uint32_t *)(reg) = (value))
|
||||
#define USB_OTG_WRITE_REG32(reg, value) (*(__IO uint32_t *)(reg) = (value))
|
||||
|
||||
/**
|
||||
* @brief Read CR value
|
||||
|
|
|
@ -102,7 +102,7 @@ STATIC const int8_t usbd_msc_inquiry_data[36] = {
|
|||
'M', 'i', 'c', 'r', 'o', 'P', 'y', ' ', // Manufacturer : 8 bytes
|
||||
'p', 'y', 'b', 'o', 'a', 'r', 'd', ' ', // Product : 16 Bytes
|
||||
'F', 'l', 'a', 's', 'h', ' ', ' ', ' ',
|
||||
'1', '.', '0','0', // Version : 4 Bytes
|
||||
'1', '.', '0', '0', // Version : 4 Bytes
|
||||
};
|
||||
|
||||
// Set the logical units that will be exposed over MSC
|
||||
|
|
|
@ -45,7 +45,7 @@ static inline int msec_sleep_tv(struct timeval *tv) {
|
|||
msec_sleep(tv->tv_sec * 1000.0 + tv->tv_usec / 1000.0);
|
||||
return 0;
|
||||
}
|
||||
#define sleep_select(a,b,c,d,e) msec_sleep_tv((e))
|
||||
#define sleep_select(a, b, c, d, e) msec_sleep_tv((e))
|
||||
#else
|
||||
#define sleep_select select
|
||||
#endif
|
||||
|
|
|
@ -402,7 +402,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_setblocking_obj, socket_setblocking);
|
|||
|
||||
STATIC mp_obj_t socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {
|
||||
mp_obj_socket_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
struct timeval tv = {0,};
|
||||
struct timeval tv = {0, };
|
||||
bool new_blocking = true;
|
||||
|
||||
// Timeout of None means no timeout, which in POSIX is signified with 0 timeout,
|
||||
|
|
Loading…
Reference in New Issue