I am using nrf52832 chip. I will be receiving time in isoFormat.
I am wondering how convert the iso format to get the date and time in my C program.
I am not using any RTOS but doing everything on baremetal.
I am using nrf52832 chip. I will be receiving time in isoFormat.
I am wondering how convert the iso format to get the date and time in my C program.
I am not using any RTOS but doing everything on baremetal.
Hi
So essentially you are getting a string with the date and time in ISO format?
I made a small example earlier showing how to use the time.h library on the nRF52DK, but the time.h library doesn't have a function for converting a string into a time object (only the opposite).
The following thread shows a way to use sscanf(..) to break down a date/time string into sub components, together with the date/time struct defined in time.h. You should be able to combine that example with the code I shared earlier:
https://cboard.cprogramming.com/c-programming/169114-how-convert-string-time_t.html
Best regards
Torbjørn
@Torbjørn Is there a android library which will take a calendar and which will send the data to the BLE?
Hi
Have you tried the Current Time Service client example in the nRF5 SDK?
The current time service is designed to allow a BLE peripheral to get an accurate date and time from a BLE central (typically a phone).
I think you need to run some code on the Android side to support it. Some quick googling yielded this example:
https://github.com/RideBeeline/android-bluetooth-current-time-service
I haven't tested it myself, but maybe you can get it working :)
Best regards