Skip to content

Commit cc7f858

Browse files
author
Hirohito Higashi
committed
update function argument, mrb_* to struct *.
1 parent 77b8312 commit cc7f858

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

PSoC5LP/i2c/c_i2c.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ struct I2C_attr
8181
//================================================================
8282
/*! I2C constructor
8383
*/
84-
static void c_i2c_new(mrb_vm *vm, mrb_value v[], int argc)
84+
static void c_i2c_new(struct VM *vm, mrb_value v[], int argc)
8585
{
8686
*v = mrbc_instance_new(vm, v->cls, sizeof(struct I2C_attr));
8787
struct I2C_attr *attr = (struct I2C_attr *)v->instance->data;
@@ -93,7 +93,7 @@ static void c_i2c_new(mrb_vm *vm, mrb_value v[], int argc)
9393
//================================================================
9494
/*! I2C get status
9595
*/
96-
static void c_i2c_status(mrb_vm *vm, mrb_value v[], int argc)
96+
static void c_i2c_status(struct VM *vm, mrb_value v[], int argc)
9797
{
9898
struct I2C_attr *attr = (struct I2C_attr *)v->instance->data;
9999
int status = I2CNAME_MasterStatus();
@@ -105,7 +105,7 @@ static void c_i2c_status(mrb_vm *vm, mrb_value v[], int argc)
105105
//================================================================
106106
/*! I2C clear status
107107
*/
108-
static void c_i2c_clear_status(mrb_vm *vm, mrb_value v[], int argc)
108+
static void c_i2c_clear_status(struct VM *vm, mrb_value v[], int argc)
109109
{
110110
struct I2C_attr *attr = (struct I2C_attr *)v->instance->data;
111111

@@ -139,7 +139,7 @@ static void c_i2c_clear_status(mrb_vm *vm, mrb_value v[], int argc)
139139
A : Ack
140140
N : Nack
141141
*/
142-
static void c_i2c_read(mrb_vm *vm, mrb_value v[], int argc)
142+
static void c_i2c_read(struct VM *vm, mrb_value v[], int argc)
143143
{
144144
struct I2C_attr *attr = (struct I2C_attr *)v->instance->data;
145145
uint32_t status = 0;
@@ -244,7 +244,7 @@ static void c_i2c_read(mrb_vm *vm, mrb_value v[], int argc)
244244
DR: device_register, option.
245245
A : Ack
246246
*/
247-
static void c_i2c_write(mrb_vm *vm, mrb_value v[], int argc)
247+
static void c_i2c_write(struct VM *vm, mrb_value v[], int argc)
248248
{
249249
struct I2C_attr *attr = (struct I2C_attr *)v->instance->data;
250250
uint32_t status = 0;

PSoC5LP/uart/c_uart.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,21 @@
99
This file is distributed under BSD 3-Clause License.
1010
1111
(Usage)
12+
Copy the following 4 files and add to project.
13+
c_uart.h
14+
c_uart.c
15+
uart2.h
16+
uart2.c
17+
18+
1219
Hardware configration.
1320
1421
1. Use PSoC Creator, place "Communication > UART" device.
15-
2. Open a configure dialog.
22+
2. Open a Configure dialog.
1623
3. Make sure the name is "UART_1".
1724
4. Set the baud rate and other parameters.
1825
5. Change to the "Advanced" tab and check "RX - ON Byte Received" and "TX - On TX Complete".
19-
6. Close this dialog.
26+
6. Click OK button to close dialog.
2027
7. Place two "System > Interrupt" devices.
2128
8. Connect to tx_interrupt and rx_interrupt of UART.
2229
9. Change the names to "isr_UART_1_Tx" and "isr_UART_1_Rx" respectively.
@@ -69,7 +76,7 @@
6976
/*! UART用設定
7077
*/
7178
#if !defined(MRBC_NUM_UART)
72-
# define MRBC_NUM_UART 2
79+
# define MRBC_NUM_UART 1
7380
#endif
7481

7582
UART_HANDLE uh[MRBC_NUM_UART];
@@ -95,7 +102,7 @@ UART_ISR( &uh[2], UART_3 );
95102
$uart = UART.new # automatic assign
96103
$uart = UART.new( num ) # 1 origin.
97104
*/
98-
static void c_uart_new(mrbc_vm *vm, mrbc_value v[], int argc)
105+
static void c_uart_new(struct VM *vm, mrbc_value v[], int argc)
99106
{
100107
static int uart_counter = 0;
101108
int uart_num;
@@ -133,7 +140,7 @@ static void c_uart_new(mrbc_vm *vm, mrbc_value v[], int argc)
133140
@return String Received data.
134141
@return Nil Not enough receive length.
135142
*/
136-
static void c_uart_read(mrbc_vm *vm, mrbc_value v[], int argc)
143+
static void c_uart_read(struct VM *vm, mrbc_value v[], int argc)
137144
{
138145
mrbc_value ret;
139146
UART_HANDLE *handle = *(UART_HANDLE **)v->instance->data;
@@ -161,7 +168,7 @@ static void c_uart_read(mrbc_vm *vm, mrbc_value v[], int argc)
161168
162169
@param s Write data.
163170
*/
164-
static void c_uart_write(mrbc_vm *vm, mrbc_value v[], int argc)
171+
static void c_uart_write(struct VM *vm, mrbc_value v[], int argc)
165172
{
166173
UART_HANDLE *handle = *(UART_HANDLE **)v->instance->data;
167174

@@ -186,7 +193,7 @@ static void c_uart_write(mrbc_vm *vm, mrbc_value v[], int argc)
186193
@return String Received string.
187194
@return Nil Not enough receive length.
188195
*/
189-
static void c_uart_gets(mrbc_vm *vm, mrbc_value v[], int argc)
196+
static void c_uart_gets(struct VM *vm, mrbc_value v[], int argc)
190197
{
191198
mrbc_value ret;
192199
UART_HANDLE *handle = *(UART_HANDLE **)v->instance->data;
@@ -214,7 +221,7 @@ static void c_uart_gets(mrbc_vm *vm, mrbc_value v[], int argc)
214221
215222
$uart.clear_tx_buffer()
216223
*/
217-
static void c_uart_clear_tx_buffer(mrbc_vm *vm, mrbc_value v[], int argc)
224+
static void c_uart_clear_tx_buffer(struct VM *vm, mrbc_value v[], int argc)
218225
{
219226
UART_HANDLE *handle = *(UART_HANDLE **)v->instance->data;
220227
uart_clear_tx_buffer( handle );
@@ -226,7 +233,7 @@ static void c_uart_clear_tx_buffer(mrbc_vm *vm, mrbc_value v[], int argc)
226233
227234
$uart.clear_rx_buffer()
228235
*/
229-
static void c_uart_clear_rx_buffer(mrbc_vm *vm, mrbc_value v[], int argc)
236+
static void c_uart_clear_rx_buffer(struct VM *vm, mrbc_value v[], int argc)
230237
{
231238
UART_HANDLE *handle = *(UART_HANDLE **)v->instance->data;
232239
uart_clear_rx_buffer( handle );

0 commit comments

Comments
 (0)