Skip to content

Commit 3723228

Browse files
committed
release modules
1 parent c262db0 commit 3723228

File tree

4 files changed

+62
-92
lines changed

4 files changed

+62
-92
lines changed

package/PikaStdDevice/PikaStdDevice_UART.c

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include "PikaStdDevice_UART.h"
22
#include "PikaStdDevice_common.h"
3-
#include "pika_hal.h"
43

54
void PikaStdDevice_UART_enable(PikaObj* self) {
65
obj_runNativeMethod(self, "platformEnable", NULL);
@@ -40,7 +39,6 @@ void PikaStdDevice_UART_init(PikaObj* self) {
4039
obj_setInt(self, "dataBits", 8);
4140
obj_setInt(self, "parity", PIKA_HAL_UART_PARITY_NONE);
4241
obj_setInt(self, "stopBits", PIKA_HAL_UART_STOP_BITS_1);
43-
obj_setInt(self, "enabled", 0);
4442
}
4543

4644
void PikaStdDevice_UART___init__(PikaObj* self) {
@@ -59,52 +57,24 @@ Arg* PikaStdDevice_UART_readBytes(PikaObj* self, int length) {
5957
return arg_copy(obj_getArg(self, "readData"));
6058
}
6159

62-
int _config_update(PikaObj* self, pika_hal_UART_config* cfg){
63-
if (obj_getInt(self, "enabled")) {
64-
pika_debug("UART %s config update.\r\n", obj_getStr(self, "id"));
65-
int err = pika_hal_ioctl(obj_getPtr(self, "pika_dev"),
66-
PIKA_HAL_IOCTL_CONFIG, cfg);
67-
if (err == 0) {
68-
return 0;
69-
}
70-
pika_debug("UART %s config update failed.\r\n", obj_getStr(self, "id"));
71-
}
72-
return -1;
73-
}
74-
7560
void PikaStdDevice_UART_setBaudRate(PikaObj* self, int baudRate) {
7661
obj_setInt(self, "baudRate", baudRate);
77-
pika_hal_UART_config cfg = {0};
78-
cfg.baudrate = baudRate;
79-
_config_update(self, &cfg);
8062
}
8163

8264
void PikaStdDevice_UART_setFlowControl(PikaObj* self, int flowControl) {
8365
obj_setInt(self, "flowControl", flowControl);
84-
pika_hal_UART_config cfg = {0};
85-
cfg.flow_control = flowControl;
86-
_config_update(self, &cfg);
8766
}
8867

8968
void PikaStdDevice_UART_setDataBits(PikaObj* self, int dataBits) {
9069
obj_setInt(self, "dataBits", dataBits);
91-
pika_hal_UART_config cfg = {0};
92-
cfg.data_bits = dataBits;
93-
_config_update(self, &cfg);
9470
}
9571

9672
void PikaStdDevice_UART_setParity(PikaObj* self, int parity) {
9773
obj_setInt(self, "parity", parity);
98-
pika_hal_UART_config cfg = {0};
99-
cfg.parity = parity;
100-
_config_update(self, &cfg);
10174
}
10275

10376
void PikaStdDevice_UART_setStopBits(PikaObj* self, int stopBits) {
10477
obj_setInt(self, "stopBits", stopBits);
105-
pika_hal_UART_config cfg = {0};
106-
cfg.stop_bits = stopBits;
107-
_config_update(self, &cfg);
10878
}
10979

11080
void PikaStdDevice_UART_setId(PikaObj* self, int id) {
@@ -191,7 +161,6 @@ void PikaStdDevice_UART_platformEnable(PikaObj* self) {
191161
(int)obj_getInt(self, "id"));
192162
return;
193163
}
194-
obj_setInt(self, "enabled", 1);
195164
}
196165

197166
void PikaStdDevice_UART_platformRead(PikaObj* self) {
@@ -217,12 +186,7 @@ void PikaStdDevice_UART_platformDisable(PikaObj* self) {
217186
(int)obj_getInt(self, "id"));
218187
return;
219188
}
220-
if (0!= pika_hal_ioctl(dev, PIKA_HAL_IOCTL_DISABLE)){
221-
__platform_printf("Error: disable UART '%d' failed.\r\n",
222-
(int)obj_getInt(self, "id"));
223-
return;
224-
}
225-
obj_setInt(self, "enabled", 0);
189+
pika_hal_ioctl(dev, PIKA_HAL_IOCTL_DISABLE);
226190
}
227191

228192
void PikaStdDevice_UART_platformReadBytes(PikaObj* self) {

package/pika_cjson/cJSON.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ CJSON_PUBLIC(double) cJSON_GetNumberValue(const cJSON * const item)
125125
CJSON_PUBLIC(const char*) cJSON_Version(void)
126126
{
127127
static char version[15];
128-
pika_platform_sprintf(version, "%i.%i.%i", CJSON_VERSION_MAJOR, CJSON_VERSION_MINOR, CJSON_VERSION_PATCH);
128+
pika_sprintf(version, "%i.%i.%i", CJSON_VERSION_MAJOR, CJSON_VERSION_MINOR, CJSON_VERSION_PATCH);
129129

130130
return version;
131131
}
@@ -561,18 +561,18 @@ static cJSON_bool print_number(const cJSON * const item, printbuffer * const out
561561
/* This checks for NaN and Infinity */
562562
if (isnan(d) || isinf(d))
563563
{
564-
length = pika_platform_sprintf((char*)number_buffer, "null");
564+
length = pika_sprintf((char*)number_buffer, "null");
565565
}
566566
else
567567
{
568568
/* Try 15 decimal places of precision to avoid nonsignificant nonzero digits */
569-
length = pika_platform_sprintf((char*)number_buffer, "%1.15g", d);
569+
length = pika_sprintf((char*)number_buffer, "%1.15g", d);
570570

571571
/* Check whether the original double can be recovered */
572572
if ((sscanf((char*)number_buffer, "%lg", &test) != 1) || !compare_double((double)test, d))
573573
{
574574
/* If not, print with 17 decimal places of precision */
575-
length = pika_platform_sprintf((char*)number_buffer, "%1.17g", d);
575+
length = pika_sprintf((char*)number_buffer, "%1.17g", d);
576576
}
577577
}
578578

@@ -1005,7 +1005,7 @@ static cJSON_bool print_string_ptr(const unsigned char * const input, printbuffe
10051005
break;
10061006
default:
10071007
/* escape and print as unicode codepoint */
1008-
pika_platform_sprintf((char*)output_pointer, "u%04x", *input_pointer);
1008+
pika_sprintf((char*)output_pointer, "u%04x", *input_pointer);
10091009
output_pointer += 4;
10101010
break;
10111011
}

0 commit comments

Comments
 (0)