Commit Graph

125 Commits

Author SHA1 Message Date
Nathael Pajani 3577bbcbb6 Small timer support fix Adding useful define in timer support. 2022-11-08 17:03:05 +01:00
Nathael Pajani ba5d4cabbe Add Todo comment 2022-11-08 17:03:05 +01:00
Nathael Pajani bed2088d74 Update all files to mention version 3 of the GPL. 2022-11-08 17:03:05 +01:00
Nathael Pajani 5afb9ebe67 Remove unnecessary intermediate var 2022-11-08 17:03:05 +01:00
Nathael Pajani 396c1ce015 A little bit more readable 2022-11-08 17:03:05 +01:00
Nathael Pajani 44ca88c86f Use appropriate defined value 2022-11-08 17:03:05 +01:00
Cyprien Laplace 02e9684716 oled: add support for SPI ssd130x displays
For I2C displays, the bus_type needs to be added:

+   .bus_type = SSD130x_BUS_I2C,
    .address = DISPLAY_ADDR,
    .bus_num = I2C0,

To use a SPI display:

1/ add the SSP include:

    #include "drivers/ssp.h"

2/ add the SPI pins to the init table:

    /* SPI : Display */
    { LPC_SSP0_SCLK_PIO_0_14, LPC_IO_DIGITAL },
    { LPC_SSP0_MISO_PIO_0_16, LPC_IO_DIGITAL },
    { LPC_SSP0_MOSI_PIO_0_17, LPC_IO_DIGITAL },

3/ update the oled_display conf:

    .bus_type = SSD130x_BUS_SPI,
    .bus_num = SSP_BUS_0,
    .gpio_dc = LPC_GPIO_0_0,
    .gpio_cs = LPC_GPIO_1_0,
    .gpio_rst = LPC_GPIO_0_31,

4/ initialize the SPI bus:

    ssp_master_on(SSP_BUS_0, LPC_SSP_FRAME_SPI, 8, 8*1000*1000);
2022-11-08 17:03:05 +01:00
Cyprien Laplace 8cefe33dc0 i2c: add asynchronous write
i2c_read() and i2c_write() are blocking functions, and their comments
have been updated to reflect this.

The new i2c_write_async() function is starting an i2c transfer, and
returns immediatly. All i2c transfer functions will now return -EAGAIN
if there is already a transfer in progress (-EBUSY was conflicting with
arbitration lost).

ssd130x_display_full_screen() has been updated to use this new
asynchronous write to start the transfer of the full screen. All
i2c_write* calls are placed in a retry loop if the call returns -EAGAIN.
2022-11-08 17:03:05 +01:00
Nathael Pajani d94a828f57 Echo on serial must be only a "best effort" and not mangle with ongoing transmissions 2022-11-08 17:03:05 +01:00
Nathael Pajani e024c33968 Also fix get_priority_mask() return value check in serial_flush() 2022-11-08 17:03:05 +01:00
Nathael Pajani 7c94a7dde3 Cosmetic changes (whitespaces) and typo in comments 2022-11-08 17:03:05 +01:00
Nathael Pajani b6285cd605 Small typo fix : use the same notation as for the rest of the function 2022-11-08 17:03:05 +01:00
Nathael Pajani 61962f3351 Add a define for RTC callback installation retry delay. 2022-11-08 17:03:05 +01:00
Nathael Pajani 015ffb605b Fix RTC code : return correct value on first call where it is valid. 2022-11-08 17:03:05 +01:00
Nathael Pajani 57ba2e8aad Complete rewrite of timers API, now documented here : http://wiki.techno-innov.fr/index.php/Technique/Logiciel/API/Use/Drivers/Timers 2022-11-08 17:03:05 +01:00
Nathael Pajani bc750d7819 Updated I2C driver to follow API documented here : http://wiki.techno-innov.fr/index.php/Technique/Logiciel/API/Use/Drivers/I2C Updated TMP101 sensor driver for API compliance Updated EEPROM driver for API compliance 2022-11-08 17:03:05 +01:00
Nathael Pajani 50f54752b2 ADC driver update for API compliance API documentation available here : http://wiki.techno-innov.fr/index.php/Technique/Logiciel/API/Use/Drivers/ADC 2022-11-08 17:03:05 +01:00
Nathael Pajani 652eedd7b5 Serial driver update : return -EINVAL or -EBUSY instead of -1 on errors 2022-11-08 17:03:05 +01:00
Nathael Pajani 0b4f5bc7c8 Comments update 2022-11-08 17:03:05 +01:00
Nathael Pajani bc70a0525b Rename lpc_core_cm0.h to lpc_core.h Rename lpc_regs_12xx.h to lpc_regs.h Split lpc_regs.h among all driver header files. Include lpc_core.h and lpc_regs.h from system.h Replace LPC1224 by LPC122x 2022-11-08 17:03:05 +01:00
Nathael Pajani 9911a01bc4 Add errno.h (code moved from system.h) Add stdint.h Add NULL and size_t to stddef.h 2022-11-08 17:03:04 +01:00
Nathael Pajani ab881a3170 Rename config register block as config instead of control 2022-11-08 17:03:04 +01:00
Nathael Pajani c1d7a4c06c Fix setup on interupts on GPIO 2022-11-08 17:03:04 +01:00
Nathael Pajani 4a0513dcbd Fix comment typo and remove obsolete code. 2022-11-08 17:03:04 +01:00
Nathael Pajani 1e27274b2d Add some helper functions for serial (UART) driver. 2022-11-08 17:03:04 +01:00
Nathael Pajani a8bb2d7d3d Some timer fixes for PWM mode. 2022-11-08 17:03:04 +01:00
Nathael Pajani ba752b9267 Remove unused header and fix comment. 2022-11-08 17:03:04 +01:00
Nathael Pajani e82e06d861 Fix hidden segfault, this should never have been working. It should have trigggered a BusFault exception instead. 2022-11-08 17:03:04 +01:00
Nathael Pajani 45d0e3922f Add comments to the head of each file to introduce the code and help readers to figure out what's done in each file. 2022-11-08 17:03:04 +01:00
Nathael Pajani c4e5b95a6c Some more coding style 2022-11-08 17:03:04 +01:00
Nathael Pajani abcf5d19f0 Coding style consistency 2022-11-08 17:03:04 +01:00
Nathael Pajani 4fab67b9bb Add a few comments 2022-11-08 17:03:04 +01:00
Nathael Pajani 0a12a84b0a Split system.h, moving systick related parts to systick.h Add a function to systick driver to get the current reload value for systick timer. Stop exporting internal sleep implementation functions. 2022-11-08 17:03:04 +01:00
Nathael Pajani a086bcfc5e Add a uprintf (UART printf) that outputs data on selected UART 2022-11-08 17:03:04 +01:00
Nathael Pajani 997e99ce03 Callback takes two 'l' 2022-11-08 17:03:04 +01:00
Nathael Pajani b1e329c74e Fix some bit definitions for serial registers. Set callback to NULL when uart is turned OFF. 2022-11-08 17:03:04 +01:00
Nathael Pajani 81b7780f2e Comments typo fixes 2022-11-08 17:03:04 +01:00
Cyprien LAPLACE d05a1b0196 serial: add serial_flush()
Only return once all the in-buffer characters are sent.
Also call uart handler while waiting interrupt off!

Now hard fault are visible :)
2022-11-08 17:03:04 +01:00
Nathael Pajani c34bfe5e1c Add const to function header for const config data 2022-11-08 17:03:04 +01:00
Nathael Pajani 5f22cdc02c Updated comments 2022-11-08 17:03:04 +01:00
Nathael Pajani edf0f79b2e Some timers fixes. 2022-11-08 17:03:04 +01:00
Nathael Pajani 929c4228bd Introduce new UART baud-rate generator configuration mechanism to achieve higher data rates. Keep the old one for data rates below or equal to 115200. Only 1152000 supported above (yet) 2022-11-08 17:03:04 +01:00
Nathael Pajani 6426fa7ed6 Use the saved flags for intr reset. Do not erase possible other interrupt sources. 2022-11-08 17:03:04 +01:00
Nathael Pajani 0e6e32024d Add support for RTC Tested on Sub1GHz module because it's the only module i have with RTC oscilator. 2022-11-08 17:03:04 +01:00
Cyprien Laplace f4a97d4a5e Use new set_pins scheme - part 1 Remove individual local set_*_pins functions WARNING : This commit is HARD-LINKED with the next one or pins will not be configured. Otherwise, you must perform the modifications on your code to configure the pins using the new scheme. 2022-11-08 17:03:04 +01:00
Cyprien Laplace 16cf643246 Fix : set gpio state only when GPIO is configured as output 2022-11-08 17:03:04 +01:00
Nathael Pajani bc58fdef09 Use const structs for the pio definitions Move the weak definitions outside of the driver file, so that the compiler cannot optimise and use the empty "weak" definitions. Next step is to merge all definitions in a single table, and call a single pio config function. 2022-11-08 17:03:04 +01:00
Nathael Pajani eb1caa84ec use const for functions which do not modify the pio structures. 2022-11-08 17:03:04 +01:00
Nathael Pajani 56b98a5e01 Separate internal LPC drivers and external ones Place the external ones in extdrv Split i2c and eeprom in two different headers 2022-11-08 17:03:04 +01:00
Nathael Pajani 9dd03edf0e Allow use of a null status argument. 2022-11-08 17:03:04 +01:00