fixup/test compiler warnings
This commit is contained in:
parent
4f64f3af80
commit
7e4e3290d5
@ -19,6 +19,12 @@ add_subdirectory(blink)
|
||||
# Add hello world example
|
||||
add_subdirectory(hello_world)
|
||||
|
||||
add_compile_options(-Wall
|
||||
-Wno-format # int != int32_t as far as the compiler is concerned because gcc has int32_t as long int
|
||||
-Wno-unused-function # we have some for the docs that aren't called
|
||||
-Wno-maybe-uninitialized
|
||||
)
|
||||
|
||||
# Hardware-specific examples in subdirectories:
|
||||
add_subdirectory(adc)
|
||||
add_subdirectory(clocks)
|
||||
|
||||
@ -144,7 +144,7 @@ int main() {
|
||||
|
||||
lcd_init();
|
||||
|
||||
static uint8_t *message[] =
|
||||
static char *message[] =
|
||||
{
|
||||
"RP2040 by", "Raspberry Pi",
|
||||
"A brand new", "microcontroller",
|
||||
|
||||
@ -37,7 +37,7 @@ int32_t fibonacci(int32_t n) {
|
||||
if (n == 0) return 0;
|
||||
if (n == 1) return 1;
|
||||
|
||||
int n1 = 0, n2 = 1, n3;
|
||||
int n1 = 0, n2 = 1, n3 = 0;
|
||||
|
||||
for (int i = 2; i <= n; i++) {
|
||||
n3 = n1 + n2;
|
||||
|
||||
@ -50,7 +50,7 @@ int32_t fibonacci(int32_t n) {
|
||||
if (n == 0) return 0;
|
||||
if (n == 1) return 1;
|
||||
|
||||
int n1 = 0, n2 = 1, n3;
|
||||
int n1 = 0, n2 = 1, n3 = 0;
|
||||
|
||||
for (int i = 2; i <= n; i++) {
|
||||
n3 = n1 + n2;
|
||||
|
||||
@ -32,7 +32,11 @@ void pio_i2c_rx_enable(PIO pio, uint sm, bool en) {
|
||||
static inline void pio_i2c_put16(PIO pio, uint sm, uint16_t data) {
|
||||
while (pio_sm_is_tx_fifo_full(pio, sm))
|
||||
;
|
||||
// some versions of GCC dislike this
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
*(io_rw_16 *)&pio->txf[sm] = data;
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
||||
|
||||
@ -43,7 +47,11 @@ void pio_i2c_put_or_err(PIO pio, uint sm, uint16_t data) {
|
||||
return;
|
||||
if (pio_i2c_check_error(pio, sm))
|
||||
return;
|
||||
// some versions of GCC dislike this
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
*(io_rw_16 *)&pio->txf[sm] = data;
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
||||
uint8_t pio_i2c_get(PIO pio, uint sm) {
|
||||
|
||||
@ -66,6 +66,7 @@ int main() {
|
||||
|
||||
queue_free(&sample_fifo);
|
||||
printf("Done\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool timer_callback(repeating_timer_t *rt) {
|
||||
|
||||
@ -51,7 +51,7 @@ int main() {
|
||||
// Actually, we want a different speed
|
||||
// The call will return the actual baud rate selected, which will be as close as
|
||||
// possible to that requested
|
||||
int actual = uart_set_baudrate(UART_ID, BAUD_RATE);
|
||||
int __unused actual = uart_set_baudrate(UART_ID, BAUD_RATE);
|
||||
|
||||
// Set UART flow control CTS/RTS, we don't want these, so turn them off
|
||||
uart_set_hw_flow(UART_ID, false, false);
|
||||
|
||||
@ -134,7 +134,7 @@ void hid_task(void) {
|
||||
static bool has_key = false;
|
||||
|
||||
static bool toggle = false;
|
||||
if (toggle = !toggle) {
|
||||
if ((toggle = !toggle)) {
|
||||
uint8_t keycode[6] = {0};
|
||||
keycode[0] = HID_KEY_A;
|
||||
|
||||
|
||||
@ -113,7 +113,7 @@ struct usb_endpoint_configuration *usb_get_endpoint_configuration(uint8_t addr)
|
||||
*/
|
||||
uint8_t usb_prepare_string_descriptor(const unsigned char *str) {
|
||||
// 2 for bLength + bDescriptorType + strlen * 2 because string is unicode. i.e. other byte will be 0
|
||||
uint8_t bLength = 2 + (strlen(str) * 2);
|
||||
uint8_t bLength = 2 + (strlen((const char *)str) * 2);
|
||||
static const uint8_t bDescriptorType = 0x03;
|
||||
|
||||
volatile uint8_t *buf = &ep0_buf[0];
|
||||
|
||||
@ -129,8 +129,8 @@ static const unsigned char lang_descriptor[] = {
|
||||
};
|
||||
|
||||
static const unsigned char *descriptor_strings[] = {
|
||||
"Raspberry Pi", // Vendor
|
||||
"Pico Test Device" // Product
|
||||
(unsigned char *) "Raspberry Pi", // Vendor
|
||||
(unsigned char *) "Pico Test Device" // Product
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user