From cb73d4ba3d35ccb9fb5efa66d81ee616a6c2ae34 Mon Sep 17 00:00:00 2001 From: Piotr Esden-Tempski Date: Wed, 12 Jun 2013 19:43:10 -0700 Subject: [PATCH] Updated to the new locm3 changed to stdint types. --- .../miniblink/miniblink.c | 8 +-- .../uart_echo_interrupt/uart_echo_interrupt.c | 4 +- .../uart_echo_simple/uart_echo_simple.c | 2 +- .../lpc43xx/hackrf-jellybean/jellybean_conf.h | 2 +- .../hackrf-jellybean/miniblink/miniblink.c | 2 +- .../miniblink_rom_to_ram/miniblink.c | 2 +- .../lpc43xx/hackrf-jellybean/ssp/sspdemo.c | 8 +-- .../hackrf-jellybean/systick/systickdemo.c | 18 +++--- examples/stm32/f1/lisa-m-1/can/can.c | 32 +++++----- .../stm32/f1/lisa-m-1/usb_cdcacm/cdcacm.c | 10 +-- examples/stm32/f1/lisa-m-1/usb_dfu/usbdfu.c | 30 ++++----- examples/stm32/f1/lisa-m-1/usb_hid/usbhid.c | 30 ++++----- .../stm32/f1/lisa-m-2/adc_injec/adc_injec.c | 10 +-- .../adc_injec_timtrig/adc_injec_timtrig.c | 10 +-- .../adc_injec_timtrig_irq.c | 10 +-- .../adc_injec_timtrig_irq_4ch.c | 16 ++--- examples/stm32/f1/lisa-m-2/adc_regular/adc.c | 10 +-- examples/stm32/f1/lisa-m-2/can/can.c | 32 +++++----- examples/stm32/f1/lisa-m-2/spi/spi.c | 2 +- examples/stm32/f1/lisa-m-2/spi_dma/spi_dma.c | 22 +++---- .../f1/lisa-m-2/spi_dma_adv/spi_dma_adv.c | 38 +++++------ .../stm32/f1/lisa-m-2/usart_dma/usart_dma.c | 8 +-- .../stm32/f1/lisa-m-2/usart_irq/usart_irq.c | 2 +- .../usart_irq_printf/usart_irq_printf.c | 34 +++++----- examples/stm32/f1/mb525/pwmleds/pwmleds.c | 10 +-- examples/stm32/f1/obldc-strip/can/can.c | 32 +++++----- .../stm32/f1/obldc-strip/systick/systick.c | 2 +- examples/stm32/f1/obldc/can/can.c | 32 +++++----- examples/stm32/f1/obldc/pwmleds/pwmleds.c | 10 +-- examples/stm32/f1/obldc/systick/systick.c | 2 +- examples/stm32/f1/obldc/usart_irq/usart_irq.c | 2 +- .../f1/other/adc_temperature_sensor/adc.c | 10 +-- examples/stm32/f1/other/dma_mem2mem/dma.c | 6 +- examples/stm32/f1/other/dogm128/dogm128.c | 30 ++++----- examples/stm32/f1/other/dogm128/dogm128.h | 20 +++--- .../i2c_stts75_sensor/i2c_stts75_sensor.c | 2 +- .../stm32/f1/other/i2c_stts75_sensor/stts75.c | 28 ++++---- .../stm32/f1/other/i2c_stts75_sensor/stts75.h | 8 +-- examples/stm32/f1/other/rtc/rtc.c | 2 +- examples/stm32/f1/other/systick/systick.c | 2 +- examples/stm32/f1/other/usb_cdcacm/cdcacm.c | 10 +-- examples/stm32/f1/other/usb_dfu/usbdfu.c | 30 ++++----- examples/stm32/f1/other/usb_hid/usbhid.c | 18 +++--- examples/stm32/f1/stm32-h103/button/button.c | 2 +- .../stm32/f1/stm32-h103/exti_both/exti_both.c | 2 +- .../exti_rising_falling/exti_rising_falling.c | 2 +- .../f1/stm32-h103/led_stripe/led_stripe.c | 6 +- .../stm32/f1/stm32-h103/pwm_6step/pwm_6step.c | 2 +- examples/stm32/f1/stm32-h103/timer/timer.c | 8 +-- .../stm32/f1/stm32-h103/traceswo/traceswo.c | 2 +- .../stm32/f1/stm32-h103/usart_irq/usart_irq.c | 2 +- .../usart_irq_printf/usart_irq_printf.c | 34 +++++----- .../stm32/f1/stm32-h103/usb_cdcacm/cdcacm.c | 10 +-- examples/stm32/f1/stm32-h103/usb_dfu/usbdfu.c | 30 ++++----- examples/stm32/f1/stm32-h103/usb_hid/usbhid.c | 18 +++--- examples/stm32/f1/stm32-h103/usb_iap/usbiap.c | 30 ++++----- .../flash_rw_example/flash_rw_example.c | 64 +++++++++---------- .../f1/stm32-h107/usb_simple/usb_simple.c | 6 +- .../f1/stm32-maple/usart_irq/usart_irq.c | 4 +- .../stm32/f1/stm32-maple/usb_cdcacm/cdcacm.c | 12 ++-- .../adc-dac-printf/adc-dac-printf.c | 12 ++-- .../f1/stm32vl-discovery/button/button.c | 2 +- examples/stm32/f1/stm32vl-discovery/rtc/rtc.c | 4 +- .../stm32/f1/stm32vl-discovery/usart/usart.c | 2 +- examples/stm32/f2/jobygps/spi_test/spi_test.c | 4 +- .../f4/stm32f4-discovery/button/button.c | 2 +- .../f4/stm32f4-discovery/random/random.c | 10 +-- .../stm32f4-discovery/usart_irq/usart_irq.c | 2 +- .../f4/stm32f4-discovery/usb_cdcacm/cdcacm.c | 10 +-- .../button-irq-printf-lowpower/main.c | 4 +- libopencm3 | 2 +- 71 files changed, 443 insertions(+), 443 deletions(-) diff --git a/examples/lm4f/stellaris-ek-lm4f120xl/miniblink/miniblink.c b/examples/lm4f/stellaris-ek-lm4f120xl/miniblink/miniblink.c index aa9e7ba..f47b82f 100644 --- a/examples/lm4f/stellaris-ek-lm4f120xl/miniblink/miniblink.c +++ b/examples/lm4f/stellaris-ek-lm4f120xl/miniblink/miniblink.c @@ -59,7 +59,7 @@ enum { PLL_DIV_16MHZ = 25, }; -static const u8 plldiv[] = { +static const uint8_t plldiv[] = { PLL_DIV_80MHZ, PLL_DIV_57MHZ, PLL_DIV_40MHZ, @@ -93,7 +93,7 @@ static void gpio_setup(void) * This port is used to control the RGB LED */ periph_clock_enable(RCC_GPIOF); - const u32 outpins = (LED_R | LED_G | LED_B); + const uint32_t outpins = (LED_R | LED_G | LED_B); gpio_mode_setup(RGB_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, outpins); gpio_set_output_config(RGB_PORT, GPIO_OTYPE_PP, GPIO_DRIVE_2MA, outpins); @@ -101,7 +101,7 @@ static void gpio_setup(void) /* * Now take care of our buttons */ - const u32 btnpins = USR_SW1 | USR_SW2; + const uint32_t btnpins = USR_SW1 | USR_SW2; /* * PF0 is a locked by default. We need to unlock it before we can @@ -118,7 +118,7 @@ static void gpio_setup(void) */ static void irq_setup(void) { - const u32 btnpins = USR_SW1 | USR_SW2; + const uint32_t btnpins = USR_SW1 | USR_SW2; /* Trigger interrupt on rising-edge (when button is depressed) */ gpio_configure_trigger(GPIOF, GPIO_TRIG_EDGE_RISE, btnpins); /* Finally, Enable interrupt */ diff --git a/examples/lm4f/stellaris-ek-lm4f120xl/uart_echo_interrupt/uart_echo_interrupt.c b/examples/lm4f/stellaris-ek-lm4f120xl/uart_echo_interrupt/uart_echo_interrupt.c index 79a893e..8770273 100644 --- a/examples/lm4f/stellaris-ek-lm4f120xl/uart_echo_interrupt/uart_echo_interrupt.c +++ b/examples/lm4f/stellaris-ek-lm4f120xl/uart_echo_interrupt/uart_echo_interrupt.c @@ -61,8 +61,8 @@ static void uart_irq_setup(void) */ void uart0_isr(void) { - u8 rx; - u32 irq_clear = 0; + uint8_t rx; + uint32_t irq_clear = 0; if (uart_is_interrupt_source(UART0, UART_INT_RX)) { rx = uart_recv(UART0); diff --git a/examples/lm4f/stellaris-ek-lm4f120xl/uart_echo_simple/uart_echo_simple.c b/examples/lm4f/stellaris-ek-lm4f120xl/uart_echo_simple/uart_echo_simple.c index 04b355d..dd5e346 100644 --- a/examples/lm4f/stellaris-ek-lm4f120xl/uart_echo_simple/uart_echo_simple.c +++ b/examples/lm4f/stellaris-ek-lm4f120xl/uart_echo_simple/uart_echo_simple.c @@ -49,7 +49,7 @@ static void uart_setup(void) int main(void) { - u8 rx; + uint8_t rx; gpio_enable_ahb_aperture(); uart_setup(); diff --git a/examples/lpc43xx/hackrf-jellybean/jellybean_conf.h b/examples/lpc43xx/hackrf-jellybean/jellybean_conf.h index dc791b3..a2590cc 100644 --- a/examples/lpc43xx/hackrf-jellybean/jellybean_conf.h +++ b/examples/lpc43xx/hackrf-jellybean/jellybean_conf.h @@ -82,4 +82,4 @@ extern "C" } #endif -#endif \ No newline at end of file +#endif diff --git a/examples/lpc43xx/hackrf-jellybean/miniblink/miniblink.c b/examples/lpc43xx/hackrf-jellybean/miniblink/miniblink.c index 9603391..87e80d3 100644 --- a/examples/lpc43xx/hackrf-jellybean/miniblink/miniblink.c +++ b/examples/lpc43xx/hackrf-jellybean/miniblink/miniblink.c @@ -52,7 +52,7 @@ static void gpio_setup(void) GPIO3_DIR |= PIN_EN1V8; /* GPIO3[6] on P6_10 as output. */ } -u32 boot0, boot1, boot2, boot3; +uint32_t boot0, boot1, boot2, boot3; int main(void) { diff --git a/examples/lpc43xx/hackrf-jellybean/miniblink_rom_to_ram/miniblink.c b/examples/lpc43xx/hackrf-jellybean/miniblink_rom_to_ram/miniblink.c index 9603391..87e80d3 100644 --- a/examples/lpc43xx/hackrf-jellybean/miniblink_rom_to_ram/miniblink.c +++ b/examples/lpc43xx/hackrf-jellybean/miniblink_rom_to_ram/miniblink.c @@ -52,7 +52,7 @@ static void gpio_setup(void) GPIO3_DIR |= PIN_EN1V8; /* GPIO3[6] on P6_10 as output. */ } -u32 boot0, boot1, boot2, boot3; +uint32_t boot0, boot1, boot2, boot3; int main(void) { diff --git a/examples/lpc43xx/hackrf-jellybean/ssp/sspdemo.c b/examples/lpc43xx/hackrf-jellybean/ssp/sspdemo.c index 65399c8..59ac584 100644 --- a/examples/lpc43xx/hackrf-jellybean/ssp/sspdemo.c +++ b/examples/lpc43xx/hackrf-jellybean/ssp/sspdemo.c @@ -62,9 +62,9 @@ static void gpio_setup(void) int main(void) { int i; - u8 ssp_val; - u8 serial_clock_rate; - u8 clock_prescale_rate; + uint8_t ssp_val; + uint8_t serial_clock_rate; + uint8_t clock_prescale_rate; gpio_setup(); @@ -86,7 +86,7 @@ int main(void) while (1) { - ssp_write(SSP1_NUM, (u16)ssp_val); + ssp_write(SSP1_NUM, (uint16_t)ssp_val); gpio_set(GPIO2, GPIOPIN1); /* LED on */ diff --git a/examples/lpc43xx/hackrf-jellybean/systick/systickdemo.c b/examples/lpc43xx/hackrf-jellybean/systick/systickdemo.c index d307645..05a254e 100644 --- a/examples/lpc43xx/hackrf-jellybean/systick/systickdemo.c +++ b/examples/lpc43xx/hackrf-jellybean/systick/systickdemo.c @@ -27,8 +27,8 @@ #include "../jellybean_conf.h" /* Global counter incremented by SysTick Interrupt each millisecond */ -volatile u32 g_ulSysTickCount; -u32 g_NbCyclePerSecond; +volatile uint32_t g_ulSysTickCount; +uint32_t g_NbCyclePerSecond; static void gpio_setup(void) { @@ -67,7 +67,7 @@ static void gpio_setup(void) static void systick_setup(void) { - u32 systick_reload_val; + uint32_t systick_reload_val; g_ulSysTickCount = 0; /* Disable IRQ globally */ @@ -106,15 +106,15 @@ static void scs_dwt_cycle_counter_enabled(void) SCS_DWT_CTRL |= SCS_DWT_CTRL_CYCCNTENA; } -static u32 sys_tick_get_time_ms(void) +static uint32_t sys_tick_get_time_ms(void) { return g_ulSysTickCount; } -static u32 sys_tick_delta_time_ms(u32 start, u32 end) +static uint32_t sys_tick_delta_time_ms(uint32_t start, uint32_t end) { #define MAX_T_U32 ((2^32)-1) - u32 diff; + uint32_t diff; if(end > start) { @@ -127,10 +127,10 @@ static u32 sys_tick_delta_time_ms(u32 start, u32 end) return diff; } -static void sys_tick_wait_time_ms(u32 wait_ms) +static void sys_tick_wait_time_ms(uint32_t wait_ms) { - u32 start, end; - u32 tickms; + uint32_t start, end; + uint32_t tickms; start = sys_tick_get_time_ms(); diff --git a/examples/stm32/f1/lisa-m-1/can/can.c b/examples/stm32/f1/lisa-m-1/can/can.c index 18162c0..5c9c524 100644 --- a/examples/stm32/f1/lisa-m-1/can/can.c +++ b/examples/stm32/f1/lisa-m-1/can/can.c @@ -26,22 +26,22 @@ #include struct can_tx_msg { - u32 std_id; - u32 ext_id; - u8 ide; - u8 rtr; - u8 dlc; - u8 data[8]; + uint32_t std_id; + uint32_t ext_id; + uint8_t ide; + uint8_t rtr; + uint8_t dlc; + uint8_t data[8]; }; struct can_rx_msg { - u32 std_id; - u32 ext_id; - u8 ide; - u8 rtr; - u8 dlc; - u8 data[8]; - u8 fmi; + uint32_t std_id; + uint32_t ext_id; + uint8_t ide; + uint8_t rtr; + uint8_t dlc; + uint8_t data[8]; + uint8_t fmi; }; struct can_tx_msg can_tx_msg; @@ -166,7 +166,7 @@ static void can_setup(void) void sys_tick_handler(void) { static int temp32 = 0; - static u8 data[8] = {0, 1, 2, 0, 0, 0, 0, 0}; + static uint8_t data[8] = {0, 1, 2, 0, 0, 0, 0, 0}; /* We call this handler every 1ms so 100ms = 1s * Resulting in 100Hz message frequency. @@ -195,9 +195,9 @@ void sys_tick_handler(void) void usb_lp_can_rx0_isr(void) { - u32 id, fmi; + uint32_t id, fmi; bool ext, rtr; - u8 length, data[8]; + uint8_t length, data[8]; can_receive(CAN1, 0, false, &id, &ext, &rtr, &fmi, &length, data); diff --git a/examples/stm32/f1/lisa-m-1/usb_cdcacm/cdcacm.c b/examples/stm32/f1/lisa-m-1/usb_cdcacm/cdcacm.c index e2a2b72..919c91d 100644 --- a/examples/stm32/f1/lisa-m-1/usb_cdcacm/cdcacm.c +++ b/examples/stm32/f1/lisa-m-1/usb_cdcacm/cdcacm.c @@ -164,10 +164,10 @@ static const char *usb_strings[] = { }; /* Buffer to be used for control requests. */ -u8 usbd_control_buffer[128]; +uint8_t usbd_control_buffer[128]; -static int cdcacm_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, u8 **buf, - u16 *len, void (**complete)(usbd_device *usbd_dev, struct usb_setup_data *req)) +static int cdcacm_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, uint8_t **buf, + uint16_t *len, void (**complete)(usbd_device *usbd_dev, struct usb_setup_data *req)) { (void)complete; (void)buf; @@ -203,7 +203,7 @@ static int cdcacm_control_request(usbd_device *usbd_dev, struct usb_setup_data * return 0; } -static void cdcacm_data_rx_cb(usbd_device *usbd_dev, u8 ep) +static void cdcacm_data_rx_cb(usbd_device *usbd_dev, uint8_t ep) { (void)ep; @@ -219,7 +219,7 @@ static void cdcacm_data_rx_cb(usbd_device *usbd_dev, u8 ep) gpio_toggle(GPIOC, GPIO5); } -static void cdcacm_set_config(usbd_device *usbd_dev, u16 wValue) +static void cdcacm_set_config(usbd_device *usbd_dev, uint16_t wValue) { (void)wValue; diff --git a/examples/stm32/f1/lisa-m-1/usb_dfu/usbdfu.c b/examples/stm32/f1/lisa-m-1/usb_dfu/usbdfu.c index 0bf1b1e..1aca711 100644 --- a/examples/stm32/f1/lisa-m-1/usb_dfu/usbdfu.c +++ b/examples/stm32/f1/lisa-m-1/usb_dfu/usbdfu.c @@ -32,15 +32,15 @@ #define CMD_ERASE 0x41 /* We need a special large control buffer for this device: */ -u8 usbd_control_buffer[1024]; +uint8_t usbd_control_buffer[1024]; static enum dfu_state usbdfu_state = STATE_DFU_IDLE; static struct { - u8 buf[sizeof(usbd_control_buffer)]; - u16 len; - u32 addr; - u16 blocknum; + uint8_t buf[sizeof(usbd_control_buffer)]; + uint16_t len; + uint32_t addr; + uint16_t blocknum; } prog; const struct usb_device_descriptor dev = { @@ -113,7 +113,7 @@ static const char *usb_strings[] = { "@Internal Flash /0x08000000/8*001Ka,56*001Kg", }; -static u8 usbdfu_getstatus(u32 *bwPollTimeout) +static uint8_t usbdfu_getstatus(uint32_t *bwPollTimeout) { switch (usbdfu_state) { case STATE_DFU_DNLOAD_SYNC: @@ -142,20 +142,20 @@ static void usbdfu_getstatus_complete(usbd_device *usbd_dev, struct usb_setup_da switch (prog.buf[0]) { case CMD_ERASE: { - u32 *dat = (u32 *)(prog.buf + 1); + uint32_t *dat = (uint32_t *)(prog.buf + 1); flash_erase_page(*dat); } case CMD_SETADDR: { - u32 *dat = (u32 *)(prog.buf + 1); + uint32_t *dat = (uint32_t *)(prog.buf + 1); prog.addr = *dat; } } } else { - u32 baseaddr = prog.addr + ((prog.blocknum - 2) * + uint32_t baseaddr = prog.addr + ((prog.blocknum - 2) * dfu_function.wTransferSize); for (i = 0; i < prog.len; i += 2) { - u16 *dat = (u16 *)(prog.buf + i); + uint16_t *dat = (uint16_t *)(prog.buf + i); flash_program_half_word(baseaddr + i, *dat); } @@ -174,8 +174,8 @@ static void usbdfu_getstatus_complete(usbd_device *usbd_dev, struct usb_setup_da } } -static int usbdfu_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, u8 **buf, - u16 *len, void (**complete)(usbd_device *usbd_dev, struct usb_setup_data *req)) +static int usbdfu_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, uint8_t **buf, + uint16_t *len, void (**complete)(usbd_device *usbd_dev, struct usb_setup_data *req)) { (void)usbd_dev; @@ -208,7 +208,7 @@ static int usbdfu_control_request(usbd_device *usbd_dev, struct usb_setup_data * /* Upload not supported for now. */ return 0; case DFU_GETSTATUS: { - u32 bwPollTimeout = 0; /* 24-bit integer in DFU class spec */ + uint32_t bwPollTimeout = 0; /* 24-bit integer in DFU class spec */ (*buf)[0] = usbdfu_getstatus(&bwPollTimeout); (*buf)[1] = bwPollTimeout & 0xFF; (*buf)[2] = (bwPollTimeout >> 8) & 0xFF; @@ -237,12 +237,12 @@ int main(void) if (!gpio_get(GPIOA, GPIO10)) { /* Boot the application if it's valid. */ - if ((*(volatile u32 *)APP_ADDRESS & 0x2FFE0000) == 0x20000000) { + if ((*(volatile uint32_t *)APP_ADDRESS & 0x2FFE0000) == 0x20000000) { /* Set vector table base address. */ SCB_VTOR = APP_ADDRESS & 0xFFFF; /* Initialise master stack pointer. */ asm volatile("msr msp, %0"::"g" - (*(volatile u32 *)APP_ADDRESS)); + (*(volatile uint32_t *)APP_ADDRESS)); /* Jump to application. */ (*(void (**)())(APP_ADDRESS + 4))(); } diff --git a/examples/stm32/f1/lisa-m-1/usb_hid/usbhid.c b/examples/stm32/f1/lisa-m-1/usb_hid/usbhid.c index 263edb0..ff05855 100644 --- a/examples/stm32/f1/lisa-m-1/usb_hid/usbhid.c +++ b/examples/stm32/f1/lisa-m-1/usb_hid/usbhid.c @@ -57,7 +57,7 @@ const struct usb_device_descriptor dev_descr = { }; /* I have no idea what this means. I haven't read the HID spec. */ -static const u8 hid_report_descriptor[] = { +static const uint8_t hid_report_descriptor[] = { 0x05, 0x01, 0x09, 0x02, 0xA1, 0x01, 0x09, 0x01, 0xA1, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, 0x03, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, @@ -73,8 +73,8 @@ static const u8 hid_report_descriptor[] = { static const struct { struct usb_hid_descriptor hid_descriptor; struct { - u8 bReportDescriptorType; - u16 wDescriptorLength; + uint8_t bReportDescriptorType; + uint16_t wDescriptorLength; } __attribute__((packed)) hid_report; } __attribute__((packed)) hid_function = { .hid_descriptor = { @@ -176,9 +176,9 @@ static const char *usb_strings[] = { }; /* Buffer used for control requests. */ -u8 usbd_control_buffer[128]; +uint8_t usbd_control_buffer[128]; -static int hid_control_request(usbd_device *dev, struct usb_setup_data *req, u8 **buf, u16 *len, +static int hid_control_request(usbd_device *dev, struct usb_setup_data *req, uint8_t **buf, uint16_t *len, void (**complete)(usbd_device *dev, struct usb_setup_data *req)) { (void)complete; @@ -190,7 +190,7 @@ static int hid_control_request(usbd_device *dev, struct usb_setup_data *req, u8 return 0; /* Handle the HID report descriptor. */ - *buf = (u8 *)hid_report_descriptor; + *buf = (uint8_t *)hid_report_descriptor; *len = sizeof(hid_report_descriptor); return 1; @@ -209,7 +209,7 @@ static void dfu_detach_complete(usbd_device *dev, struct usb_setup_data *req) scb_reset_core(); } -static int dfu_control_request(usbd_device *dev, struct usb_setup_data *req, u8 **buf, u16 *len, +static int dfu_control_request(usbd_device *dev, struct usb_setup_data *req, uint8_t **buf, uint16_t *len, void (**complete)(usbd_device *dev, struct usb_setup_data *req)) { (void)buf; @@ -225,7 +225,7 @@ static int dfu_control_request(usbd_device *dev, struct usb_setup_data *req, u8 } #endif -static void hid_set_config(usbd_device *dev, u16 wValue) +static void hid_set_config(usbd_device *dev, uint16_t wValue) { (void)wValue; @@ -251,7 +251,7 @@ static void hid_set_config(usbd_device *dev, u16 wValue) systick_counter_enable(); } -static u8 spi_readwrite(u32 spi, u8 data) +static uint8_t spi_readwrite(uint32_t spi, uint8_t data) { while (SPI_SR(spi) & SPI_SR_BSY) ; @@ -261,9 +261,9 @@ static u8 spi_readwrite(u32 spi, u8 data) return SPI_DR(spi); } -static u8 accel_read(u8 addr) +static uint8_t accel_read(uint8_t addr) { - u8 ret; + uint8_t ret; gpio_clear(GPIOB, GPIO12); spi_readwrite(SPI2, addr | 0x80); ret = spi_readwrite(SPI2, 0); @@ -271,7 +271,7 @@ static u8 accel_read(u8 addr) return ret; } -static void accel_write(u8 addr, u8 data) +static void accel_write(uint8_t addr, uint8_t data) { gpio_clear(GPIOB, GPIO12); spi_readwrite(SPI2, addr); @@ -279,7 +279,7 @@ static void accel_write(u8 addr, u8 data) gpio_set(GPIOB, GPIO12); } -static void accel_get(s16 *x, s16 *y, s16 *z) +static void accel_get(int16_t *x, int16_t *y, int16_t *z) { if (x) *x = accel_read(ADXL345_DATAX0) | @@ -361,8 +361,8 @@ int main(void) void sys_tick_handler(void) { - s16 x, y; - u8 buf[4] = {0, 0, 0, 0}; + int16_t x, y; + uint8_t buf[4] = {0, 0, 0, 0}; accel_get(&x, &y, NULL); buf[1] = x >> 9; diff --git a/examples/stm32/f1/lisa-m-2/adc_injec/adc_injec.c b/examples/stm32/f1/lisa-m-2/adc_injec/adc_injec.c index 96f845e..c6b1fda 100644 --- a/examples/stm32/f1/lisa-m-2/adc_injec/adc_injec.c +++ b/examples/stm32/f1/lisa-m-2/adc_injec/adc_injec.c @@ -94,10 +94,10 @@ static void adc_setup(void) while ((ADC_CR2(ADC1) & ADC_CR2_CAL) != 0); //added this check } -static void my_usart_print_int(u32 usart, int value) +static void my_usart_print_int(uint32_t usart, int value) { - s8 i; - u8 nr_digits = 0; + int8_t i; + uint8_t nr_digits = 0; char buffer[25]; if (value < 0) { @@ -119,8 +119,8 @@ static void my_usart_print_int(u32 usart, int value) int main(void) { - u8 channel_array[16]; - u16 temperature = 0; + uint8_t channel_array[16]; + uint16_t temperature = 0; rcc_clock_setup_in_hse_12mhz_out_72mhz(); gpio_setup(); diff --git a/examples/stm32/f1/lisa-m-2/adc_injec_timtrig/adc_injec_timtrig.c b/examples/stm32/f1/lisa-m-2/adc_injec_timtrig/adc_injec_timtrig.c index 704d0ad..805416e 100644 --- a/examples/stm32/f1/lisa-m-2/adc_injec_timtrig/adc_injec_timtrig.c +++ b/examples/stm32/f1/lisa-m-2/adc_injec_timtrig/adc_injec_timtrig.c @@ -120,10 +120,10 @@ static void adc_setup(void) while ((ADC_CR2(ADC1) & ADC_CR2_CAL) != 0); } -static void my_usart_print_int(u32 usart, int value) +static void my_usart_print_int(uint32_t usart, int value) { - s8 i; - u8 nr_digits = 0; + int8_t i; + uint8_t nr_digits = 0; char buffer[25]; if (value < 0) { @@ -145,8 +145,8 @@ static void my_usart_print_int(u32 usart, int value) int main(void) { - u8 channel_array[16]; - u16 temperature = 0; + uint8_t channel_array[16]; + uint16_t temperature = 0; rcc_clock_setup_in_hse_12mhz_out_72mhz(); gpio_setup(); diff --git a/examples/stm32/f1/lisa-m-2/adc_injec_timtrig_irq/adc_injec_timtrig_irq.c b/examples/stm32/f1/lisa-m-2/adc_injec_timtrig_irq/adc_injec_timtrig_irq.c index 5a587a4..e65e2f0 100644 --- a/examples/stm32/f1/lisa-m-2/adc_injec_timtrig_irq/adc_injec_timtrig_irq.c +++ b/examples/stm32/f1/lisa-m-2/adc_injec_timtrig_irq/adc_injec_timtrig_irq.c @@ -27,7 +27,7 @@ #include #include -volatile u16 temperature = 0; +volatile uint16_t temperature = 0; static void usart_setup(void) { @@ -132,10 +132,10 @@ static void adc_setup(void) while ((ADC_CR2(ADC1) & ADC_CR2_CAL) != 0); } -static void my_usart_print_int(u32 usart, int value) +static void my_usart_print_int(uint32_t usart, int value) { - s8 i; - u8 nr_digits = 0; + int8_t i; + uint8_t nr_digits = 0; char buffer[25]; if (value < 0) { @@ -157,7 +157,7 @@ static void my_usart_print_int(u32 usart, int value) int main(void) { - u8 channel_array[16]; + uint8_t channel_array[16]; rcc_clock_setup_in_hse_12mhz_out_72mhz(); gpio_setup(); diff --git a/examples/stm32/f1/lisa-m-2/adc_injec_timtrig_irq_4ch/adc_injec_timtrig_irq_4ch.c b/examples/stm32/f1/lisa-m-2/adc_injec_timtrig_irq_4ch/adc_injec_timtrig_irq_4ch.c index 063a068..3c80aea 100644 --- a/examples/stm32/f1/lisa-m-2/adc_injec_timtrig_irq_4ch/adc_injec_timtrig_irq_4ch.c +++ b/examples/stm32/f1/lisa-m-2/adc_injec_timtrig_irq_4ch/adc_injec_timtrig_irq_4ch.c @@ -27,11 +27,11 @@ #include #include -volatile u16 temperature = 0; -volatile u16 v_refint = 0; -volatile u16 lisam_adc1 = 0; -volatile u16 lisam_adc2 = 0; -u8 channel_array[4]; /* for injected sampling, 4 channels max, for regular, 16 max */ +volatile uint16_t temperature = 0; +volatile uint16_t v_refint = 0; +volatile uint16_t lisam_adc1 = 0; +volatile uint16_t lisam_adc2 = 0; +uint8_t channel_array[4]; /* for injected sampling, 4 channels max, for regular, 16 max */ static void usart_setup(void) { @@ -149,10 +149,10 @@ static void adc_setup(void) while ((ADC_CR2(ADC1) & ADC_CR2_CAL) != 0); //added this check } -static void my_usart_print_int(u32 usart, int value) +static void my_usart_print_int(uint32_t usart, int value) { - s8 i; - u8 nr_digits = 0; + int8_t i; + uint8_t nr_digits = 0; char buffer[25]; if (value < 0) { diff --git a/examples/stm32/f1/lisa-m-2/adc_regular/adc.c b/examples/stm32/f1/lisa-m-2/adc_regular/adc.c index 6bef8a0..50e1e93 100644 --- a/examples/stm32/f1/lisa-m-2/adc_regular/adc.c +++ b/examples/stm32/f1/lisa-m-2/adc_regular/adc.c @@ -88,10 +88,10 @@ static void adc_setup(void) adc_calibration(ADC1); } -static void my_usart_print_int(u32 usart, int value) +static void my_usart_print_int(uint32_t usart, int value) { - s8 i; - u8 nr_digits = 0; + int8_t i; + uint8_t nr_digits = 0; char buffer[25]; if (value < 0) { @@ -113,8 +113,8 @@ static void my_usart_print_int(u32 usart, int value) int main(void) { - u8 channel_array[16]; - u16 temperature = 0; + uint8_t channel_array[16]; + uint16_t temperature = 0; rcc_clock_setup_in_hse_12mhz_out_72mhz(); gpio_setup(); diff --git a/examples/stm32/f1/lisa-m-2/can/can.c b/examples/stm32/f1/lisa-m-2/can/can.c index c9fb0eb..c9bb6c6 100644 --- a/examples/stm32/f1/lisa-m-2/can/can.c +++ b/examples/stm32/f1/lisa-m-2/can/can.c @@ -26,22 +26,22 @@ #include struct can_tx_msg { - u32 std_id; - u32 ext_id; - u8 ide; - u8 rtr; - u8 dlc; - u8 data[8]; + uint32_t std_id; + uint32_t ext_id; + uint8_t ide; + uint8_t rtr; + uint8_t dlc; + uint8_t data[8]; }; struct can_rx_msg { - u32 std_id; - u32 ext_id; - u8 ide; - u8 rtr; - u8 dlc; - u8 data[8]; - u8 fmi; + uint32_t std_id; + uint32_t ext_id; + uint8_t ide; + uint8_t rtr; + uint8_t dlc; + uint8_t data[8]; + uint8_t fmi; }; struct can_tx_msg can_tx_msg; @@ -166,7 +166,7 @@ static void can_setup(void) void sys_tick_handler(void) { static int temp32 = 0; - static u8 data[8] = {0, 1, 2, 0, 0, 0, 0, 0}; + static uint8_t data[8] = {0, 1, 2, 0, 0, 0, 0, 0}; /* We call this handler every 1ms so every 100ms = 0.1s * resulting in 100Hz message rate. @@ -195,9 +195,9 @@ void sys_tick_handler(void) void usb_lp_can_rx0_isr(void) { - u32 id, fmi; + uint32_t id, fmi; bool ext, rtr; - u8 length, data[8]; + uint8_t length, data[8]; can_receive(CAN1, 0, false, &id, &ext, &rtr, &fmi, &length, data); diff --git a/examples/stm32/f1/lisa-m-2/spi/spi.c b/examples/stm32/f1/lisa-m-2/spi/spi.c index bf28207..f6e4e73 100644 --- a/examples/stm32/f1/lisa-m-2/spi/spi.c +++ b/examples/stm32/f1/lisa-m-2/spi/spi.c @@ -132,7 +132,7 @@ static void gpio_setup(void) int main(void) { int counter = 0; - u16 rx_value = 0x42; + uint16_t rx_value = 0x42; clock_setup(); gpio_setup(); diff --git a/examples/stm32/f1/lisa-m-2/spi_dma/spi_dma.c b/examples/stm32/f1/lisa-m-2/spi_dma/spi_dma.c index e66d2b6..035096c 100644 --- a/examples/stm32/f1/lisa-m-2/spi_dma/spi_dma.c +++ b/examples/stm32/f1/lisa-m-2/spi_dma/spi_dma.c @@ -142,9 +142,9 @@ static void dma_setup(void) } #if USE_16BIT_TRANSFERS -static int spi_dma_transceive(u16 *tx_buf, int tx_len, u16 *rx_buf, int rx_len) +static int spi_dma_transceive(uint16_t *tx_buf, int tx_len, uint16_t *rx_buf, int rx_len) #else -static int spi_dma_transceive(u8 *tx_buf, int tx_len, u8 *rx_buf, int rx_len) +static int spi_dma_transceive(uint8_t *tx_buf, int tx_len, uint8_t *rx_buf, int rx_len) #endif { /* Check for 0 length in both tx and rx */ @@ -162,7 +162,7 @@ static int spi_dma_transceive(u8 *tx_buf, int tx_len, u8 *rx_buf, int rx_len) * busy any longer, i.e. the last activity was verified * complete elsewhere in the program. */ - volatile u8 temp_data __attribute__ ((unused)); + volatile uint8_t temp_data __attribute__ ((unused)); while (SPI_SR(SPI1) & (SPI_SR_RXNE | SPI_SR_OVR)) { temp_data = SPI_DR(SPI1); } @@ -178,8 +178,8 @@ static int spi_dma_transceive(u8 *tx_buf, int tx_len, u8 *rx_buf, int rx_len) /* Set up rx dma, note it has higher priority to avoid overrun */ if (rx_len > 0) { - dma_set_peripheral_address(DMA1, DMA_CHANNEL2, (u32)&SPI1_DR); - dma_set_memory_address(DMA1, DMA_CHANNEL2, (u32)rx_buf); + dma_set_peripheral_address(DMA1, DMA_CHANNEL2, (uint32_t)&SPI1_DR); + dma_set_memory_address(DMA1, DMA_CHANNEL2, (uint32_t)rx_buf); dma_set_number_of_data(DMA1, DMA_CHANNEL2, rx_len); dma_set_read_from_peripheral(DMA1, DMA_CHANNEL2); dma_enable_memory_increment_mode(DMA1, DMA_CHANNEL2); @@ -195,8 +195,8 @@ static int spi_dma_transceive(u8 *tx_buf, int tx_len, u8 *rx_buf, int rx_len) /* Set up tx dma */ if (tx_len > 0) { - dma_set_peripheral_address(DMA1, DMA_CHANNEL3, (u32)&SPI1_DR); - dma_set_memory_address(DMA1, DMA_CHANNEL3, (u32)tx_buf); + dma_set_peripheral_address(DMA1, DMA_CHANNEL3, (uint32_t)&SPI1_DR); + dma_set_memory_address(DMA1, DMA_CHANNEL3, (uint32_t)tx_buf); dma_set_number_of_data(DMA1, DMA_CHANNEL3, tx_len); dma_set_read_from_memory(DMA1, DMA_CHANNEL3); dma_enable_memory_increment_mode(DMA1, DMA_CHANNEL3); @@ -340,11 +340,11 @@ int main(void) /* Transmit and Receive packets, set transmit to index and receive to known unused value to aid in debugging */ #if USE_16BIT_TRANSFERS - u16 tx_packet[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; - u16 rx_packet[16] = {0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42}; + uint16_t tx_packet[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; + uint16_t rx_packet[16] = {0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42}; #else - u8 tx_packet[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; - u8 rx_packet[16] = {0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42}; + uint8_t tx_packet[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; + uint8_t rx_packet[16] = {0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42}; #endif transceive_status = DONE; diff --git a/examples/stm32/f1/lisa-m-2/spi_dma_adv/spi_dma_adv.c b/examples/stm32/f1/lisa-m-2/spi_dma_adv/spi_dma_adv.c index a8054e7..c959720 100644 --- a/examples/stm32/f1/lisa-m-2/spi_dma_adv/spi_dma_adv.c +++ b/examples/stm32/f1/lisa-m-2/spi_dma_adv/spi_dma_adv.c @@ -52,9 +52,9 @@ volatile trans_status transceive_status; int rx_buf_remainder = 0; #if USE_16BIT_TRANSFERS -u16 dummy_tx_buf = 0xdd; +uint16_t dummy_tx_buf = 0xdd; #else -u8 dummy_tx_buf = 0xdd; +uint8_t dummy_tx_buf = 0xdd; #endif int _write(int file, char *ptr, int len); @@ -152,9 +152,9 @@ static void dma_setup(void) } #if USE_16BIT_TRANSFERS -static int spi_dma_transceive(u16 *tx_buf, int tx_len, u16 *rx_buf, int rx_len) +static int spi_dma_transceive(uint16_t *tx_buf, int tx_len, uint16_t *rx_buf, int rx_len) #else -static int spi_dma_transceive(u8 *tx_buf, int tx_len, u8 *rx_buf, int rx_len) +static int spi_dma_transceive(uint8_t *tx_buf, int tx_len, uint8_t *rx_buf, int rx_len) #endif { @@ -173,7 +173,7 @@ static int spi_dma_transceive(u8 *tx_buf, int tx_len, u8 *rx_buf, int rx_len) * busy any longer, i.e. the last activity was verified * complete elsewhere in the program. */ - volatile u8 temp_data __attribute__ ((unused)); + volatile uint8_t temp_data __attribute__ ((unused)); while (SPI_SR(SPI1) & (SPI_SR_RXNE | SPI_SR_OVR)) { temp_data = SPI_DR(SPI1); } @@ -199,8 +199,8 @@ static int spi_dma_transceive(u8 *tx_buf, int tx_len, u8 *rx_buf, int rx_len) /* Set up rx dma, note it has higher priority to avoid overrun */ if (rx_len > 0) { - dma_set_peripheral_address(DMA1, DMA_CHANNEL2, (u32)&SPI1_DR); - dma_set_memory_address(DMA1, DMA_CHANNEL2, (u32)rx_buf); + dma_set_peripheral_address(DMA1, DMA_CHANNEL2, (uint32_t)&SPI1_DR); + dma_set_memory_address(DMA1, DMA_CHANNEL2, (uint32_t)rx_buf); dma_set_number_of_data(DMA1, DMA_CHANNEL2, rx_len); dma_set_read_from_peripheral(DMA1, DMA_CHANNEL2); dma_enable_memory_increment_mode(DMA1, DMA_CHANNEL2); @@ -217,8 +217,8 @@ static int spi_dma_transceive(u8 *tx_buf, int tx_len, u8 *rx_buf, int rx_len) /* Set up tx dma (must always run tx to get clock signal) */ if (tx_len > 0) { /* Here we have a regular tx transfer */ - dma_set_peripheral_address(DMA1, DMA_CHANNEL3, (u32)&SPI1_DR); - dma_set_memory_address(DMA1, DMA_CHANNEL3, (u32)tx_buf); + dma_set_peripheral_address(DMA1, DMA_CHANNEL3, (uint32_t)&SPI1_DR); + dma_set_memory_address(DMA1, DMA_CHANNEL3, (uint32_t)tx_buf); dma_set_number_of_data(DMA1, DMA_CHANNEL3, tx_len); dma_set_read_from_memory(DMA1, DMA_CHANNEL3); dma_enable_memory_increment_mode(DMA1, DMA_CHANNEL3); @@ -235,8 +235,8 @@ static int spi_dma_transceive(u8 *tx_buf, int tx_len, u8 *rx_buf, int rx_len) * and set the length to the rx_len to get all rx data in, while * not incrementing the memory pointer */ - dma_set_peripheral_address(DMA1, DMA_CHANNEL3, (u32)&SPI1_DR); - dma_set_memory_address(DMA1, DMA_CHANNEL3, (u32)(&dummy_tx_buf)); // Change here + dma_set_peripheral_address(DMA1, DMA_CHANNEL3, (uint32_t)&SPI1_DR); + dma_set_memory_address(DMA1, DMA_CHANNEL3, (uint32_t)(&dummy_tx_buf)); // Change here dma_set_number_of_data(DMA1, DMA_CHANNEL3, rx_len); // Change here dma_set_read_from_memory(DMA1, DMA_CHANNEL3); dma_disable_memory_increment_mode(DMA1, DMA_CHANNEL3); // Change here @@ -313,8 +313,8 @@ void dma1_channel3_isr(void) */ if (rx_buf_remainder > 0) { dma_channel_reset(DMA1, DMA_CHANNEL3); - dma_set_peripheral_address(DMA1, DMA_CHANNEL3, (u32)&SPI1_DR); - dma_set_memory_address(DMA1, DMA_CHANNEL3, (u32)(&dummy_tx_buf)); // Change here + dma_set_peripheral_address(DMA1, DMA_CHANNEL3, (uint32_t)&SPI1_DR); + dma_set_memory_address(DMA1, DMA_CHANNEL3, (uint32_t)(&dummy_tx_buf)); // Change here dma_set_number_of_data(DMA1, DMA_CHANNEL3, rx_buf_remainder); // Change here dma_set_read_from_memory(DMA1, DMA_CHANNEL3); dma_disable_memory_increment_mode(DMA1, DMA_CHANNEL3); // Change here @@ -401,11 +401,11 @@ int main(void) /* Transmit and Receive packets, set transmit to index and receive to known unused value to aid in debugging */ #if USE_16BIT_TRANSFERS - u16 tx_packet[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; - u16 rx_packet[16] = {0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42}; + uint16_t tx_packet[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; + uint16_t rx_packet[16] = {0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42}; #else - u8 tx_packet[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; - u8 rx_packet[16] = {0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42}; + uint8_t tx_packet[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; + uint8_t rx_packet[16] = {0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42}; #endif transceive_status = DONE; @@ -494,9 +494,9 @@ int main(void) /* Reset receive buffer for consistency */ for (i = 0; i < 16; i++) { #if USE_16BIT_TRANSFERS - tx_packet[i] = (u16)i; + tx_packet[i] = (uint16_t)i; #else - tx_packet[i] = (u8)i; + tx_packet[i] = (uint8_t)i; #endif rx_packet[i] = 0x42; } diff --git a/examples/stm32/f1/lisa-m-2/usart_dma/usart_dma.c b/examples/stm32/f1/lisa-m-2/usart_dma/usart_dma.c index fa35fe6..4c22101 100644 --- a/examples/stm32/f1/lisa-m-2/usart_dma/usart_dma.c +++ b/examples/stm32/f1/lisa-m-2/usart_dma/usart_dma.c @@ -76,8 +76,8 @@ static void dma_write(char *data, int size) /* Reset DMA channel*/ dma_channel_reset(DMA1, DMA_CHANNEL7); - dma_set_peripheral_address(DMA1, DMA_CHANNEL7, (u32)&USART2_DR); - dma_set_memory_address(DMA1, DMA_CHANNEL7, (u32)data); + dma_set_peripheral_address(DMA1, DMA_CHANNEL7, (uint32_t)&USART2_DR); + dma_set_memory_address(DMA1, DMA_CHANNEL7, (uint32_t)data); dma_set_number_of_data(DMA1, DMA_CHANNEL7, size); dma_set_read_from_memory(DMA1, DMA_CHANNEL7); dma_enable_memory_increment_mode(DMA1, DMA_CHANNEL7); @@ -118,8 +118,8 @@ static void dma_read(char *data, int size) /* Reset DMA channel*/ dma_channel_reset(DMA1, DMA_CHANNEL6); - dma_set_peripheral_address(DMA1, DMA_CHANNEL6, (u32)&USART2_DR); - dma_set_memory_address(DMA1, DMA_CHANNEL6, (u32)data); + dma_set_peripheral_address(DMA1, DMA_CHANNEL6, (uint32_t)&USART2_DR); + dma_set_memory_address(DMA1, DMA_CHANNEL6, (uint32_t)data); dma_set_number_of_data(DMA1, DMA_CHANNEL6, size); dma_set_read_from_peripheral(DMA1, DMA_CHANNEL6); dma_enable_memory_increment_mode(DMA1, DMA_CHANNEL6); diff --git a/examples/stm32/f1/lisa-m-2/usart_irq/usart_irq.c b/examples/stm32/f1/lisa-m-2/usart_irq/usart_irq.c index 1fef959..958cb43 100644 --- a/examples/stm32/f1/lisa-m-2/usart_irq/usart_irq.c +++ b/examples/stm32/f1/lisa-m-2/usart_irq/usart_irq.c @@ -81,7 +81,7 @@ static void gpio_setup(void) void usart2_isr(void) { - static u8 data = 'A'; + static uint8_t data = 'A'; /* Check if we were called because of RXNE. */ if (((USART_CR1(USART2) & USART_CR1_RXNEIE) != 0) && diff --git a/examples/stm32/f1/lisa-m-2/usart_irq_printf/usart_irq_printf.c b/examples/stm32/f1/lisa-m-2/usart_irq_printf/usart_irq_printf.c index d4e6805..cd46b30 100644 --- a/examples/stm32/f1/lisa-m-2/usart_irq_printf/usart_irq_printf.c +++ b/examples/stm32/f1/lisa-m-2/usart_irq_printf/usart_irq_printf.c @@ -32,13 +32,13 @@ * https://github.com/open-bldc/open-bldc/tree/master/source/libgovernor *****************************************************************************/ -typedef s32 ring_size_t; +typedef int32_t ring_size_t; struct ring { - u8 *data; + uint8_t *data; ring_size_t size; - u32 begin; - u32 end; + uint32_t begin; + uint32_t end; }; #define RING_SIZE(RING) ((RING)->size - 1) @@ -47,7 +47,7 @@ struct ring { int _write(int file, char *ptr, int len); -static void ring_init(struct ring *ring, u8 *buf, ring_size_t size) +static void ring_init(struct ring *ring, uint8_t *buf, ring_size_t size) { ring->data = buf; ring->size = size; @@ -55,20 +55,20 @@ static void ring_init(struct ring *ring, u8 *buf, ring_size_t size) ring->end = 0; } -static s32 ring_write_ch(struct ring *ring, u8 ch) +static int32_t ring_write_ch(struct ring *ring, uint8_t ch) { if (((ring->end + 1) % ring->size) != ring->begin) { ring->data[ring->end++] = ch; ring->end %= ring->size; - return (u32)ch; + return (uint32_t)ch; } return -1; } -static s32 ring_write(struct ring *ring, u8 *data, ring_size_t size) +static int32_t ring_write(struct ring *ring, uint8_t *data, ring_size_t size) { - s32 i; + int32_t i; for (i = 0; i < size; i++) { if (ring_write_ch(ring, data[i]) < 0) @@ -78,9 +78,9 @@ static s32 ring_write(struct ring *ring, u8 *data, ring_size_t size) return i; } -static s32 ring_read_ch(struct ring *ring, u8 *ch) +static int32_t ring_read_ch(struct ring *ring, uint8_t *ch) { - s32 ret = -1; + int32_t ret = -1; if (ring->begin != ring->end) { ret = ring->data[ring->begin++]; @@ -93,9 +93,9 @@ static s32 ring_read_ch(struct ring *ring, u8 *ch) } /* Not used! -static s32 ring_read(struct ring *ring, u8 *data, ring_size_t size) +static int32_t ring_read(struct ring *ring, uint8_t *data, ring_size_t size) { - s32 i; + int32_t i; for (i = 0; i < size; i++) { if (ring_read_ch(ring, data + i) < 0) @@ -113,7 +113,7 @@ static s32 ring_read(struct ring *ring, u8 *data, ring_size_t size) #define BUFFER_SIZE 1024 struct ring output_ring; -u8 output_ring_buffer[BUFFER_SIZE]; +uint8_t output_ring_buffer[BUFFER_SIZE]; static void clock_setup(void) { @@ -188,7 +188,7 @@ void usart2_isr(void) if (((USART_CR1(USART2) & USART_CR1_TXEIE) != 0) && ((USART_SR(USART2) & USART_SR_TXE) != 0)) { - s32 data; + int32_t data; data = ring_read_ch(&output_ring, NULL); @@ -207,7 +207,7 @@ int _write(int file, char *ptr, int len) int ret; if (file == 1) { - ret = ring_write(&output_ring, (u8 *)ptr, len); + ret = ring_write(&output_ring, (uint8_t *)ptr, len); if (ret < 0) ret = -ret; @@ -241,7 +241,7 @@ void sys_tick_handler(void) static int counter = 0; static float fcounter = 0.0; static double dcounter = 0.0; - static u32 temp32 = 0; + static uint32_t temp32 = 0; temp32++; diff --git a/examples/stm32/f1/mb525/pwmleds/pwmleds.c b/examples/stm32/f1/mb525/pwmleds/pwmleds.c index e707e6a..bb629e8 100644 --- a/examples/stm32/f1/mb525/pwmleds/pwmleds.c +++ b/examples/stm32/f1/mb525/pwmleds/pwmleds.c @@ -49,7 +49,7 @@ * Iout = Iin ** gamma */ #ifdef GAMMA_LINEAR -static const u16 gamma_table_linear[] = { +static const uint16_t gamma_table_linear[] = { 1, 4, 9, 17, 26, 37, 51, 67, 84, 104, 126, 149, 175, 203, 233, 265, 299, 334, 372, 412, 454, 499, 545, 593, @@ -86,7 +86,7 @@ static const u16 gamma_table_linear[] = { #endif #ifdef GAMMA_1_3 -static const u16 gamma_table_1_3[] = { +static const uint16_t gamma_table_1_3[] = { /* Gamma 1.3 */ 0, 49, 120, 203, 296, 395, 501, 612, 728, 848, 973, 1101, 1233, 1368, 1506, 1648, @@ -124,7 +124,7 @@ static const u16 gamma_table_1_3[] = { #endif #ifdef GAMMA_2_2 -static const u16 gamma_table_2_2[] = { +static const uint16_t gamma_table_2_2[] = { 0, 0, 2, 4, 7, 11, 17, 24, 32, 42, 53, 65, 79, 94, 111, 129, 148, 169, 192, 216, 242, 270, 299, 330, @@ -161,7 +161,7 @@ static const u16 gamma_table_2_2[] = { #endif #ifdef GAMMA_2_5 -static const u16 gamma_table_2_5[] = { +static const uint16_t gamma_table_2_5[] = { /* gamma = 2.5 */ 0, 0, 0, 1, 2, 4, 6, 8, 11, 15, 20, 25, 31, 38, 46, 55, @@ -199,7 +199,7 @@ static const u16 gamma_table_2_5[] = { #endif #ifdef GAMMA_3_0 -static const u16 gamma_table_3_0[] = { +static const uint16_t gamma_table_3_0[] = { /* gamma = 3.0 */ 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, 4, 5, 7, 9, 11, 13, diff --git a/examples/stm32/f1/obldc-strip/can/can.c b/examples/stm32/f1/obldc-strip/can/can.c index 0f20360..5c0061f 100644 --- a/examples/stm32/f1/obldc-strip/can/can.c +++ b/examples/stm32/f1/obldc-strip/can/can.c @@ -25,22 +25,22 @@ #include struct can_tx_msg { - u32 std_id; - u32 ext_id; - u8 ide; - u8 rtr; - u8 dlc; - u8 data[8]; + uint32_t std_id; + uint32_t ext_id; + uint8_t ide; + uint8_t rtr; + uint8_t dlc; + uint8_t data[8]; }; struct can_rx_msg { - u32 std_id; - u32 ext_id; - u8 ide; - u8 rtr; - u8 dlc; - u8 data[8]; - u8 fmi; + uint32_t std_id; + uint32_t ext_id; + uint8_t ide; + uint8_t rtr; + uint8_t dlc; + uint8_t data[8]; + uint8_t fmi; }; struct can_tx_msg can_tx_msg; @@ -151,7 +151,7 @@ static void can_setup(void) void sys_tick_handler(void) { - static u8 data[8] = {0, 1, 2, 0, 0, 0, 0, 0}; + static uint8_t data[8] = {0, 1, 2, 0, 0, 0, 0, 0}; /* We call this handler every 1ms so every 1ms = 0.001s * resulting in 1000Hz message rate. @@ -173,9 +173,9 @@ void sys_tick_handler(void) void usb_lp_can_rx0_isr(void) { - u32 id, fmi; + uint32_t id, fmi; bool ext, rtr; - u8 length, data[8]; + uint8_t length, data[8]; can_receive(CAN1, 0, false, &id, &ext, &rtr, &fmi, &length, data); diff --git a/examples/stm32/f1/obldc-strip/systick/systick.c b/examples/stm32/f1/obldc-strip/systick/systick.c index fefec2c..18a1bc2 100644 --- a/examples/stm32/f1/obldc-strip/systick/systick.c +++ b/examples/stm32/f1/obldc-strip/systick/systick.c @@ -23,7 +23,7 @@ #include #include -u32 temp32; +uint32_t temp32; static void gpio_setup(void) { diff --git a/examples/stm32/f1/obldc/can/can.c b/examples/stm32/f1/obldc/can/can.c index 605b1a5..216278b 100644 --- a/examples/stm32/f1/obldc/can/can.c +++ b/examples/stm32/f1/obldc/can/can.c @@ -26,22 +26,22 @@ #include struct can_tx_msg { - u32 std_id; - u32 ext_id; - u8 ide; - u8 rtr; - u8 dlc; - u8 data[8]; + uint32_t std_id; + uint32_t ext_id; + uint8_t ide; + uint8_t rtr; + uint8_t dlc; + uint8_t data[8]; }; struct can_rx_msg { - u32 std_id; - u32 ext_id; - u8 ide; - u8 rtr; - u8 dlc; - u8 data[8]; - u8 fmi; + uint32_t std_id; + uint32_t ext_id; + uint8_t ide; + uint8_t rtr; + uint8_t dlc; + uint8_t data[8]; + uint8_t fmi; }; struct can_tx_msg can_tx_msg; @@ -151,7 +151,7 @@ static void can_setup(void) void sys_tick_handler(void) { static int temp32 = 0; - static u8 data[8] = {0, 1, 2, 0, 0, 0, 0, 0}; + static uint8_t data[8] = {0, 1, 2, 0, 0, 0, 0, 0}; /* We call this handler every 1ms so 1000ms = 1s on/off. */ if (++temp32 != 1000) @@ -177,9 +177,9 @@ void sys_tick_handler(void) void usb_lp_can_rx0_isr(void) { - u32 id, fmi; + uint32_t id, fmi; bool ext, rtr; - u8 length, data[8]; + uint8_t length, data[8]; can_receive(CAN1, 0, false, &id, &ext, &rtr, &fmi, &length, data); diff --git a/examples/stm32/f1/obldc/pwmleds/pwmleds.c b/examples/stm32/f1/obldc/pwmleds/pwmleds.c index 54429e0..2521724 100644 --- a/examples/stm32/f1/obldc/pwmleds/pwmleds.c +++ b/examples/stm32/f1/obldc/pwmleds/pwmleds.c @@ -49,7 +49,7 @@ * Iout = Iin ** gamma */ #ifdef GAMMA_LINEAR -static const u16 gamma_table_linear[] = { +static const uint16_t gamma_table_linear[] = { 1, 4, 9, 17, 26, 37, 51, 67, 84, 104, 126, 149, 175, 203, 233, 265, 299, 334, 372, 412, 454, 499, 545, 593, @@ -86,7 +86,7 @@ static const u16 gamma_table_linear[] = { #endif #ifdef GAMMA_1_3 -static const u16 gamma_table_1_3[] = { +static const uint16_t gamma_table_1_3[] = { /* Gamma 1.3 */ 0, 49, 120, 203, 296, 395, 501, 612, 728, 848, 973, 1101, 1233, 1368, 1506, 1648, @@ -124,7 +124,7 @@ static const u16 gamma_table_1_3[] = { #endif #ifdef GAMMA_2_2 -static const u16 gamma_table_2_2[] = { +static const uint16_t gamma_table_2_2[] = { 0, 0, 2, 4, 7, 11, 17, 24, 32, 42, 53, 65, 79, 94, 111, 129, 148, 169, 192, 216, 242, 270, 299, 330, @@ -161,7 +161,7 @@ static const u16 gamma_table_2_2[] = { #endif #ifdef GAMMA_2_5 -static const u16 gamma_table_2_5[] = { +static const uint16_t gamma_table_2_5[] = { /* gamma = 2.5 */ 0, 0, 0, 1, 2, 4, 6, 8, 11, 15, 20, 25, 31, 38, 46, 55, @@ -199,7 +199,7 @@ static const u16 gamma_table_2_5[] = { #endif #ifdef GAMMA_3_0 -static const u16 gamma_table_3_0[] = { +static const uint16_t gamma_table_3_0[] = { /* gamma = 3.0 */ 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, 4, 5, 7, 9, 11, 13, diff --git a/examples/stm32/f1/obldc/systick/systick.c b/examples/stm32/f1/obldc/systick/systick.c index a92c0b6..b3bac62 100644 --- a/examples/stm32/f1/obldc/systick/systick.c +++ b/examples/stm32/f1/obldc/systick/systick.c @@ -24,7 +24,7 @@ #include #include -u32 temp32; +uint32_t temp32; static void gpio_setup(void) { diff --git a/examples/stm32/f1/obldc/usart_irq/usart_irq.c b/examples/stm32/f1/obldc/usart_irq/usart_irq.c index 5ffb54f..a88045e 100644 --- a/examples/stm32/f1/obldc/usart_irq/usart_irq.c +++ b/examples/stm32/f1/obldc/usart_irq/usart_irq.c @@ -77,7 +77,7 @@ static void gpio_setup(void) void usart1_isr(void) { - static u8 data = 'A'; + static uint8_t data = 'A'; /* Check if we were called because of RXNE. */ if (((USART_CR1(USART1) & USART_CR1_RXNEIE) != 0) && diff --git a/examples/stm32/f1/other/adc_temperature_sensor/adc.c b/examples/stm32/f1/other/adc_temperature_sensor/adc.c index 47023e7..b3c6a05 100644 --- a/examples/stm32/f1/other/adc_temperature_sensor/adc.c +++ b/examples/stm32/f1/other/adc_temperature_sensor/adc.c @@ -85,10 +85,10 @@ static void adc_setup(void) adc_calibration(ADC1); } -static void my_usart_print_int(u32 usart, int value) +static void my_usart_print_int(uint32_t usart, int value) { - s8 i; - u8 nr_digits = 0; + int8_t i; + uint8_t nr_digits = 0; char buffer[25]; if (value < 0) { @@ -107,8 +107,8 @@ static void my_usart_print_int(u32 usart, int value) int main(void) { - u8 channel_array[16]; - u16 temperature; + uint8_t channel_array[16]; + uint16_t temperature; rcc_clock_setup_in_hse_16mhz_out_72mhz(); gpio_setup(); diff --git a/examples/stm32/f1/other/dma_mem2mem/dma.c b/examples/stm32/f1/other/dma_mem2mem/dma.c index d9dae43..47cd7ae 100644 --- a/examples/stm32/f1/other/dma_mem2mem/dma.c +++ b/examples/stm32/f1/other/dma_mem2mem/dma.c @@ -57,7 +57,7 @@ static void gpio_setup(void) GPIO_CNF_OUTPUT_PUSHPULL, GPIO7); } -static void my_usart_print_string(u32 usart, char *s) +static void my_usart_print_string(uint32_t usart, char *s) { while (*s != 0) { usart_send(usart, *s); @@ -107,10 +107,10 @@ int main(void) dma_set_read_from_peripheral(DMA1, DMA_CHANNEL1); /* We want to transfer string s1. */ - dma_set_peripheral_address(DMA1, DMA_CHANNEL1, (u32)&s1); + dma_set_peripheral_address(DMA1, DMA_CHANNEL1, (uint32_t)&s1); /* Destination should be string s2. */ - dma_set_memory_address(DMA1, DMA_CHANNEL1, (u32)&s2); + dma_set_memory_address(DMA1, DMA_CHANNEL1, (uint32_t)&s2); /* * Set number of DATA to transfer. diff --git a/examples/stm32/f1/other/dogm128/dogm128.c b/examples/stm32/f1/other/dogm128/dogm128.c index 0c1bf80..566b824 100644 --- a/examples/stm32/f1/other/dogm128/dogm128.c +++ b/examples/stm32/f1/other/dogm128/dogm128.c @@ -19,13 +19,13 @@ #include "./dogm128.h" -u8 dogm128_ram[1024]; -u8 dogm128_cursor_x; -u8 dogm128_cursor_y; +uint8_t dogm128_ram[1024]; +uint8_t dogm128_cursor_x; +uint8_t dogm128_cursor_y; -void dogm128_send_command(u8 command) +void dogm128_send_command(uint8_t command) { - u32 i; + uint32_t i; gpio_clear(DOGM128_A0_PORT, DOGM128_A0_PIN); /* A0 low for commands */ spi_send(DOGM128_SPI, command); @@ -34,9 +34,9 @@ void dogm128_send_command(u8 command) ; } -void dogm128_send_data(u8 data) +void dogm128_send_data(uint8_t data) { - u32 i; + uint32_t i; gpio_set(DOGM128_A0_PORT, DOGM128_A0_PIN); /* A0 high for data */ spi_send(DOGM128_SPI, data); @@ -47,7 +47,7 @@ void dogm128_send_data(u8 data) void dogm128_init(void) { - u32 i; + uint32_t i; /* Reset the display (reset low for dogm128). */ gpio_clear(DOGM128_RESET_PORT, DOGM128_RESET_PIN); @@ -84,9 +84,9 @@ void dogm128_init(void) spi_set_nss_high(DOGM128_SPI); } -void dogm128_print_char(u8 data) +void dogm128_print_char(uint8_t data) { - u8 i, page, shift, xcoord, ycoord; + uint8_t i, page, shift, xcoord, ycoord; xcoord = dogm128_cursor_x; ycoord = dogm128_cursor_y; @@ -128,7 +128,7 @@ void dogm128_print_char(u8 data) } } -void dogm128_set_cursor(u8 xcoord, u8 ycoord) +void dogm128_set_cursor(uint8_t xcoord, uint8_t ycoord) { dogm128_cursor_x = xcoord; dogm128_cursor_y = ycoord; @@ -142,13 +142,13 @@ void dogm128_print_string(char *s) } } -void dogm128_set_dot(u8 xcoord, u8 ycoord) +void dogm128_set_dot(uint8_t xcoord, uint8_t ycoord) { dogm128_ram[(((63 - ycoord) / 8) * 128) + xcoord] |= (1 << ((63 - ycoord) % 8)); } -void dogm128_clear_dot(u8 xcoord, u8 ycoord) +void dogm128_clear_dot(uint8_t xcoord, uint8_t ycoord) { dogm128_ram[(((63 - ycoord) / 8) * 128) + xcoord] &= ~(1 << ((63 - ycoord) % 8)); @@ -156,7 +156,7 @@ void dogm128_clear_dot(u8 xcoord, u8 ycoord) void dogm128_update_display(void) { - u8 page, column; + uint8_t page, column; /* Tell the display that we want to start. */ spi_set_nss_low(DOGM128_SPI); @@ -196,7 +196,7 @@ void dogm128_clear(void) * little bit. */ -const u8 dogm128_font[96][6] = { +const uint8_t dogm128_font[96][6] = { /* 20 SPACE */ {0x00, 0x00, 0x00, 0xAA, 0xAA, 0xAA}, /* 21 ! */ {0x5E, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA}, diff --git a/examples/stm32/f1/other/dogm128/dogm128.h b/examples/stm32/f1/other/dogm128/dogm128.h index 33ab129..971d3d0 100644 --- a/examples/stm32/f1/other/dogm128/dogm128.h +++ b/examples/stm32/f1/other/dogm128/dogm128.h @@ -69,18 +69,18 @@ #define DOGM128_STATIC_INDICATOR_ON 0xAD #define DOGM128_BOOSTER_RATIO_SET 0xF8 -extern const u8 dogm128_font[96][6]; -extern u8 dogm128_ram[1024]; -extern u8 dogm128_cursor_x; -extern u8 dogm128_cursor_y; +extern const uint8_t dogm128_font[96][6]; +extern uint8_t dogm128_ram[1024]; +extern uint8_t dogm128_cursor_x; +extern uint8_t dogm128_cursor_y; -void dogm128_send_command(u8 command); -void dogm128_set_cursor(u8 xcoord, u8 ycoord); -void dogm128_print_char(u8 data); +void dogm128_send_command(uint8_t command); +void dogm128_set_cursor(uint8_t xcoord, uint8_t ycoord); +void dogm128_print_char(uint8_t data); void dogm128_print_string(char *s); -void dogm128_set_dot(u8 xcoord, u8 ycoord); -void dogm128_clear_dot(u8 xcoord, u8 ycoord); -void dogm128_send_data(u8 data); +void dogm128_set_dot(uint8_t xcoord, uint8_t ycoord); +void dogm128_clear_dot(uint8_t xcoord, uint8_t ycoord); +void dogm128_send_data(uint8_t data); void dogm128_init(void); void dogm128_update_display(void); void dogm128_clear(void); diff --git a/examples/stm32/f1/other/i2c_stts75_sensor/i2c_stts75_sensor.c b/examples/stm32/f1/other/i2c_stts75_sensor/i2c_stts75_sensor.c index 77f15ae..abeac58 100644 --- a/examples/stm32/f1/other/i2c_stts75_sensor/i2c_stts75_sensor.c +++ b/examples/stm32/f1/other/i2c_stts75_sensor/i2c_stts75_sensor.c @@ -105,7 +105,7 @@ static void i2c_setup(void) int main(void) { int i = 0; - u16 temperature; + uint16_t temperature; rcc_clock_setup_in_hse_16mhz_out_72mhz(); gpio_setup(); diff --git a/examples/stm32/f1/other/i2c_stts75_sensor/stts75.c b/examples/stm32/f1/other/i2c_stts75_sensor/stts75.c index e211f29..4039f97 100644 --- a/examples/stm32/f1/other/i2c_stts75_sensor/stts75.c +++ b/examples/stm32/f1/other/i2c_stts75_sensor/stts75.c @@ -20,9 +20,9 @@ #include #include "stts75.h" -void stts75_write_config(u32 i2c, u8 sensor) +void stts75_write_config(uint32_t i2c, uint8_t sensor) { - u32 reg32 __attribute__((unused)); + uint32_t reg32 __attribute__((unused)); /* Send START condition. */ i2c_send_start(i2c); @@ -51,9 +51,9 @@ void stts75_write_config(u32 i2c, u8 sensor) i2c_send_stop(i2c); } -void stts75_write_temp_os(u32 i2c, u8 sensor, u16 temp_os) +void stts75_write_temp_os(uint32_t i2c, uint8_t sensor, uint16_t temp_os) { - u32 reg32 __attribute__((unused)); + uint32_t reg32 __attribute__((unused)); /* Send START condition. */ i2c_send_start(i2c); @@ -74,9 +74,9 @@ void stts75_write_temp_os(u32 i2c, u8 sensor, u16 temp_os) /* Sending the data. */ i2c_send_data(i2c, 0x3); /* OvertemperatureShutdown register */ while (!(I2C_SR1(i2c) & I2C_SR1_BTF)); - i2c_send_data(i2c, (u8)(temp_os >> 8)); /* MSB */ + i2c_send_data(i2c, (uint8_t)(temp_os >> 8)); /* MSB */ while (!(I2C_SR1(i2c) & I2C_SR1_BTF)); - i2c_send_data(i2c, (u8)(temp_os & 0xff00)); /* LSB */ + i2c_send_data(i2c, (uint8_t)(temp_os & 0xff00)); /* LSB */ /* After the last byte we have to wait for TxE too. */ while (!(I2C_SR1(i2c) & (I2C_SR1_BTF | I2C_SR1_TxE))); @@ -84,9 +84,9 @@ void stts75_write_temp_os(u32 i2c, u8 sensor, u16 temp_os) i2c_send_stop(i2c); } -void stts75_write_temp_hyst(u32 i2c, u8 sensor, u16 temp_hyst) +void stts75_write_temp_hyst(uint32_t i2c, uint8_t sensor, uint16_t temp_hyst) { - u32 reg32 __attribute__((unused)); + uint32_t reg32 __attribute__((unused)); /* Send START condition. */ i2c_send_start(i2c); @@ -107,9 +107,9 @@ void stts75_write_temp_hyst(u32 i2c, u8 sensor, u16 temp_hyst) /* Sending the data. */ i2c_send_data(i2c, 0x2); /* TemperatureHysteresis register */ while (!(I2C_SR1(i2c) & I2C_SR1_BTF)); - i2c_send_data(i2c, (u8)(temp_hyst >> 8)); /* MSB */ + i2c_send_data(i2c, (uint8_t)(temp_hyst >> 8)); /* MSB */ while (!(I2C_SR1(i2c) & I2C_SR1_BTF)); - i2c_send_data(i2c, (u8)(temp_hyst & 0xff00)); /* LSB */ + i2c_send_data(i2c, (uint8_t)(temp_hyst & 0xff00)); /* LSB */ /* After the last byte we have to wait for TxE too. */ while (!(I2C_SR1(i2c) & (I2C_SR1_BTF | I2C_SR1_TxE))); @@ -117,10 +117,10 @@ void stts75_write_temp_hyst(u32 i2c, u8 sensor, u16 temp_hyst) i2c_send_stop(i2c); } -u16 stts75_read_temperature(u32 i2c, u8 sensor) +uint16_t stts75_read_temperature(uint32_t i2c, uint8_t sensor) { - u32 reg32 __attribute__((unused)); - u16 temperature; + uint32_t reg32 __attribute__((unused)); + uint16_t temperature; /* Send START condition. */ i2c_send_start(i2c); @@ -172,7 +172,7 @@ u16 stts75_read_temperature(u32 i2c, u8 sensor) /* Now the slave should begin to send us the first byte. Await BTF. */ while (!(I2C_SR1(i2c) & I2C_SR1_BTF)); - temperature = (u16)(I2C_DR(i2c) << 8); /* MSB */ + temperature = (uint16_t)(I2C_DR(i2c) << 8); /* MSB */ /* * Yes they mean it: we have to generate the STOP condition before diff --git a/examples/stm32/f1/other/i2c_stts75_sensor/stts75.h b/examples/stm32/f1/other/i2c_stts75_sensor/stts75.h index ed16dba..e998660 100644 --- a/examples/stm32/f1/other/i2c_stts75_sensor/stts75.h +++ b/examples/stm32/f1/other/i2c_stts75_sensor/stts75.h @@ -31,9 +31,9 @@ #define STTS75_SENSOR6 0x4e #define STTS75_SENSOR7 0x4f -void stts75_write_config(u32 i2c, u8 sensor); -void stts75_write_temp_os(u32 i2c, u8 sensor, u16 temp_os); -void stts75_write_temp_hyst(u32 i2c, u8 sensor, u16 temp_hyst); -u16 stts75_read_temperature(u32 i2c, u8 sensor); +void stts75_write_config(uint32_t i2c, uint8_t sensor); +void stts75_write_temp_os(uint32_t i2c, uint8_t sensor, uint16_t temp_os); +void stts75_write_temp_hyst(uint32_t i2c, uint8_t sensor, uint16_t temp_hyst); +uint16_t stts75_read_temperature(uint32_t i2c, uint8_t sensor); #endif diff --git a/examples/stm32/f1/other/rtc/rtc.c b/examples/stm32/f1/other/rtc/rtc.c index 5db5582..2c3d9f2 100644 --- a/examples/stm32/f1/other/rtc/rtc.c +++ b/examples/stm32/f1/other/rtc/rtc.c @@ -70,7 +70,7 @@ static void nvic_setup(void) void rtc_isr(void) { - volatile u32 j = 0, c = 0; + volatile uint32_t j = 0, c = 0; /* The interrupt flag isn't cleared by hardware, we have to do it. */ rtc_clear_flag(RTC_SEC); diff --git a/examples/stm32/f1/other/systick/systick.c b/examples/stm32/f1/other/systick/systick.c index aa91238..e99d78c 100644 --- a/examples/stm32/f1/other/systick/systick.c +++ b/examples/stm32/f1/other/systick/systick.c @@ -23,7 +23,7 @@ #include #include -u32 temp32; +uint32_t temp32; static void gpio_setup(void) { diff --git a/examples/stm32/f1/other/usb_cdcacm/cdcacm.c b/examples/stm32/f1/other/usb_cdcacm/cdcacm.c index a9e53ee..108d9c8 100644 --- a/examples/stm32/f1/other/usb_cdcacm/cdcacm.c +++ b/examples/stm32/f1/other/usb_cdcacm/cdcacm.c @@ -164,10 +164,10 @@ static const char *usb_strings[] = { }; /* Buffer to be used for control requests. */ -u8 usbd_control_buffer[128]; +uint8_t usbd_control_buffer[128]; -static int cdcacm_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, u8 **buf, - u16 *len, void (**complete)(usbd_device *usbd_dev, struct usb_setup_data *req)) +static int cdcacm_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, uint8_t **buf, + uint16_t *len, void (**complete)(usbd_device *usbd_dev, struct usb_setup_data *req)) { (void)complete; (void)buf; @@ -203,7 +203,7 @@ static int cdcacm_control_request(usbd_device *usbd_dev, struct usb_setup_data * return 0; } -static void cdcacm_data_rx_cb(usbd_device *usbd_dev, u8 ep) +static void cdcacm_data_rx_cb(usbd_device *usbd_dev, uint8_t ep) { (void)ep; @@ -216,7 +216,7 @@ static void cdcacm_data_rx_cb(usbd_device *usbd_dev, u8 ep) } } -static void cdcacm_set_config(usbd_device *usbd_dev, u16 wValue) +static void cdcacm_set_config(usbd_device *usbd_dev, uint16_t wValue) { (void)wValue; diff --git a/examples/stm32/f1/other/usb_dfu/usbdfu.c b/examples/stm32/f1/other/usb_dfu/usbdfu.c index 1816d17..618d672 100644 --- a/examples/stm32/f1/other/usb_dfu/usbdfu.c +++ b/examples/stm32/f1/other/usb_dfu/usbdfu.c @@ -32,15 +32,15 @@ #define CMD_ERASE 0x41 /* We need a special large control buffer for this device: */ -u8 usbd_control_buffer[1024]; +uint8_t usbd_control_buffer[1024]; static enum dfu_state usbdfu_state = STATE_DFU_IDLE; static struct { - u8 buf[sizeof(usbd_control_buffer)]; - u16 len; - u32 addr; - u16 blocknum; + uint8_t buf[sizeof(usbd_control_buffer)]; + uint16_t len; + uint32_t addr; + uint16_t blocknum; } prog; const struct usb_device_descriptor dev = { @@ -113,7 +113,7 @@ static const char *usb_strings[] = { "@Internal Flash /0x08000000/8*001Ka,56*001Kg", }; -static u8 usbdfu_getstatus(u32 *bwPollTimeout) +static uint8_t usbdfu_getstatus(uint32_t *bwPollTimeout) { switch (usbdfu_state) { case STATE_DFU_DNLOAD_SYNC: @@ -142,20 +142,20 @@ static void usbdfu_getstatus_complete(usbd_device *usbd_dev, struct usb_setup_da switch (prog.buf[0]) { case CMD_ERASE: { - u32 *dat = (u32 *)(prog.buf + 1); + uint32_t *dat = (uint32_t *)(prog.buf + 1); flash_erase_page(*dat); } case CMD_SETADDR: { - u32 *dat = (u32 *)(prog.buf + 1); + uint32_t *dat = (uint32_t *)(prog.buf + 1); prog.addr = *dat; } } } else { - u32 baseaddr = prog.addr + ((prog.blocknum - 2) * + uint32_t baseaddr = prog.addr + ((prog.blocknum - 2) * dfu_function.wTransferSize); for (i = 0; i < prog.len; i += 2) { - u16 *dat = (u16 *)(prog.buf + i); + uint16_t *dat = (uint16_t *)(prog.buf + i); flash_program_half_word(baseaddr + i, *dat); } @@ -174,8 +174,8 @@ static void usbdfu_getstatus_complete(usbd_device *usbd_dev, struct usb_setup_da } } -static int usbdfu_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, u8 **buf, - u16 *len, void (**complete)(usbd_device *usbd_dev, struct usb_setup_data *req)) +static int usbdfu_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, uint8_t **buf, + uint16_t *len, void (**complete)(usbd_device *usbd_dev, struct usb_setup_data *req)) { (void)usbd_dev; @@ -208,7 +208,7 @@ static int usbdfu_control_request(usbd_device *usbd_dev, struct usb_setup_data * /* Upload not supported for now. */ return 0; case DFU_GETSTATUS: { - u32 bwPollTimeout = 0; /* 24-bit integer in DFU class spec */ + uint32_t bwPollTimeout = 0; /* 24-bit integer in DFU class spec */ (*buf)[0] = usbdfu_getstatus(&bwPollTimeout); (*buf)[1] = bwPollTimeout & 0xFF; (*buf)[2] = (bwPollTimeout >> 8) & 0xFF; @@ -237,12 +237,12 @@ int main(void) if (!gpio_get(GPIOA, GPIO10)) { /* Boot the application if it's valid. */ - if ((*(volatile u32 *)APP_ADDRESS & 0x2FFE0000) == 0x20000000) { + if ((*(volatile uint32_t *)APP_ADDRESS & 0x2FFE0000) == 0x20000000) { /* Set vector table base address. */ SCB_VTOR = APP_ADDRESS & 0xFFFF; /* Initialise master stack pointer. */ asm volatile("msr msp, %0"::"g" - (*(volatile u32 *)APP_ADDRESS)); + (*(volatile uint32_t *)APP_ADDRESS)); /* Jump to application. */ (*(void (**)())(APP_ADDRESS + 4))(); } diff --git a/examples/stm32/f1/other/usb_hid/usbhid.c b/examples/stm32/f1/other/usb_hid/usbhid.c index c4dd838..31f1360 100644 --- a/examples/stm32/f1/other/usb_hid/usbhid.c +++ b/examples/stm32/f1/other/usb_hid/usbhid.c @@ -53,7 +53,7 @@ const struct usb_device_descriptor dev_descr = { }; /* I have no idea what this means. I haven't read the HID spec. */ -static const u8 hid_report_descriptor[] = { +static const uint8_t hid_report_descriptor[] = { 0x05, 0x01, 0x09, 0x02, 0xA1, 0x01, 0x09, 0x01, 0xA1, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, 0x03, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, @@ -69,8 +69,8 @@ static const u8 hid_report_descriptor[] = { static const struct { struct usb_hid_descriptor hid_descriptor; struct { - u8 bReportDescriptorType; - u16 wDescriptorLength; + uint8_t bReportDescriptorType; + uint16_t wDescriptorLength; } __attribute__((packed)) hid_report; } __attribute__((packed)) hid_function = { .hid_descriptor = { @@ -172,9 +172,9 @@ static const char *usb_strings[] = { }; /* Buffer to be used for control requests. */ -u8 usbd_control_buffer[128]; +uint8_t usbd_control_buffer[128]; -static int hid_control_request(usbd_device *dev, struct usb_setup_data *req, u8 **buf, u16 *len, +static int hid_control_request(usbd_device *dev, struct usb_setup_data *req, uint8_t **buf, uint16_t *len, void (**complete)(usbd_device *, struct usb_setup_data *)) { (void)complete; @@ -186,7 +186,7 @@ static int hid_control_request(usbd_device *dev, struct usb_setup_data *req, u8 return 0; /* Handle the HID report descriptor. */ - *buf = (u8 *)hid_report_descriptor; + *buf = (uint8_t *)hid_report_descriptor; *len = sizeof(hid_report_descriptor); return 1; @@ -205,7 +205,7 @@ static void dfu_detach_complete(usbd_device *dev, struct usb_setup_data *req) scb_reset_core(); } -static int dfu_control_request(usbd_device *dev, struct usb_setup_data *req, u8 **buf, u16 *len, +static int dfu_control_request(usbd_device *dev, struct usb_setup_data *req, uint8_t **buf, uint16_t *len, void (**complete)(usbd_device *, struct usb_setup_data *)) { (void)buf; @@ -221,7 +221,7 @@ static int dfu_control_request(usbd_device *dev, struct usb_setup_data *req, u8 } #endif -static void hid_set_config(usbd_device *dev, u16 wValue) +static void hid_set_config(usbd_device *dev, uint16_t wValue) { (void)wValue; (void)dev; @@ -273,7 +273,7 @@ void sys_tick_handler(void) { static int x = 0; static int dir = 1; - u8 buf[4] = {0, 0, 0, 0}; + uint8_t buf[4] = {0, 0, 0, 0}; buf[1] = dir; x += dir; diff --git a/examples/stm32/f1/stm32-h103/button/button.c b/examples/stm32/f1/stm32-h103/button/button.c index 927dd71..6f90162 100644 --- a/examples/stm32/f1/stm32-h103/button/button.c +++ b/examples/stm32/f1/stm32-h103/button/button.c @@ -23,7 +23,7 @@ #include #include -u16 exti_line_state; +uint16_t exti_line_state; /* Set STM32 to 72 MHz. */ static void clock_setup(void) diff --git a/examples/stm32/f1/stm32-h103/exti_both/exti_both.c b/examples/stm32/f1/stm32-h103/exti_both/exti_both.c index 2a086f8..683f020 100644 --- a/examples/stm32/f1/stm32-h103/exti_both/exti_both.c +++ b/examples/stm32/f1/stm32-h103/exti_both/exti_both.c @@ -23,7 +23,7 @@ #include #include -u16 exti_line_state; +uint16_t exti_line_state; /* Set STM32 to 72 MHz. */ static void clock_setup(void) diff --git a/examples/stm32/f1/stm32-h103/exti_rising_falling/exti_rising_falling.c b/examples/stm32/f1/stm32-h103/exti_rising_falling/exti_rising_falling.c index 76db50f..83ccff7 100644 --- a/examples/stm32/f1/stm32-h103/exti_rising_falling/exti_rising_falling.c +++ b/examples/stm32/f1/stm32-h103/exti_rising_falling/exti_rising_falling.c @@ -26,7 +26,7 @@ #define FALLING 0 #define RISING 1 -u16 exti_direction = FALLING; +uint16_t exti_direction = FALLING; /* Set STM32 to 72 MHz. */ static void clock_setup(void) diff --git a/examples/stm32/f1/stm32-h103/led_stripe/led_stripe.c b/examples/stm32/f1/stm32-h103/led_stripe/led_stripe.c index 4407c66..614c548 100644 --- a/examples/stm32/f1/stm32-h103/led_stripe/led_stripe.c +++ b/examples/stm32/f1/stm32-h103/led_stripe/led_stripe.c @@ -57,9 +57,9 @@ } struct color { - u8 r; - u8 g; - u8 b; + uint8_t r; + uint8_t g; + uint8_t b; }; /* Set STM32 to 72 MHz. */ diff --git a/examples/stm32/f1/stm32-h103/pwm_6step/pwm_6step.c b/examples/stm32/f1/stm32-h103/pwm_6step/pwm_6step.c index b0efdde..1cebf4f 100644 --- a/examples/stm32/f1/stm32-h103/pwm_6step/pwm_6step.c +++ b/examples/stm32/f1/stm32-h103/pwm_6step/pwm_6step.c @@ -26,7 +26,7 @@ #define FALLING 0 #define RISING 1 -u16 exti_direction = FALLING; +uint16_t exti_direction = FALLING; static void clock_setup(void) { diff --git a/examples/stm32/f1/stm32-h103/timer/timer.c b/examples/stm32/f1/stm32-h103/timer/timer.c index ed157ef..bdeaf13 100644 --- a/examples/stm32/f1/stm32-h103/timer/timer.c +++ b/examples/stm32/f1/stm32-h103/timer/timer.c @@ -23,7 +23,7 @@ #include #include -u16 frequency_sequence[18] = { +uint16_t frequency_sequence[18] = { 1000, 500, 1000, @@ -46,9 +46,9 @@ u16 frequency_sequence[18] = { int frequency_sel = 0; -u16 compare_time; -u16 new_time; -u16 frequency; +uint16_t compare_time; +uint16_t new_time; +uint16_t frequency; int debug = 0; static void clock_setup(void) diff --git a/examples/stm32/f1/stm32-h103/traceswo/traceswo.c b/examples/stm32/f1/stm32-h103/traceswo/traceswo.c index b29b9a7..a900795 100644 --- a/examples/stm32/f1/stm32-h103/traceswo/traceswo.c +++ b/examples/stm32/f1/stm32-h103/traceswo/traceswo.c @@ -53,7 +53,7 @@ static void trace_setup(void) /* Unlock access to ITM registers. */ /* FIXME: Magic numbers... Is this Cortex-M3 generic? */ - *((volatile u32 *)0xE0000FB0) = 0xC5ACCE55; + *((volatile uint32_t *)0xE0000FB0) = 0xC5ACCE55; /* Enable ITM with ID = 1. */ ITM_TCR = (1 << 16) | ITM_TCR_ITMENA; diff --git a/examples/stm32/f1/stm32-h103/usart_irq/usart_irq.c b/examples/stm32/f1/stm32-h103/usart_irq/usart_irq.c index 7ab4b53..bb4819a 100644 --- a/examples/stm32/f1/stm32-h103/usart_irq/usart_irq.c +++ b/examples/stm32/f1/stm32-h103/usart_irq/usart_irq.c @@ -73,7 +73,7 @@ static void gpio_setup(void) void usart1_isr(void) { - static u8 data = 'A'; + static uint8_t data = 'A'; /* Check if we were called because of RXNE. */ if (((USART_CR1(USART1) & USART_CR1_RXNEIE) != 0) && diff --git a/examples/stm32/f1/stm32-h103/usart_irq_printf/usart_irq_printf.c b/examples/stm32/f1/stm32-h103/usart_irq_printf/usart_irq_printf.c index e0cc1fd..8d4d207 100644 --- a/examples/stm32/f1/stm32-h103/usart_irq_printf/usart_irq_printf.c +++ b/examples/stm32/f1/stm32-h103/usart_irq_printf/usart_irq_printf.c @@ -32,20 +32,20 @@ * https://github.com/open-bldc/open-bldc/tree/master/source/libgovernor *****************************************************************************/ -typedef s32 ring_size_t; +typedef int32_t ring_size_t; struct ring { - u8 *data; + uint8_t *data; ring_size_t size; - u32 begin; - u32 end; + uint32_t begin; + uint32_t end; }; #define RING_SIZE(RING) ((RING)->size - 1) #define RING_DATA(RING) (RING)->data #define RING_EMPTY(RING) ((RING)->begin == (RING)->end) -static void ring_init(struct ring *ring, u8 *buf, ring_size_t size) +static void ring_init(struct ring *ring, uint8_t *buf, ring_size_t size) { ring->data = buf; ring->size = size; @@ -53,20 +53,20 @@ static void ring_init(struct ring *ring, u8 *buf, ring_size_t size) ring->end = 0; } -static s32 ring_write_ch(struct ring *ring, u8 ch) +static int32_t ring_write_ch(struct ring *ring, uint8_t ch) { if (((ring->end + 1) % ring->size) != ring->begin) { ring->data[ring->end++] = ch; ring->end %= ring->size; - return (u32)ch; + return (uint32_t)ch; } return -1; } -static s32 ring_write(struct ring *ring, u8 *data, ring_size_t size) +static int32_t ring_write(struct ring *ring, uint8_t *data, ring_size_t size) { - s32 i; + int32_t i; for (i = 0; i < size; i++) { if (ring_write_ch(ring, data[i]) < 0) @@ -76,9 +76,9 @@ static s32 ring_write(struct ring *ring, u8 *data, ring_size_t size) return i; } -static s32 ring_read_ch(struct ring *ring, u8 *ch) +static int32_t ring_read_ch(struct ring *ring, uint8_t *ch) { - s32 ret = -1; + int32_t ret = -1; if (ring->begin != ring->end) { ret = ring->data[ring->begin++]; @@ -91,9 +91,9 @@ static s32 ring_read_ch(struct ring *ring, u8 *ch) } /* Not used! -static s32 ring_read(struct ring *ring, u8 *data, ring_size_t size) +static int32_t ring_read(struct ring *ring, uint8_t *data, ring_size_t size) { - s32 i; + int32_t i; for (i = 0; i < size; i++) { if (ring_read_ch(ring, data + i) < 0) @@ -111,7 +111,7 @@ static s32 ring_read(struct ring *ring, u8 *data, ring_size_t size) #define BUFFER_SIZE 1024 struct ring output_ring; -u8 output_ring_buffer[BUFFER_SIZE]; +uint8_t output_ring_buffer[BUFFER_SIZE]; int _write(int file, char *ptr, int len); @@ -187,7 +187,7 @@ void usart1_isr(void) if (((USART_CR1(USART1) & USART_CR1_TXEIE) != 0) && ((USART_SR(USART1) & USART_SR_TXE) != 0)) { - s32 data; + int32_t data; data = ring_read_ch(&output_ring, NULL); @@ -206,7 +206,7 @@ int _write(int file, char *ptr, int len) int ret; if (file == 1) { - ret = ring_write(&output_ring, (u8 *)ptr, len); + ret = ring_write(&output_ring, (uint8_t *)ptr, len); if (ret < 0) ret = -ret; @@ -240,7 +240,7 @@ void sys_tick_handler(void) static int counter = 0; static float fcounter = 0.0; static double dcounter = 0.0; - static u32 temp32 = 0; + static uint32_t temp32 = 0; temp32++; diff --git a/examples/stm32/f1/stm32-h103/usb_cdcacm/cdcacm.c b/examples/stm32/f1/stm32-h103/usb_cdcacm/cdcacm.c index 63f004e..9625fcf 100644 --- a/examples/stm32/f1/stm32-h103/usb_cdcacm/cdcacm.c +++ b/examples/stm32/f1/stm32-h103/usb_cdcacm/cdcacm.c @@ -164,10 +164,10 @@ static const char *usb_strings[] = { }; /* Buffer to be used for control requests. */ -u8 usbd_control_buffer[128]; +uint8_t usbd_control_buffer[128]; -static int cdcacm_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, u8 **buf, - u16 *len, void (**complete)(usbd_device *usbd_dev, struct usb_setup_data *req)) +static int cdcacm_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, uint8_t **buf, + uint16_t *len, void (**complete)(usbd_device *usbd_dev, struct usb_setup_data *req)) { (void)complete; (void)buf; @@ -202,7 +202,7 @@ static int cdcacm_control_request(usbd_device *usbd_dev, struct usb_setup_data * return 0; } -static void cdcacm_data_rx_cb(usbd_device *usbd_dev, u8 ep) +static void cdcacm_data_rx_cb(usbd_device *usbd_dev, uint8_t ep) { (void)ep; (void)usbd_dev; @@ -216,7 +216,7 @@ static void cdcacm_data_rx_cb(usbd_device *usbd_dev, u8 ep) } } -static void cdcacm_set_config(usbd_device *usbd_dev, u16 wValue) +static void cdcacm_set_config(usbd_device *usbd_dev, uint16_t wValue) { (void)wValue; (void)usbd_dev; diff --git a/examples/stm32/f1/stm32-h103/usb_dfu/usbdfu.c b/examples/stm32/f1/stm32-h103/usb_dfu/usbdfu.c index 75c8a7c..dab444f 100644 --- a/examples/stm32/f1/stm32-h103/usb_dfu/usbdfu.c +++ b/examples/stm32/f1/stm32-h103/usb_dfu/usbdfu.c @@ -32,15 +32,15 @@ #define CMD_ERASE 0x41 /* We need a special large control buffer for this device: */ -u8 usbd_control_buffer[1024]; +uint8_t usbd_control_buffer[1024]; static enum dfu_state usbdfu_state = STATE_DFU_IDLE; static struct { - u8 buf[sizeof(usbd_control_buffer)]; - u16 len; - u32 addr; - u16 blocknum; + uint8_t buf[sizeof(usbd_control_buffer)]; + uint16_t len; + uint32_t addr; + uint16_t blocknum; } prog; const struct usb_device_descriptor dev = { @@ -113,7 +113,7 @@ static const char *usb_strings[] = { "@Internal Flash /0x08000000/8*001Ka,56*001Kg", }; -static u8 usbdfu_getstatus(usbd_device *usbd_dev, u32 *bwPollTimeout) +static uint8_t usbdfu_getstatus(usbd_device *usbd_dev, uint32_t *bwPollTimeout) { (void)usbd_dev; @@ -144,20 +144,20 @@ static void usbdfu_getstatus_complete(usbd_device *usbd_dev, struct usb_setup_da switch (prog.buf[0]) { case CMD_ERASE: { - u32 *dat = (u32 *)(prog.buf + 1); + uint32_t *dat = (uint32_t *)(prog.buf + 1); flash_erase_page(*dat); } case CMD_SETADDR: { - u32 *dat = (u32 *)(prog.buf + 1); + uint32_t *dat = (uint32_t *)(prog.buf + 1); prog.addr = *dat; } } } else { - u32 baseaddr = prog.addr + ((prog.blocknum - 2) * + uint32_t baseaddr = prog.addr + ((prog.blocknum - 2) * dfu_function.wTransferSize); for (i = 0; i < prog.len; i += 2) { - u16 *dat = (u16 *)(prog.buf + i); + uint16_t *dat = (uint16_t *)(prog.buf + i); flash_program_half_word(baseaddr + i, *dat); } @@ -176,8 +176,8 @@ static void usbdfu_getstatus_complete(usbd_device *usbd_dev, struct usb_setup_da } } -static int usbdfu_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, u8 **buf, - u16 *len, void (**complete)(usbd_device *usbd_dev, struct usb_setup_data *req)) +static int usbdfu_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, uint8_t **buf, + uint16_t *len, void (**complete)(usbd_device *usbd_dev, struct usb_setup_data *req)) { if ((req->bmRequestType & 0x7F) != 0x21) return 0; /* Only accept class request. */ @@ -208,7 +208,7 @@ static int usbdfu_control_request(usbd_device *usbd_dev, struct usb_setup_data * /* Upload not supported for now. */ return 0; case DFU_GETSTATUS: { - u32 bwPollTimeout = 0; /* 24-bit integer in DFU class spec */ + uint32_t bwPollTimeout = 0; /* 24-bit integer in DFU class spec */ (*buf)[0] = usbdfu_getstatus(usbd_dev, &bwPollTimeout); (*buf)[1] = bwPollTimeout & 0xFF; (*buf)[2] = (bwPollTimeout >> 8) & 0xFF; @@ -237,12 +237,12 @@ int main(void) if (!gpio_get(GPIOA, GPIO10)) { /* Boot the application if it's valid. */ - if ((*(volatile u32 *)APP_ADDRESS & 0x2FFE0000) == 0x20000000) { + if ((*(volatile uint32_t *)APP_ADDRESS & 0x2FFE0000) == 0x20000000) { /* Set vector table base address. */ SCB_VTOR = APP_ADDRESS & 0xFFFF; /* Initialise master stack pointer. */ asm volatile("msr msp, %0"::"g" - (*(volatile u32 *)APP_ADDRESS)); + (*(volatile uint32_t *)APP_ADDRESS)); /* Jump to application. */ (*(void (**)())(APP_ADDRESS + 4))(); } diff --git a/examples/stm32/f1/stm32-h103/usb_hid/usbhid.c b/examples/stm32/f1/stm32-h103/usb_hid/usbhid.c index fa018f4..e9a6e70 100644 --- a/examples/stm32/f1/stm32-h103/usb_hid/usbhid.c +++ b/examples/stm32/f1/stm32-h103/usb_hid/usbhid.c @@ -50,7 +50,7 @@ const struct usb_device_descriptor dev = { }; /* I have no idea what this means. I haven't read the HID spec. */ -static const u8 hid_report_descriptor[] = { +static const uint8_t hid_report_descriptor[] = { 0x05, 0x01, 0x09, 0x02, 0xA1, 0x01, 0x09, 0x01, 0xA1, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, 0x03, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, @@ -66,8 +66,8 @@ static const u8 hid_report_descriptor[] = { static const struct { struct usb_hid_descriptor hid_descriptor; struct { - u8 bReportDescriptorType; - u16 wDescriptorLength; + uint8_t bReportDescriptorType; + uint16_t wDescriptorLength; } __attribute__((packed)) hid_report; } __attribute__((packed)) hid_function = { .hid_descriptor = { @@ -169,9 +169,9 @@ static const char *usb_strings[] = { }; /* Buffer to be used for control requests. */ -u8 usbd_control_buffer[128]; +uint8_t usbd_control_buffer[128]; -static int hid_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, u8 **buf, u16 *len, +static int hid_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, uint8_t **buf, uint16_t *len, void (**complete)(usbd_device *usbd_dev, struct usb_setup_data *req)) { (void)complete; @@ -183,7 +183,7 @@ static int hid_control_request(usbd_device *usbd_dev, struct usb_setup_data *req return 0; /* Handle the HID report descriptor. */ - *buf = (u8 *)hid_report_descriptor; + *buf = (uint8_t *)hid_report_descriptor; *len = sizeof(hid_report_descriptor); return 1; @@ -202,7 +202,7 @@ static void dfu_detach_complete(usbd_device *usbd_dev, struct usb_setup_data *re scb_reset_core(); } -static int dfu_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, u8 **buf, u16 *len, +static int dfu_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, uint8_t **buf, uint16_t *len, void (**complete)(usbd_device *usbd_dev, struct usb_setup_data *req)) { (void)buf; @@ -218,7 +218,7 @@ static int dfu_control_request(usbd_device *usbd_dev, struct usb_setup_data *req } #endif -static void hid_set_config(usbd_device *usbd_dev, u16 wValue) +static void hid_set_config(usbd_device *usbd_dev, uint16_t wValue) { (void)wValue; (void)usbd_dev; @@ -276,7 +276,7 @@ void sys_tick_handler(void) { static int x = 0; static int dir = 1; - u8 buf[4] = {0, 0, 0, 0}; + uint8_t buf[4] = {0, 0, 0, 0}; buf[1] = dir; x += dir; diff --git a/examples/stm32/f1/stm32-h103/usb_iap/usbiap.c b/examples/stm32/f1/stm32-h103/usb_iap/usbiap.c index 789b23b..137e8cd 100644 --- a/examples/stm32/f1/stm32-h103/usb_iap/usbiap.c +++ b/examples/stm32/f1/stm32-h103/usb_iap/usbiap.c @@ -32,15 +32,15 @@ #define CMD_ERASE 0x41 /* We need a special large control buffer for this device: */ -u8 usbd_control_buffer[1024]; +uint8_t usbd_control_buffer[1024]; static enum dfu_state usbdfu_state = STATE_DFU_IDLE; static struct { - u8 buf[sizeof(usbd_control_buffer)]; - u16 len; - u32 addr; - u16 blocknum; + uint8_t buf[sizeof(usbd_control_buffer)]; + uint16_t len; + uint32_t addr; + uint16_t blocknum; } prog; const struct usb_device_descriptor dev = { @@ -113,7 +113,7 @@ static const char *usb_strings[] = { "@Internal Flash /0x08000000/8*001Ka,56*001Kg", }; -static u8 usbdfu_getstatus(usbd_device *usbd_dev, u32 *bwPollTimeout) +static uint8_t usbdfu_getstatus(usbd_device *usbd_dev, uint32_t *bwPollTimeout) { (void)usbd_dev; @@ -144,20 +144,20 @@ static void usbdfu_getstatus_complete(usbd_device *usbd_dev, struct usb_setup_da switch (prog.buf[0]) { case CMD_ERASE: { - u32 *dat = (u32 *)(prog.buf + 1); + uint32_t *dat = (uint32_t *)(prog.buf + 1); flash_erase_page(*dat); } case CMD_SETADDR: { - u32 *dat = (u32 *)(prog.buf + 1); + uint32_t *dat = (uint32_t *)(prog.buf + 1); prog.addr = *dat; } } } else { - u32 baseaddr = prog.addr + ((prog.blocknum - 2) * + uint32_t baseaddr = prog.addr + ((prog.blocknum - 2) * dfu_function.wTransferSize); for (i = 0; i < prog.len; i += 2) { - u16 *dat = (u16 *)(prog.buf + i); + uint16_t *dat = (uint16_t *)(prog.buf + i); flash_program_half_word(baseaddr + i, *dat); } @@ -176,8 +176,8 @@ static void usbdfu_getstatus_complete(usbd_device *usbd_dev, struct usb_setup_da } } -static int usbdfu_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, u8 **buf, - u16 *len, void (**complete)(usbd_device *usbd_dev, struct usb_setup_data *req)) +static int usbdfu_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, uint8_t **buf, + uint16_t *len, void (**complete)(usbd_device *usbd_dev, struct usb_setup_data *req)) { if ((req->bmRequestType & 0x7F) != 0x21) return 0; /* Only accept class request. */ @@ -208,7 +208,7 @@ static int usbdfu_control_request(usbd_device *usbd_dev, struct usb_setup_data * /* Upload not supported for now. */ return 0; case DFU_GETSTATUS: { - u32 bwPollTimeout = 0; /* 24-bit integer in DFU class spec */ + uint32_t bwPollTimeout = 0; /* 24-bit integer in DFU class spec */ (*buf)[0] = usbdfu_getstatus(usbd_dev, &bwPollTimeout); (*buf)[1] = bwPollTimeout & 0xFF; (*buf)[2] = (bwPollTimeout >> 8) & 0xFF; @@ -237,12 +237,12 @@ int main(void) if (!gpio_get(GPIOA, GPIO10)) { /* Boot the application if it's valid. */ - if ((*(volatile u32 *)APP_ADDRESS & 0x2FFE0000) == 0x20000000) { + if ((*(volatile uint32_t *)APP_ADDRESS & 0x2FFE0000) == 0x20000000) { /* Set vector table base address. */ SCB_VTOR = APP_ADDRESS & 0xFFFF; /* Initialise master stack pointer. */ asm volatile("msr msp, %0"::"g" - (*(volatile u32 *)APP_ADDRESS)); + (*(volatile uint32_t *)APP_ADDRESS)); /* Jump to application. */ (*(void (**)())(APP_ADDRESS + 4))(); } diff --git a/examples/stm32/f1/stm32-h107/flash_rw_example/flash_rw_example.c b/examples/stm32/f1/stm32-h107/flash_rw_example/flash_rw_example.c index ce82fdb..a52ae2c 100644 --- a/examples/stm32/f1/stm32-h107/flash_rw_example/flash_rw_example.c +++ b/examples/stm32/f1/stm32-h107/flash_rw_example/flash_rw_example.c @@ -24,7 +24,7 @@ #define USART_ECHO_EN 1 #define SEND_BUFFER_SIZE 256 -#define FLASH_OPERATION_ADDRESS ((u32)0x0800f000) +#define FLASH_OPERATION_ADDRESS ((uint32_t)0x0800f000) #define FLASH_PAGE_NUM_MAX 127 #define FLASH_PAGE_SIZE 0x800 #define FLASH_WRONG_DATA_WRITTEN 0x80 @@ -34,45 +34,45 @@ static void init_system(void); static void init_usart(void); /*usart operations*/ -static void usart_send_string(u32 usart, u8 *string, u16 str_size); -static void usart_get_string(u32 usart, u8 *string, u16 str_max_size); +static void usart_send_string(uint32_t usart, uint8_t *string, uint16_t str_size); +static void usart_get_string(uint32_t usart, uint8_t *string, uint16_t str_max_size); /*flash operations*/ -static u32 flash_program_data(u32 start_address, u8 *input_data, u16 num_elements); -static void flash_read_data(u32 start_address, u16 num_elements, u8 *output_data); +static uint32_t flash_program_data(uint32_t start_address, uint8_t *input_data, uint16_t num_elements); +static void flash_read_data(uint32_t start_address, uint16_t num_elements, uint8_t *output_data); /*local functions to work with strings*/ -static void local_ltoa_hex(u32 value, u8 *out_string); +static void local_ltoa_hex(uint32_t value, uint8_t *out_string); int main(void) { - u32 result = 0; - u8 str_send[SEND_BUFFER_SIZE], str_verify[SEND_BUFFER_SIZE]; + uint32_t result = 0; + uint8_t str_send[SEND_BUFFER_SIZE], str_verify[SEND_BUFFER_SIZE]; init_system(); while(1) { - usart_send_string(USART1, (u8*)"Please enter string to write into Flash memory:\n\r", SEND_BUFFER_SIZE); + usart_send_string(USART1, (uint8_t*)"Please enter string to write into Flash memory:\n\r", SEND_BUFFER_SIZE); usart_get_string(USART1, str_send, SEND_BUFFER_SIZE); result = flash_program_data(FLASH_OPERATION_ADDRESS, str_send, SEND_BUFFER_SIZE); switch(result) { case RESULT_OK: /*everything ok*/ - usart_send_string(USART1, (u8*)"Verification of written data: ", SEND_BUFFER_SIZE); + usart_send_string(USART1, (uint8_t*)"Verification of written data: ", SEND_BUFFER_SIZE); flash_read_data(FLASH_OPERATION_ADDRESS, SEND_BUFFER_SIZE, str_verify); usart_send_string(USART1, str_verify, SEND_BUFFER_SIZE); break; case FLASH_WRONG_DATA_WRITTEN: /*data read from Flash is different than written data*/ - usart_send_string(USART1, (u8*)"Wrong data written into flash memory", SEND_BUFFER_SIZE); + usart_send_string(USART1, (uint8_t*)"Wrong data written into flash memory", SEND_BUFFER_SIZE); break; default: /*wrong flags' values in Flash Status Register (FLASH_SR)*/ - usart_send_string(USART1, (u8*)"Wrong value of FLASH_SR: ", SEND_BUFFER_SIZE); + usart_send_string(USART1, (uint8_t*)"Wrong value of FLASH_SR: ", SEND_BUFFER_SIZE); local_ltoa_hex(result, str_send); usart_send_string(USART1, str_send, SEND_BUFFER_SIZE); break; } /*send end_of_line*/ - usart_send_string(USART1, (u8*)"\r\n", 3); + usart_send_string(USART1, (uint8_t*)"\r\n", 3); } return 0; } @@ -100,19 +100,19 @@ static void init_usart(void) usart_enable(USART1); } -static void usart_send_string(u32 usart, u8 *string, u16 str_size) +static void usart_send_string(uint32_t usart, uint8_t *string, uint16_t str_size) { - u16 iter = 0; + uint16_t iter = 0; do { usart_send_blocking(usart, string[iter++]); }while(string[iter] != 0 && iter < str_size); } -static void usart_get_string(u32 usart, u8 *out_string, u16 str_max_size) +static void usart_get_string(uint32_t usart, uint8_t *out_string, uint16_t str_max_size) { - u8 sign = 0; - u16 iter = 0; + uint8_t sign = 0; + uint16_t iter = 0; while(iter < str_max_size) { @@ -127,18 +127,18 @@ static void usart_get_string(u32 usart, u8 *out_string, u16 str_max_size) else { out_string[iter] = 0; - usart_send_string(USART1, (u8*)"\r\n", 3); + usart_send_string(USART1, (uint8_t*)"\r\n", 3); break; } } } -static u32 flash_program_data(u32 start_address, u8 *input_data, u16 num_elements) +static uint32_t flash_program_data(uint32_t start_address, uint8_t *input_data, uint16_t num_elements) { - u16 iter; - u32 current_address = start_address; - u32 page_address = start_address; - u32 flash_status = 0; + uint16_t iter; + uint32_t current_address = start_address; + uint32_t page_address = start_address; + uint32_t flash_status = 0; /*check if start_address is in proper range*/ if((start_address - FLASH_BASE) >= (FLASH_PAGE_SIZE * (FLASH_PAGE_NUM_MAX+1))) @@ -160,34 +160,34 @@ static u32 flash_program_data(u32 start_address, u8 *input_data, u16 num_element for(iter=0; iter #include -u16 exti_line_state; +uint16_t exti_line_state; /* Set STM32 to 24 MHz. */ static void clock_setup(void) diff --git a/examples/stm32/f1/stm32vl-discovery/rtc/rtc.c b/examples/stm32/f1/stm32vl-discovery/rtc/rtc.c index c705261..5fd3d1d 100644 --- a/examples/stm32/f1/stm32vl-discovery/rtc/rtc.c +++ b/examples/stm32/f1/stm32vl-discovery/rtc/rtc.c @@ -47,7 +47,7 @@ static void usart_setup(void) // usart_set_baudrate(USART1, 38400); /* TODO usart_set_baudrate() doesn't support 24MHz clock (yet). */ /* This is the equivalent: */ - USART_BRR(USART1) = (u16)((24000000 << 4) / (38400 * 16)); + USART_BRR(USART1) = (uint16_t)((24000000 << 4) / (38400 * 16)); usart_set_databits(USART1, 8); usart_set_stopbits(USART1, USART_STOPBITS_1); @@ -76,7 +76,7 @@ static void nvic_setup(void) void rtc_isr(void) { - volatile u32 j = 0, c = 0; + volatile uint32_t j = 0, c = 0; /* The interrupt flag isn't cleared by hardware, we have to do it. */ rtc_clear_flag(RTC_SEC); diff --git a/examples/stm32/f1/stm32vl-discovery/usart/usart.c b/examples/stm32/f1/stm32vl-discovery/usart/usart.c index 1eac6d9..b2b654b 100644 --- a/examples/stm32/f1/stm32vl-discovery/usart/usart.c +++ b/examples/stm32/f1/stm32vl-discovery/usart/usart.c @@ -43,7 +43,7 @@ static void usart_setup(void) // usart_set_baudrate(USART1, 38400); /* TODO usart_set_baudrate() doesn't support 24MHz clock (yet). */ /* This is the equivalent: */ - USART_BRR(USART1) = (u16)((24000000 << 4) / (38400 * 16)); + USART_BRR(USART1) = (uint16_t)((24000000 << 4) / (38400 * 16)); usart_set_databits(USART1, 8); usart_set_stopbits(USART1, USART_STOPBITS_1); diff --git a/examples/stm32/f2/jobygps/spi_test/spi_test.c b/examples/stm32/f2/jobygps/spi_test/spi_test.c index 3dbf288..6a65b2d 100644 --- a/examples/stm32/f2/jobygps/spi_test/spi_test.c +++ b/examples/stm32/f2/jobygps/spi_test/spi_test.c @@ -93,7 +93,7 @@ int _write(int file, char *ptr, int len) int main(void) { int counter = 0; - volatile u16 dummy __attribute__((unused)); + volatile uint16_t dummy __attribute__((unused)); clock_setup(); gpio_setup(); @@ -105,7 +105,7 @@ int main(void) printf("Hello, world! %i\r\n", counter); /* Stops RX buffer overflow, but probably not needed. */ dummy = spi_read(SPI2); - spi_send(SPI2, (u8) counter); + spi_send(SPI2, (uint8_t) counter); gpio_toggle(GPIOC, GPIO3); } diff --git a/examples/stm32/f4/stm32f4-discovery/button/button.c b/examples/stm32/f4/stm32f4-discovery/button/button.c index 709900d..341f161 100644 --- a/examples/stm32/f4/stm32f4-discovery/button/button.c +++ b/examples/stm32/f4/stm32f4-discovery/button/button.c @@ -22,7 +22,7 @@ #include #include -u16 exti_line_state; +uint16_t exti_line_state; /* Set STM32 to 168 MHz. */ static void clock_setup(void) diff --git a/examples/stm32/f4/stm32f4-discovery/random/random.c b/examples/stm32/f4/stm32f4-discovery/random/random.c index 74f6775..cc1b40c 100644 --- a/examples/stm32/f4/stm32f4-discovery/random/random.c +++ b/examples/stm32/f4/stm32f4-discovery/random/random.c @@ -50,11 +50,11 @@ static void gpio_setup(void) } /* Tried to folow the guidelines in the stm32f4 user manual.*/ -static u32 random_int(void) +static uint32_t random_int(void) { - static u32 last_value=0; - static u32 new_value=0; - u32 error_bits = 0; + static uint32_t last_value=0; + static uint32_t new_value=0; + uint32_t error_bits = 0; error_bits = RNG_SR_SEIS | RNG_SR_CEIS; while (new_value==last_value) { /* Check for error flags and if data is ready. */ @@ -73,7 +73,7 @@ int main(void) gpio_setup(); rng_setup(); while(1){ - u32 rnd; + uint32_t rnd; rnd = random_int(); for(i=0;i!=32;++i){ if ( (rnd & (1 << i))!=0 ) diff --git a/examples/stm32/f4/stm32f4-discovery/usart_irq/usart_irq.c b/examples/stm32/f4/stm32f4-discovery/usart_irq/usart_irq.c index 430fcae..73c8edf 100644 --- a/examples/stm32/f4/stm32f4-discovery/usart_irq/usart_irq.c +++ b/examples/stm32/f4/stm32f4-discovery/usart_irq/usart_irq.c @@ -86,7 +86,7 @@ int main(void) void usart2_isr(void) { - static u8 data = 'A'; + static uint8_t data = 'A'; /* Check if we were called because of RXNE. */ if (((USART_CR1(USART2) & USART_CR1_RXNEIE) != 0) && diff --git a/examples/stm32/f4/stm32f4-discovery/usb_cdcacm/cdcacm.c b/examples/stm32/f4/stm32f4-discovery/usb_cdcacm/cdcacm.c index ca4c86f..11b48b2 100644 --- a/examples/stm32/f4/stm32f4-discovery/usb_cdcacm/cdcacm.c +++ b/examples/stm32/f4/stm32f4-discovery/usb_cdcacm/cdcacm.c @@ -165,10 +165,10 @@ static const char *usb_strings[] = { }; /* Buffer to be used for control requests. */ -u8 usbd_control_buffer[128]; +uint8_t usbd_control_buffer[128]; -static int cdcacm_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, u8 **buf, - u16 *len, void (**complete)(usbd_device *usbd_dev, struct usb_setup_data *req)) +static int cdcacm_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, uint8_t **buf, + uint16_t *len, void (**complete)(usbd_device *usbd_dev, struct usb_setup_data *req)) { (void)complete; (void)buf; @@ -192,7 +192,7 @@ static int cdcacm_control_request(usbd_device *usbd_dev, struct usb_setup_data * return 0; } -static void cdcacm_data_rx_cb(usbd_device *usbd_dev, u8 ep) +static void cdcacm_data_rx_cb(usbd_device *usbd_dev, uint8_t ep) { (void)ep; @@ -207,7 +207,7 @@ static void cdcacm_data_rx_cb(usbd_device *usbd_dev, u8 ep) gpio_toggle(GPIOC, GPIO5); } -static void cdcacm_set_config(usbd_device *usbd_dev, u16 wValue) +static void cdcacm_set_config(usbd_device *usbd_dev, uint16_t wValue) { (void)wValue; diff --git a/examples/stm32/l1/stm32l-discovery/button-irq-printf-lowpower/main.c b/examples/stm32/l1/stm32l-discovery/button-irq-printf-lowpower/main.c index 5b73c5b..9cc786f 100644 --- a/examples/stm32/l1/stm32l-discovery/button-irq-printf-lowpower/main.c +++ b/examples/stm32/l1/stm32l-discovery/button-irq-printf-lowpower/main.c @@ -162,8 +162,8 @@ static int setup_rtc(void) ; /* set synch prescaler, using defaults for 1Hz out */ - u32 sync = 255; - u32 async = 127; + uint32_t sync = 255; + uint32_t async = 127; rtc_set_prescaler(sync, async); /* load time and date here if desired, and hour format */ diff --git a/libopencm3 b/libopencm3 index a596609..34de1e7 160000 --- a/libopencm3 +++ b/libopencm3 @@ -1 +1 @@ -Subproject commit a5966093e636fde4732cae2340ce298fe8ec7153 +Subproject commit 34de1e776e58f9a26fd082d8d92f1189497fd481