Skip to content

How to call spi_free() #4957

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

Closed
janjongboom opened this issue Aug 22, 2017 · 12 comments
Closed

How to call spi_free() #4957

janjongboom opened this issue Aug 22, 2017 · 12 comments

Comments

@janjongboom
Copy link
Contributor

I need to call spi_free() because my SPI flash chip does not like to be init'ed from both bootloader and app.

But it's not available in the C++ API... Any idea how to do it?

@JojoS62
Copy link
Contributor

JojoS62 commented Aug 22, 2017

I doubt that it will help because I've seen only empty implementations. And the comment in hal/spi_api.h says:

/** Release a SPI object
 *
 * TODO: spi_free is currently unimplemented
 * This will require reference counting at the C++ level to be safe
 *
 * Return the pins owned by the SPI object to their reset state
 * Disable the SPI peripheral
 * Disable the SPI clock
 * @param[in] obj The SPI object to deinitialize
 */
void spi_free(spi_t *obj);

@0xc0170
Copy link
Contributor

0xc0170 commented Aug 31, 2017

This will require further work, as noted above, in the documentation, needs specification and implementation for targets.

@janjongboom
Copy link
Contributor Author

@0xc0170 I'd suggest adding a free() function to SPI object. Perhaps we'd mark it in the docs with an indication that you probably never want to call it.

@ciarmcom
Copy link
Member

ciarmcom commented Jun 1, 2018

ARM Internal Ref: MBOTRIAGE-188

@janjongboom
Copy link
Contributor Author

Just in case someone else runs into this problem, I made a DestructableSPI class which can free the interface: https://github.com/janjongboom/at45-blockdevice/blob/44766342130b373f59ac372add62e73f55469f9b/DestructableSPI.h

@ithinuel
Copy link
Member

This is also addressed in the [WIP] SPI hal update.

@deepikabhavnani
Copy link

Issue is addressed in SPI hal, can this be closed now?

@janjongboom
Copy link
Contributor Author

@deepikabhavnani Where was the SPI Hal work landed?

@deepikabhavnani
Copy link

Ready to merge #7671 - Feature branch feature-hal-spec-spi.

@janjongboom
Copy link
Contributor Author

@deepikabhavnani That's just design documents, where is the actual work? Unless there's some actual work being done we cannot close this.

@ithinuel
Copy link
Member

There are work on reference implementations for some ST's and Freescale's targets.
They'll be part of an upcomig PR to the same feature branch.

@deepikabhavnani
Copy link

Duplicate of #3106.
Please use the Issue: 3106 to track anything related to destructor, free pins, disable module / driver.. etc

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

No branches or pull requests

6 participants