Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic pin manipulation fails with type error #23

Open
nixpulvis opened this issue May 19, 2017 · 1 comment
Open

Basic pin manipulation fails with type error #23

nixpulvis opened this issue May 19, 2017 · 1 comment

Comments

@nixpulvis
Copy link

nixpulvis commented May 19, 2017

Minimal example. Seems to be related to the way bindgen and overloading work, and might be a pain to make better. Thoughts?

#![no_std]
#![no_main]

#[macro_use]
extern crate teensy3;

use teensy3::bindings::{OUTPUT, HIGH, pinMode, digitalWrite};

#[no_mangle]
pub unsafe extern fn main() {
    pinMode(1, OUTPUT);
    digitalWrite(1, HIGH);
}

The error after running xargo build.

error[E0308]: mismatched types
  --> src/main.rs:11:16
   |
11 |     pinMode(1, OUTPUT);
   |                ^^^^^^ expected u8, found u32

error[E0308]: mismatched types
  --> src/main.rs:12:21
   |
12 |     digitalWrite(1, HIGH);
   |                     ^^^^ expected u8, found u32

error: aborting due to 2 previous errors
@jamesmunns
Copy link
Owner

Hey, I think I might have something that will fix this :) for now you should be able to do this: OUTPUT as u8 - this is due to a difference in how enumerated values are represented by GCC and Clang for LLVM. I am working on a fix for this now, and will apply it if it does help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants