mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-29 17:22:56 +08:00
fix stddevice
This commit is contained in:
parent
0abb3d7f88
commit
acd259a0fe
@ -5,6 +5,8 @@ tim = Timer()
|
||||
cb_times = 0
|
||||
def cb_test(signal):
|
||||
global cb_times
|
||||
if cb_times > 0:
|
||||
return
|
||||
cb_times += 1
|
||||
print("cb_test: signal = %d, cb_times = %d" % (signal, cb_times))
|
||||
|
||||
@ -14,7 +16,8 @@ tim.setPeriod(100) # 100ms
|
||||
tim.enable()
|
||||
|
||||
while True:
|
||||
time.sleep(0.1)
|
||||
if cb_times >= 3:
|
||||
time.sleep(1)
|
||||
print("cb_times = %d" % cb_times)
|
||||
if cb_times >= 1:
|
||||
tim.close()
|
||||
break
|
||||
|
@ -27,7 +27,7 @@ void PikaStdDevice_ADC_setPin(PikaObj* self, char* pin) {
|
||||
}
|
||||
|
||||
static pika_dev* _get_dev(PikaObj* self) {
|
||||
pika_dev* dev = obj_getPtr(self, "pika_dev");
|
||||
pika_dev* dev = PIKA_HAL_OBJ2DEV(self);
|
||||
if (NULL != dev) {
|
||||
return dev;
|
||||
}
|
||||
|
@ -15,8 +15,7 @@ void PikaStdDevice_BaseDev_addEventCallback(PikaObj* self, Arg* eventCallBack) {
|
||||
}
|
||||
if (PIKA_RES_OK != obj_runNativeMethod(self, "platformGetEventId", NULL)) {
|
||||
obj_setErrorCode(self, 1);
|
||||
__platform_printf("Error: Method %s no found.\r\n",
|
||||
"platformGetEventId");
|
||||
obj_setSysOut(self, "Error: Method %s no found.", "platformGetEventId");
|
||||
}
|
||||
uint32_t eventId = obj_getInt(self, "eventId");
|
||||
pika_eventListener_registEventCallback(g_pika_device_event_listener,
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "PikaStdDevice_common.h"
|
||||
|
||||
static pika_dev* _get_dev(PikaObj* self) {
|
||||
pika_dev* dev = obj_getPtr(self, "pika_dev");
|
||||
pika_dev* dev = PIKA_HAL_OBJ2DEV(self);
|
||||
if (NULL != dev) {
|
||||
return dev;
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ void PikaStdDevice_GPIO_setPull(PikaObj* self, char* pull) {
|
||||
}
|
||||
|
||||
static pika_dev* _get_dev(PikaObj* self) {
|
||||
pika_dev* dev = obj_getPtr(self, "pika_dev");
|
||||
pika_dev* dev = PIKA_HAL_OBJ2DEV(self);
|
||||
if (NULL != dev) {
|
||||
return dev;
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ void PikaStdDevice_PWM_setFreq(PikaObj* self, int freq) {
|
||||
}
|
||||
|
||||
static pika_dev* _get_dev(PikaObj* self) {
|
||||
pika_dev* dev = obj_getPtr(self, "pika_dev");
|
||||
pika_dev* dev = PIKA_HAL_OBJ2DEV(self);
|
||||
if (NULL != dev) {
|
||||
return dev;
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ void PikaStdDevice_UART_writeBytes(PikaObj* self, uint8_t* data, int length) {
|
||||
}
|
||||
|
||||
static pika_dev* _get_dev(PikaObj* self) {
|
||||
pika_dev* dev = obj_getPtr(self, "pika_dev");
|
||||
pika_dev* dev = PIKA_HAL_OBJ2DEV(self);
|
||||
if (NULL != dev) {
|
||||
return dev;
|
||||
}
|
||||
|
@ -210,6 +210,7 @@ int pika_hal_GPIO_ioctl_merge_config(pika_hal_GPIO_config* dst,
|
||||
PIKA_HAL_GPIO_EVENT_SIGNAL_RISING);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(event_callback_ena,
|
||||
PIKA_HAL_EVENT_CALLBACK_ENA_ENABLE);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(user_data, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -229,6 +230,7 @@ int pika_hal_UART_ioctl_merge_config(pika_hal_UART_config* dst,
|
||||
_IOCTL_CONFIG_USE_DEFAULT(RX, NULL);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(RTS, NULL);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(CTS, NULL);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(user_data, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -240,6 +242,7 @@ int pika_hal_SPI_ioctl_merge_config(pika_hal_SPI_config* dst,
|
||||
_IOCTL_CONFIG_USE_DEFAULT(data_width, PIKA_HAL_SPI_DATA_WIDTH_8);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(speed, PIKA_HAL_SPI_SPEED_2M);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(timeout, PIKA_HAL_SPI_TIMEOUT_1000MS);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(user_data, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -255,6 +258,7 @@ int pika_hal_SOFT_SPI_ioctl_merge_config(pika_hal_SOFT_SPI_config* dst,
|
||||
_IOCTL_CONFIG_USE_DEFAULT(SCK, NULL);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(MOSI, NULL);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(MISO, NULL);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(user_data, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -268,6 +272,7 @@ int pika_hal_IIC_ioctl_merge_config(pika_hal_IIC_config* dst,
|
||||
dst->mem_addr = src->mem_addr;
|
||||
_IOCTL_CONFIG_USE_DEFAULT(speed, PIKA_HAL_IIC_SPEED_100K);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(timeout, PIKA_HAL_IIC_TIMEOUT_1000MS);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(user_data, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -283,6 +288,7 @@ int pika_hal_SOFT_IIC_ioctl_merge_config(pika_hal_SOFT_IIC_config* dst,
|
||||
dst->mem_addr = src->mem_addr;
|
||||
_IOCTL_CONFIG_USE_DEFAULT(speed, PIKA_HAL_IIC_SPEED_100K);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(timeout, PIKA_HAL_IIC_TIMEOUT_1000MS);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(user_data, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -291,6 +297,7 @@ int pika_hal_PWM_ioctl_merge_config(pika_hal_PWM_config* dst,
|
||||
_IOCTL_CONFIG_USE_DEFAULT(period, PIKA_HAL_PWM_PERIOD_1MS * 10);
|
||||
// _IOCTL_CONFIG_USE_DEFAULT(duty, 0);
|
||||
dst->duty = src->duty;
|
||||
_IOCTL_CONFIG_USE_DEFAULT(user_data, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -301,6 +308,7 @@ int pika_hal_ADC_ioctl_merge_config(pika_hal_ADC_config* dst,
|
||||
_IOCTL_CONFIG_USE_DEFAULT(continue_or_single, PIKA_HAL_ADC_SINGLE);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(vref, (pika_float)3.3);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(max, 8192);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(user_data, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -310,6 +318,7 @@ int pika_hal_DAC_ioctl_merge_config(pika_hal_DAC_config* dst,
|
||||
_IOCTL_CONFIG_USE_DEFAULT(sampling_resolution, PIKA_HAL_DAC_RESOLUTION_12);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(vref, (pika_float)3.3);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(max, 3300000);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(user_data, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -321,6 +330,23 @@ int pika_hal_WIFI_ioctl_merge_config(pika_hal_WIFI_config* dst,
|
||||
_IOCTL_CONFIG_USE_DEFAULT_STR(ap_ssid, "pikapython.com");
|
||||
_IOCTL_CONFIG_USE_DEFAULT_STR(ap_bssid, "");
|
||||
_IOCTL_CONFIG_USE_DEFAULT_STR(ap_password, "pikapython.com");
|
||||
_IOCTL_CONFIG_USE_DEFAULT(user_data, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pika_hal_SG_ioctl_merge_config(pika_hal_SG_config* dst,
|
||||
pika_hal_SG_config* src) {
|
||||
_IOCTL_CONFIG_USE_DEFAULT(waveform, PIKA_HAL_SG_WAVEFORM_SINE);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(frequency, 10);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(amplitude, 0.1);
|
||||
dst->offset = src->offset;
|
||||
dst->seconds = src->seconds;
|
||||
_IOCTL_CONFIG_USE_DEFAULT(event_callback, NULL);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(event_callback_filter,
|
||||
PIKA_HAL_SG_EVENT_SIGNAL_ANY);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(event_callback_ena,
|
||||
PIKA_HAL_EVENT_CALLBACK_ENA_ENABLE);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(user_data, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
#define PIKA_HAL
|
||||
|
||||
#define PIKA_HAL_OBJ2DEV(_self) obj_getPtr((_self), "pika_dev")
|
||||
|
||||
typedef enum {
|
||||
#define PIKA_HAL_TABLE_DEV_TYPE
|
||||
#include "pika_hal_table.h"
|
||||
@ -89,6 +91,7 @@ typedef struct {
|
||||
void (*event_callback)(pika_dev* dev, PIKA_HAL_GPIO_EVENT_SIGNAL signal);
|
||||
PIKA_HAL_GPIO_EVENT_SIGNAL event_callback_filter;
|
||||
PIKA_HAL_EVENT_CALLBACK_ENA event_callback_ena;
|
||||
void* user_data;
|
||||
} pika_hal_GPIO_config;
|
||||
|
||||
typedef enum {
|
||||
@ -152,6 +155,7 @@ typedef struct {
|
||||
pika_dev* RX;
|
||||
pika_dev* RTS;
|
||||
pika_dev* CTS;
|
||||
void* user_data;
|
||||
} pika_hal_UART_config;
|
||||
|
||||
typedef uint32_t PIKA_HAL_IIC_SLAVE_ADDR;
|
||||
@ -213,6 +217,7 @@ typedef struct {
|
||||
PIKA_HAL_IIC_MEM_ADDR_SIZE mem_addr_size;
|
||||
PIKA_HAL_IIC_SPEED speed;
|
||||
PIKA_HAL_IIC_TIMEOUT timeout;
|
||||
void* user_data;
|
||||
} pika_hal_IIC_config;
|
||||
|
||||
typedef struct {
|
||||
@ -226,6 +231,7 @@ typedef struct {
|
||||
PIKA_HAL_IIC_MEM_ADDR_SIZE mem_addr_size;
|
||||
PIKA_HAL_IIC_SPEED speed;
|
||||
PIKA_HAL_IIC_TIMEOUT timeout;
|
||||
void* user_data;
|
||||
} pika_hal_SOFT_IIC_config;
|
||||
|
||||
typedef enum PIKA_HAL_SPI_TIMEOUT {
|
||||
@ -288,6 +294,7 @@ typedef struct {
|
||||
PIKA_HAL_SPI_DATA_WIDTH data_width;
|
||||
PIKA_HAL_SPI_SPEED speed;
|
||||
PIKA_HAL_SPI_TIMEOUT timeout;
|
||||
void* user_data;
|
||||
} pika_hal_SPI_config;
|
||||
|
||||
typedef struct {
|
||||
@ -301,6 +308,7 @@ typedef struct {
|
||||
pika_dev* SCK;
|
||||
pika_dev* MOSI;
|
||||
pika_dev* MISO;
|
||||
void* user_data;
|
||||
} pika_hal_SOFT_SPI_config;
|
||||
|
||||
typedef enum {
|
||||
@ -337,6 +345,7 @@ typedef struct {
|
||||
PIKA_HAL_ADC_CONTINUOU_OR_SINGLE continue_or_single;
|
||||
PIKA_HAL_ADC_MAX max;
|
||||
PIKA_HAL_ADC_VREF vref;
|
||||
void* user_data;
|
||||
} pika_hal_ADC_config;
|
||||
|
||||
typedef enum {
|
||||
@ -369,6 +378,7 @@ typedef struct pika_hal_DAC_config {
|
||||
PIKA_HAL_DAC_SPEED speed;
|
||||
PIKA_HAL_DAC_MAX max;
|
||||
PIKA_HAL_DAC_VREF vref;
|
||||
void* user_data;
|
||||
} pika_hal_DAC_config;
|
||||
|
||||
typedef enum {
|
||||
@ -400,6 +410,7 @@ typedef enum {
|
||||
typedef struct {
|
||||
PIKA_HAL_PWM_PERIOD period;
|
||||
PIKA_HAL_PWM_DUTY duty;
|
||||
void* user_data;
|
||||
} pika_hal_PWM_config;
|
||||
|
||||
typedef enum {
|
||||
@ -456,6 +467,7 @@ typedef struct pika_hal_WIFI_config {
|
||||
char ap_ssid[PIKA_HAL_WIFI_PARAM_MAX_LEN];
|
||||
char ap_bssid[PIKA_HAL_WIFI_PARAM_MAX_LEN];
|
||||
char ap_password[PIKA_HAL_WIFI_PARAM_MAX_LEN];
|
||||
void* user_data;
|
||||
} pika_hal_WIFI_config;
|
||||
|
||||
typedef struct pika_hal_WIFI_connect_config {
|
||||
@ -486,6 +498,7 @@ typedef struct pika_hal_WIFI_scan_result {
|
||||
} pika_hal_WIFI_scan_result;
|
||||
|
||||
typedef enum {
|
||||
_PIKA_HAL_PWM_PERIOD_UNUSED = 0,
|
||||
PIKA_HAL_TIM_PERIOD_1NS = 1,
|
||||
PIKA_HAL_TIM_PERIOD_1US = 1000,
|
||||
PIKA_HAL_TIM_PERIOD_1MS = 1000000,
|
||||
@ -565,6 +578,35 @@ typedef struct pika_hal_CAM_config {
|
||||
int buff_len;
|
||||
} pika_hal_CAM_config;
|
||||
|
||||
/* Signal Generator */
|
||||
|
||||
typedef enum {
|
||||
_PIKA_HAL_SG_WAVEFORM_UNUSED = 0,
|
||||
PIKA_HAL_SG_WAVEFORM_SINE,
|
||||
PIKA_HAL_SG_WAVEFORM_SQUARE,
|
||||
PIKA_HAL_SG_WAVEFORM_TRIANGLE,
|
||||
} PIKA_HAL_SG_WAVEFORM;
|
||||
|
||||
typedef enum {
|
||||
_PIKA_HAL_SG_EVENT_SIGNAL_UNUSED = 0,
|
||||
PIKA_HAL_SG_EVENT_SIGNAL_READY_FOR_OUTPUT,
|
||||
PIKA_HAL_SG_EVENT_SIGNAL_ANY,
|
||||
} PIKA_HAL_SG_EVENT_SIGNAL;
|
||||
|
||||
typedef struct {
|
||||
PIKA_HAL_SG_WAVEFORM waveform;
|
||||
pika_float frequency; // Frequency in Hz
|
||||
pika_float amplitude; // Amplitude in Volts
|
||||
pika_float offset; // Offset in Volts
|
||||
pika_float seconds; // Seconds to output
|
||||
void (*event_callback)(pika_dev* dev, PIKA_HAL_SG_EVENT_SIGNAL signal);
|
||||
PIKA_HAL_SG_EVENT_SIGNAL event_callback_filter;
|
||||
PIKA_HAL_EVENT_CALLBACK_ENA event_callback_ena;
|
||||
void* user_data;
|
||||
} pika_hal_SG_config;
|
||||
|
||||
/* impl typedef */
|
||||
|
||||
typedef struct pika_dev_impl {
|
||||
int (*open)(pika_dev* dev, char* name);
|
||||
int (*close)(pika_dev* dev);
|
||||
|
@ -15,4 +15,4 @@ pika_hal_table_add(WIFI)
|
||||
pika_hal_table_add(TIM)
|
||||
pika_hal_table_add(SOFT_TIM)
|
||||
pika_hal_table_add(CAM)
|
||||
|
||||
pika_hal_table_add(SG)
|
||||
|
@ -56,8 +56,7 @@
|
||||
return pika_hal_platform_##dev_name##_ioctl_others(dev, cmd, \
|
||||
arg); \
|
||||
} \
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PIKA_HAL_TABLE_DEV_TYPE)
|
||||
|
@ -346,7 +346,7 @@ int pika_hal_SG_ioctl_merge_config(pika_hal_SG_config* dst,
|
||||
PIKA_HAL_SG_EVENT_SIGNAL_ANY);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(event_callback_ena,
|
||||
PIKA_HAL_EVENT_CALLBACK_ENA_ENABLE);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(user_data, NULL);
|
||||
_IOCTL_CONFIG_USE_DEFAULT(user_data, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
#define PIKA_HAL
|
||||
|
||||
#define PIKA_HAL_OBJ2DEV(_self) obj_getPtr((_self), "pika_dev")
|
||||
|
||||
typedef enum {
|
||||
#define PIKA_HAL_TABLE_DEV_TYPE
|
||||
#include "pika_hal_table.h"
|
||||
@ -89,6 +91,7 @@ typedef struct {
|
||||
void (*event_callback)(pika_dev* dev, PIKA_HAL_GPIO_EVENT_SIGNAL signal);
|
||||
PIKA_HAL_GPIO_EVENT_SIGNAL event_callback_filter;
|
||||
PIKA_HAL_EVENT_CALLBACK_ENA event_callback_ena;
|
||||
void* user_data;
|
||||
} pika_hal_GPIO_config;
|
||||
|
||||
typedef enum {
|
||||
@ -152,6 +155,7 @@ typedef struct {
|
||||
pika_dev* RX;
|
||||
pika_dev* RTS;
|
||||
pika_dev* CTS;
|
||||
void* user_data;
|
||||
} pika_hal_UART_config;
|
||||
|
||||
typedef uint32_t PIKA_HAL_IIC_SLAVE_ADDR;
|
||||
@ -213,6 +217,7 @@ typedef struct {
|
||||
PIKA_HAL_IIC_MEM_ADDR_SIZE mem_addr_size;
|
||||
PIKA_HAL_IIC_SPEED speed;
|
||||
PIKA_HAL_IIC_TIMEOUT timeout;
|
||||
void* user_data;
|
||||
} pika_hal_IIC_config;
|
||||
|
||||
typedef struct {
|
||||
@ -226,6 +231,7 @@ typedef struct {
|
||||
PIKA_HAL_IIC_MEM_ADDR_SIZE mem_addr_size;
|
||||
PIKA_HAL_IIC_SPEED speed;
|
||||
PIKA_HAL_IIC_TIMEOUT timeout;
|
||||
void* user_data;
|
||||
} pika_hal_SOFT_IIC_config;
|
||||
|
||||
typedef enum PIKA_HAL_SPI_TIMEOUT {
|
||||
@ -288,6 +294,7 @@ typedef struct {
|
||||
PIKA_HAL_SPI_DATA_WIDTH data_width;
|
||||
PIKA_HAL_SPI_SPEED speed;
|
||||
PIKA_HAL_SPI_TIMEOUT timeout;
|
||||
void* user_data;
|
||||
} pika_hal_SPI_config;
|
||||
|
||||
typedef struct {
|
||||
@ -301,6 +308,7 @@ typedef struct {
|
||||
pika_dev* SCK;
|
||||
pika_dev* MOSI;
|
||||
pika_dev* MISO;
|
||||
void* user_data;
|
||||
} pika_hal_SOFT_SPI_config;
|
||||
|
||||
typedef enum {
|
||||
@ -337,6 +345,7 @@ typedef struct {
|
||||
PIKA_HAL_ADC_CONTINUOU_OR_SINGLE continue_or_single;
|
||||
PIKA_HAL_ADC_MAX max;
|
||||
PIKA_HAL_ADC_VREF vref;
|
||||
void* user_data;
|
||||
} pika_hal_ADC_config;
|
||||
|
||||
typedef enum {
|
||||
@ -369,6 +378,7 @@ typedef struct pika_hal_DAC_config {
|
||||
PIKA_HAL_DAC_SPEED speed;
|
||||
PIKA_HAL_DAC_MAX max;
|
||||
PIKA_HAL_DAC_VREF vref;
|
||||
void* user_data;
|
||||
} pika_hal_DAC_config;
|
||||
|
||||
typedef enum {
|
||||
@ -400,6 +410,7 @@ typedef enum {
|
||||
typedef struct {
|
||||
PIKA_HAL_PWM_PERIOD period;
|
||||
PIKA_HAL_PWM_DUTY duty;
|
||||
void* user_data;
|
||||
} pika_hal_PWM_config;
|
||||
|
||||
typedef enum {
|
||||
@ -456,6 +467,7 @@ typedef struct pika_hal_WIFI_config {
|
||||
char ap_ssid[PIKA_HAL_WIFI_PARAM_MAX_LEN];
|
||||
char ap_bssid[PIKA_HAL_WIFI_PARAM_MAX_LEN];
|
||||
char ap_password[PIKA_HAL_WIFI_PARAM_MAX_LEN];
|
||||
void* user_data;
|
||||
} pika_hal_WIFI_config;
|
||||
|
||||
typedef struct pika_hal_WIFI_connect_config {
|
||||
@ -486,6 +498,7 @@ typedef struct pika_hal_WIFI_scan_result {
|
||||
} pika_hal_WIFI_scan_result;
|
||||
|
||||
typedef enum {
|
||||
_PIKA_HAL_PWM_PERIOD_UNUSED = 0,
|
||||
PIKA_HAL_TIM_PERIOD_1NS = 1,
|
||||
PIKA_HAL_TIM_PERIOD_1US = 1000,
|
||||
PIKA_HAL_TIM_PERIOD_1MS = 1000000,
|
||||
@ -565,6 +578,35 @@ typedef struct pika_hal_CAM_config {
|
||||
int buff_len;
|
||||
} pika_hal_CAM_config;
|
||||
|
||||
/* Signal Generator */
|
||||
|
||||
typedef enum {
|
||||
_PIKA_HAL_SG_WAVEFORM_UNUSED = 0,
|
||||
PIKA_HAL_SG_WAVEFORM_SINE,
|
||||
PIKA_HAL_SG_WAVEFORM_SQUARE,
|
||||
PIKA_HAL_SG_WAVEFORM_TRIANGLE,
|
||||
} PIKA_HAL_SG_WAVEFORM;
|
||||
|
||||
typedef enum {
|
||||
_PIKA_HAL_SG_EVENT_SIGNAL_UNUSED = 0,
|
||||
PIKA_HAL_SG_EVENT_SIGNAL_READY_FOR_OUTPUT,
|
||||
PIKA_HAL_SG_EVENT_SIGNAL_ANY,
|
||||
} PIKA_HAL_SG_EVENT_SIGNAL;
|
||||
|
||||
typedef struct {
|
||||
PIKA_HAL_SG_WAVEFORM waveform;
|
||||
pika_float frequency; // Frequency in Hz
|
||||
pika_float amplitude; // Amplitude in Volts
|
||||
pika_float offset; // Offset in Volts
|
||||
pika_float seconds; // Seconds to output
|
||||
void (*event_callback)(pika_dev* dev, PIKA_HAL_SG_EVENT_SIGNAL signal);
|
||||
PIKA_HAL_SG_EVENT_SIGNAL event_callback_filter;
|
||||
PIKA_HAL_EVENT_CALLBACK_ENA event_callback_ena;
|
||||
void* user_data;
|
||||
} pika_hal_SG_config;
|
||||
|
||||
/* impl typedef */
|
||||
|
||||
typedef struct pika_dev_impl {
|
||||
int (*open)(pika_dev* dev, char* name);
|
||||
int (*close)(pika_dev* dev);
|
||||
|
@ -15,4 +15,4 @@ pika_hal_table_add(WIFI)
|
||||
pika_hal_table_add(TIM)
|
||||
pika_hal_table_add(SOFT_TIM)
|
||||
pika_hal_table_add(CAM)
|
||||
|
||||
pika_hal_table_add(SG)
|
||||
|
@ -2,4 +2,4 @@
|
||||
#define PIKA_VERSION_MINOR 12
|
||||
#define PIKA_VERSION_MICRO 7
|
||||
|
||||
#define PIKA_EDIT_TIME "2023/10/22 12:57:51"
|
||||
#define PIKA_EDIT_TIME "2023/10/26 20:12:40"
|
||||
|
Loading…
x
Reference in New Issue
Block a user