-
Notifications
You must be signed in to change notification settings - Fork 1
SNS - Changes for IMUs to work #152
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
base: master
Are you sure you want to change the base?
Changes from all commits
3592d55
7152017
b0b1166
b0b6666
28f95ab
1183500
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -133,7 +133,7 @@ void Gpio::exportGPIO() | |
| // let the kernel know we are using this pin | ||
| int fd; | ||
| uint32_t len; | ||
| fd = open("/sys/class/gpio/export", O_WRONLY); | ||
| fd = open("/sys/class/gpio/export", O_RDWR); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You've touched this line now so we need to do this properly. const auto fd = open(/* ... */);Similar for |
||
| if (fd < 0) { | ||
| log_.error("could not open export file"); | ||
| return; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,7 +96,7 @@ Spi &Spi::getInstance() | |
|
|
||
| Spi::Spi(Logger &log) : spi_fd_(-1), hw_(0), ch_(0), log_(log) | ||
| { | ||
| const char device[] = "/dev/spidev1.0"; // spidev1.0 for SPI0 | ||
| const char device[] = "/dev/spidev0.0"; // spidev0.0 for SPI0 | ||
|
mifrandir marked this conversation as resolved.
|
||
| spi_fd_ = open(device, O_RDWR, 0); | ||
|
|
||
| if (spi_fd_ < 0) { | ||
|
|
@@ -105,7 +105,7 @@ Spi::Spi(Logger &log) : spi_fd_(-1), hw_(0), ch_(0), log_(log) | |
| } | ||
|
|
||
| // set clock frequency | ||
| setClock(Clock::k1MHz); | ||
| setClock(Clock::k500KHz); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this required? Did we test it? Has it to do with the new IMUs?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, yes and yes. Although this just needs to be tested with the sensors PCB but with an individual IMU, this worked. |
||
|
|
||
| uint8_t bits = SPI_BITS; // need to change this value | ||
| if (ioctl(spi_fd_, SPI_IOC_WR_BITS_PER_WORD, &bits) < 0) { | ||
|
|
@@ -149,14 +149,16 @@ bool Spi::initialise() | |
| ch_ = &hw_->ch0; | ||
|
|
||
| log_.info("Mapping successfully created %d", sizeof(SPI_HW)); | ||
| log_.info("revision 0x%x", hw_->revision); | ||
| return true; | ||
| } | ||
|
|
||
| void Spi::setClock(Clock clk) | ||
| { | ||
| uint32_t data; | ||
| switch (clk) { | ||
| case Clock::k500KHz: | ||
| data = 500000; | ||
| break; | ||
| case Clock::k1MHz: | ||
| data = 1000000; | ||
| break; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.