Trait Component

Source
pub trait Component {
    type StaticInput;
    type Output;

    // Required method
    fn finalize(self, static_memory: Self::StaticInput) -> Self::Output;
}
Expand description

A component encapsulates peripheral-specific and capsule-specific initialization for the Tock kernel in a factory method, which reduces repeated code and simplifies the boot sequence.

The Component trait encapsulates all of the initialization and configuration of a kernel extension inside the Component::finalize() function call. The Component::Output type defines what type this component generates. Note that instantiating a component does not instantiate the underlying Component::Output type; instead, the memory is statically allocated and provided as an argument to the Component::finalize() method, which correctly initializes the memory to instantiate the Component::Output object. If instantiating and initializing the Component::Output type requires parameters, these should be passed in the component’s new() function.

Using a component is as follows:

let obj = CapsuleComponent::new(configuration, required_hw)
    .finalize(capsule_component_static!());

All required resources and configuration is passed via the constructor, and all required static memory is defined by the [name]_component_static!() macro and passed to the finalize() method.

Required Associated Types§

Source

type StaticInput

An optional type to specify the chip or board specific static memory that a component needs to setup the output object(s). This is the memory that crate::static_buf!() would normally setup, but generic components cannot setup static buffers for types which are chip-dependent, so those buffers have to be passed in manually, and the Component::StaticInput type makes this possible.

Source

type Output

The type (e.g., capsule, peripheral) that this implementation of Component produces via Component::finalize(). This is typically a static reference (&'static).

Required Methods§

Source

fn finalize(self, static_memory: Self::StaticInput) -> Self::Output

A factory method that returns an instance of the Output type of this Component implementation. This is used in the boot sequence to instantiate and initialize part of the Tock kernel. This factory method may only be called once per Component instance.

To enable reusable (i.e. can be used on multiple boards with different microcontrollers) and repeatable (i.e. can be instantiated multiple times on the same board) components, all components must follow this convention:

Implementors§

impl<A, P, S> Component for Lpm013m126Component<A, P, S>
where A: 'static + Alarm<'static>, P: 'static + Pin, S: 'static + SpiMaster<'static>,

impl<A: 'static + Adc<'static>> Component for AdcComponent<A>

impl<A: 'static + Adc<'static>> Component for AdcMuxComponent<A>

impl<A: 'static + Adc<'static>> Component for TemperatureRp2040Component<A>

impl<A: 'static + Adc<'static>> Component for TemperatureSTMComponent<A>

impl<A: 'static + Adc<'static>, P: 'static + Pin, const BUF_LEN: usize> Component for AdcMicrophoneComponent<A, P, BUF_LEN>

impl<A: 'static + Can> Component for CanComponent<A>

impl<A: 'static + AES128<'static> + AES128Ctr + AES128CBC + AES128ECB> Component for AesVirtualComponent<A>

impl<A: 'static + AES128<'static> + AES128Ctr + AES128CBC + AES128ECB> Component for MuxAes128ccmComponent<A>

impl<A: 'static + Alarm<'static>> Component for AlarmDriverComponent<A>

impl<A: 'static + Alarm<'static>> Component for AlarmMuxComponent<A>

impl<A: 'static + Alarm<'static>> Component for ConsoleOrderedComponent<A>

impl<A: 'static + Alarm<'static>> Component for HD44780Component<A>

impl<A: 'static + Alarm<'static>> Component for SeggerRttComponent<A>

impl<A: 'static + Alarm<'static>> Component for MultiAlarmTestComponent<A>

impl<A: 'static + Alarm<'static>, B: 'static + Bus<'static, BusAddr8>, P: 'static + Pin> Component for ST77XXComponent<A, B, P>

impl<A: 'static + Alarm<'static>, I: 'static + I2CMaster<'static>> Component for Bmp280Component<A, I>

impl<A: 'static + Alarm<'static>, I: 'static + I2CMaster<'static>> Component for DFRobotRainFallSensorComponent<A, I>

impl<A: 'static + Alarm<'static>, I: 'static + I2CMaster<'static>> Component for Isl29035Component<A, I>

impl<A: 'static + Alarm<'static>, I: 'static + I2CMaster<'static>> Component for SHT3xComponent<A, I>

impl<A: 'static + Alarm<'static>, I: 'static + I2CMaster<'static>> Component for SHT4xComponent<A, I>

impl<A: 'static + Alarm<'static>, I: 'static + I2CMaster<'static>> Component for SI7021Component<A, I>

impl<A: 'static + Alarm<'static>, const NUM_PROCS: usize> Component for MLFQComponent<A, NUM_PROCS>

impl<A: Adc<'static> + AdcHighSpeed<'static> + 'static> Component for AdcDedicatedComponent<A>

impl<A: HmacSha256 + HmacSha384 + HmacSha512 + 'static + Digest<'static, L>, const L: usize> Component for HmacComponent<A, L>

impl<A: Sha256 + Sha384 + Sha512 + 'static + Digest<'static, L>, const L: usize> Component for ShaComponent<A, L>

impl<A: AES128<'static> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'static> + AES128GCM<'static>> Component for AesDriverComponent<A>

impl<A: Alarm<'static> + 'static, B: BleAdvertisementDriver<'static> + BleConfig + 'static> Component for BLEComponent<A, B>

impl<A: Alarm<'static> + 'static, B: AES128<'static> + AES128Ctr + AES128CBC + AES128ECB + 'static> Component for ThreadNetworkComponent<A, B>

impl<A: Alarm<'static> + 'static, M: MacDevice<'static>> Component for UDPMuxComponent<A, M>

impl<A: Alarm<'static>> Component for UDPDriverComponent<A>

impl<AC: 'static + AnalogComparator<'static>> Component for AnalogComparatorComponent<AC>

impl<B: 'static + Bus8080<'static>> Component for Bus8080BusComponent<B>

impl<C: 'static + Crc<'static>> Component for CrcComponent<C>

impl<C: Chip + 'static, D: ProcessStandardDebug + 'static> Component for StoragePermissionsNullComponent<C, D>

impl<C: Chip + 'static, D: ProcessStandardDebug + 'static> Component for StoragePermissionsTbfHeaderComponent<C, D>

impl<C: Chip, D: ProcessStandardDebug, const NUM_PROCS: usize> Component for ProcessLoaderSequentialComponent<C, D, NUM_PROCS>

impl<D: 'static + DateTime<'static> + DeferredCallClient> Component for DateTimeComponent<D>

impl<E: Entropy32<'static>> Component for RngComponent<E>

impl<F: 'static + Flash + HasClient<'static, MuxFlash<'static, F>>> Component for FlashMuxComponent<F>

impl<F: 'static + Flash + HasClient<'static, MuxFlash<'static, F>>> Component for FlashUserComponent<F>

impl<F: 'static + Flash + HasClient<'static, MuxFlash<'static, F>>, H: 'static + Hasher<'static, 8>, const PAGE_SIZE: usize> Component for TicKVComponent<F, H, PAGE_SIZE>

impl<F: 'static + Flash + HasClient<'static, NonvolatileToPages<'static, F>>> Component for NonvolatileStorageComponent<F>

impl<F: 'static + Flash + HasClient<'static, NonvolatileToPages<'static, F>>, const BUF_LEN: usize> Component for AppFlashComponent<F, BUF_LEN>

impl<F: 'static + Flash + HasClient<'static, TicKVSystem<'static, F, H, PAGE_SIZE>>, H: 'static + Hasher<'static, 8>, const PAGE_SIZE: usize> Component for TicKVDedicatedFlashComponent<F, H, PAGE_SIZE>

impl<I: 'static + I2CMaster<'static>> Component for Apds9960Component<I>

impl<I: 'static + I2CMaster<'static>> Component for Atecc508aComponent<I>

impl<I: 'static + I2CMaster<'static>> Component for Bme280Component<I>

impl<I: 'static + I2CMaster<'static>> Component for BMM150Component<I>

impl<I: 'static + I2CMaster<'static>> Component for I2CMasterBusComponent<I>

impl<I: 'static + I2CMaster<'static>> Component for Ccs811Component<I>

impl<I: 'static + I2CMaster<'static>> Component for ChirpI2cMoistureComponent<I>

impl<I: 'static + I2CMaster<'static>> Component for Ft6x06Component<I>

impl<I: 'static + I2CMaster<'static>> Component for Fxos8700Component<I>

impl<I: 'static + I2CMaster<'static>> Component for Hs3003Component<I>

impl<I: 'static + I2CMaster<'static>> Component for Hts221Component<I>

impl<I: 'static + I2CMaster<'static>> Component for I2CComponent<I>

impl<I: 'static + I2CMaster<'static>> Component for Lps22hbComponent<I>

impl<I: 'static + I2CMaster<'static>> Component for Lps25hbComponent<I>

impl<I: 'static + I2CMaster<'static>> Component for Lsm303agrI2CComponent<I>

impl<I: 'static + I2CMaster<'static>> Component for Lsm303dlhcI2CComponent<I>

impl<I: 'static + I2CMaster<'static>> Component for Lsm6dsoxtrI2CComponent<I>

impl<I: 'static + I2CMaster<'static>> Component for Ltc294xComponent<I>

impl<I: 'static + I2CMaster<'static>> Component for Ltc294xDriverComponent<I>

impl<I: 'static + I2CMaster<'static>, S: 'static + SMBusMaster<'static>> Component for I2CMuxComponent<I, S>

impl<I: 'static + I2CMaster<'static>, S: 'static + SMBusMaster<'static>> Component for Mlx90614SMBusComponent<I, S>

impl<I: 'static + I2CMasterSlave<'static>> Component for I2CMasterSlaveDriverComponent<I>

impl<I: I2CMaster<'static> + 'static> Component for Sh1106Component<I>

impl<I: I2CMaster<'static> + 'static> Component for Ssd1306Component<I>

impl<IP: 'static + InterruptPin<'static>> Component for ButtonComponent<IP>

impl<IP: 'static + InterruptPin<'static>> Component for GpioComponent<IP>

impl<IP: 'static + InterruptPin<'static>> Component for PanicButtonComponent<'static, IP>

impl<K: 'static + KVSystem<'static, K = T>, T: 'static + KeyType + Default> Component for TicKVKVStoreComponent<K, T>

impl<L: 'static + Pin, A: 'static + Alarm<'static>, const NUM_COLS: usize, const NUM_ROWS: usize, const NUM_LED_BITS: usize> Component for LedMatrixComponent<L, A, NUM_COLS, NUM_ROWS, NUM_LED_BITS>

impl<L: 'static + Led, const NUM_LEDS: usize> Component for LedsComponent<L, NUM_LEDS>

impl<L: 'static + AmbientLight<'static>> Component for AmbientLightComponent<L>

impl<P: 'static + Pwm> Component for PwmMuxComponent<P>

impl<P: 'static + Pwm> Component for PwmPinUserComponent<P>

impl<R: 'static + Radio<'static>> Component for Ieee802154RawComponent<R>

impl<R: 'static + Radio<'static>, A: 'static + AES128<'static> + AES128Ctr + AES128CBC + AES128ECB> Component for Ieee802154Component<R, A>

impl<S: 'static + SoundPressure<'static>> Component for SoundPressureComponent<S>

impl<S: 'static + SpiMaster<'static>> Component for SpiMasterBusComponent<S>

impl<S: 'static + SpiMaster<'static>> Component for SpiMuxComponent<S>

impl<S: 'static + SpiMaster<'static>> Component for SpiSyscallComponent<S>

impl<S: 'static + SpiMaster<'static>, CS: IntoChipSelect<S::ChipSelect, ActiveLow>> Component for Fm25clComponent<S, CS>

impl<S: 'static + SpiMaster<'static>, CS: IntoChipSelect<S::ChipSelect, ActiveLow>> Component for L3gd20Component<S, CS>

impl<S: 'static + SpiMaster<'static>, CS: IntoChipSelect<S::ChipSelect, AP>, AP: ChipSelectActivePolarity> Component for SpiComponent<S, CS, AP>

impl<S: 'static + SpiMaster<'static>, P: 'static + Pin, A: 'static + Alarm<'static>> Component for Mx25r6435fComponent<S, P, A>

impl<S: 'static + SpiSlave<'static> + SpiSlaveDevice<'static>> Component for SpiPeripheralComponent<S>

impl<S: 'static + SpiSlave<'static>> Component for SpiSyscallPComponent<S>

impl<S: Sha256 + 'static + Digest<'static, 32> + DigestDataVerify<'static, 32>> Component for AppCheckerSha256Component<S>

impl<S: Sha256 + DigestDataHash<'static, 32> + Digest<'static, 32> + 'static> Component for HmacSha256SoftwareComponent<S>

impl<S: SignatureVerify<'static, HL, SL>, H: DigestDataHash<'static, HL> + Digest<'static, HL>, const HL: usize, const SL: usize> Component for AppCheckerSignatureComponent<S, H, HL, SL>

impl<S: SpiMaster<'static> + 'static> Component for RF233Component<S>

impl<T: 'static + AirQualityDriver<'static>> Component for AirQualityComponent<T>

impl<T: 'static + HumidityDriver<'static>> Component for HumidityComponent<T>

impl<T: 'static + MoistureDriver<'static>> Component for MoistureComponent<T>

impl<T: 'static + PressureDriver<'static>> Component for PressureComponent<T>

impl<T: 'static + RainFallDriver<'static>> Component for RainFallComponent<T>

impl<T: 'static + TemperatureDriver<'static>> Component for TemperatureComponent<T>

impl<U: 'static + UartAdvanced<'static>, G: 'static + Pin> Component for Nrf51822Component<U, G>

impl<U: 'static + UsbController<'static>> Component for CtapComponent<U>

impl<U: 'static + UsbController<'static>> Component for KeyboardHidComponent<U>

impl<U: 'static + UsbController<'static>, A: 'static + Alarm<'static>> Component for CdcAcmComponent<U, A>

impl<U: Uart<'static> + Transmit<'static> + 'static, const BUF_SIZE_BYTES: usize> Component for DebugWriterNoMuxComponent<U, BUF_SIZE_BYTES>

impl<U: UsbController<'static> + 'static> Component for UsbComponent<U>

impl<V: KV<'static> + 'static> Component for KVStorePermissionsComponent<V>

impl<V: KVPermissions<'static> + 'static> Component for KVPermissionsMuxComponent<V>

impl<V: KVPermissions<'static> + 'static> Component for VirtualKVPermissionsComponent<V>

impl<V: KVPermissions<'static>> Component for KVDriverComponent<V>

impl<const BUF_SIZE_BYTES: usize> Component for DebugWriterComponent<BUF_SIZE_BYTES>

impl<const COMMAND_HISTORY_LEN: usize, A: 'static + Alarm<'static>> Component for ProcessConsoleComponent<COMMAND_HISTORY_LEN, A>

impl<const NUM_PINS: usize> Component for PwmDriverComponent<NUM_PINS>

impl<const NUM_PROCS: usize> Component for CooperativeComponent<NUM_PROCS>

impl<const NUM_PROCS: usize> Component for RoundRobinComponent<NUM_PROCS>

impl<const RX_BUF_LEN: usize> Component for UartMuxComponent<RX_BUF_LEN>

impl<const RX_BUF_LEN: usize, const TX_BUF_LEN: usize> Component for ConsoleComponent<RX_BUF_LEN, TX_BUF_LEN>

impl<const SCREEN_BUF_LEN: usize> Component for ScreenComponent<SCREEN_BUF_LEN>

impl<const SCREEN_BUF_LEN: usize> Component for TextScreenComponent<SCREEN_BUF_LEN>

impl<const SCREEN_BUF_LEN: usize, S: Screen<'static>> Component for ScreenSharedComponent<SCREEN_BUF_LEN, S>

impl<const SERVO_COUNT: usize> Component for ServosComponent<SERVO_COUNT>