Package org.deepjava.flink.subdevices
Class FlinkPWM
- java.lang.Object
-
- org.deepjava.flink.subdevices.FlinkPWM
-
- All Implemented Interfaces:
FlinkDefinitions
public class FlinkPWM extends Object implements FlinkDefinitions
The flink PWM subdevice realizes a PWM (pulse with modulation) function within a flink device. It offers several channels. Each channel has its own period and duty cycle.- Author:
- Urs Graf
-
-
Field Summary
Fields Modifier and Type Field Description FlinkSubDevice
dev
Handle to the subdevice within our flink device-
Fields inherited from interface org.deepjava.flink.core.FlinkDefinitions
ANALOG_INPUT_INTERFACE_ID, ANALOG_OUTPUT_INTERFACE_ID, CHANNEL_OFFSET, COUNTER_INTERFACE_ID, GPIO_INTERFACE_ID, HEADER_SIZE, INFO_DEVICE_ID, INFO_DEVICE_SIZE, INTERFACE_TYPE_MASK, MOD_CONF_OFFSET, MOD_STATUS_OFFSET, PPWA_INTERFACE_ID, PWM_INTERFACE_ID, REGISTER_WIDTH, REGISTER_WIDTH_BIT, SIZE_OFFSET, SUBHEADER_SIZE, TOTAL_HEADER_SIZE, TYPE_OFFSET, UART_INTERFACE_ID, UNIQUE_ID_OFFSET, WD_INTERFACE_ID
-
-
Constructor Summary
Constructors Constructor Description FlinkPWM(FlinkSubDevice dev)
Creates a PWM subdevice.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getBaseClock()
Returns the base clock of the underlying hardware counter.int
getHighTime(int channel)
Reads the hightime of a single channel.int
getPeriod(int channel)
Reads the period of a single channel.void
setHighTime(int channel, int highTime)
Sets the hightime of a single channel.void
setPeriod(int channel, int period)
Sets the period of a single channel.
-
-
-
Field Detail
-
dev
public FlinkSubDevice dev
Handle to the subdevice within our flink device
-
-
Constructor Detail
-
FlinkPWM
public FlinkPWM(FlinkSubDevice dev)
Creates a PWM subdevice.- Parameters:
dev
- handle to the subdevice
-
-
Method Detail
-
getBaseClock
public int getBaseClock()
Returns the base clock of the underlying hardware counter.- Returns:
- the base clock in Hz.
-
getPeriod
public int getPeriod(int channel)
Reads the period of a single channel. Channel number must be 0 <= channel < nof available channels. Period setting is in multiple of the base clock, @see getBaseClock().- Parameters:
channel
- channel number- Returns:
- multiple of base clock
-
getHighTime
public int getHighTime(int channel)
Reads the hightime of a single channel. Channel number must be 0 <= channel < nof available channels. Hightime setting is in multiple of the base clock, @see getBaseClock().- Parameters:
channel
- channel number- Returns:
- multiple of base clock
-
setPeriod
public void setPeriod(int channel, int period)
Sets the period of a single channel. Channel number must be 0 <= channel < nof available channels. Period setting is in multiple of the base clock, @see getBaseClock().- Parameters:
channel
- channel numberperiod
- multiple of base clock
-
setHighTime
public void setHighTime(int channel, int highTime)
Sets the hightime of a single channel. Channel number must be 0 <= channel < nof available channels. Hightime setting is in multiple of the base clock, @see getBaseClock().- Parameters:
channel
- channel numberhighTime
- multiple of base clock
-
-