Skip to content

Commit

Permalink
api: adc: exists needs to handle #channels
Browse files Browse the repository at this point in the history
This is a bug in the kernel which will be fixed in future releases but
for now we enable the ADC example to work.
  • Loading branch information
bradjc committed Aug 4, 2023
1 parent 83bb348 commit 8fbffb7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apis/adc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ pub struct Adc<S: Syscalls>(S);
impl<S: Syscalls> Adc<S> {
/// Returns Ok() if the driver was present.This does not necessarily mean
/// that the driver is working.
pub fn exists() -> Result<(), ErrorCode> {
//
// Note! The "exists" command should return `Result<(), ErrorCode>`, but the
// current ADC driver in the kernel returns the number of ADC channels
// instead of just success. This will be fixed in a future release of Tock,
// but for now we workaround this issue.
pub fn exists() -> Result<u32, ErrorCode> {
S::command(DRIVER_NUM, EXISTS, 0, 0).to_result()
}

Expand Down

0 comments on commit 8fbffb7

Please sign in to comment.